Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What is the output of the given code?
x=8
y=10
unless x<y
puts “x is less than y”
end
unless x>y+1
puts “x is less than y+1”
end

What is the output of the given code?
x=8
y=10
unless x<y
puts “x is less than y”
end
unless x>y+1
puts “x is less than y+1”
end
a) x is less than y
b) x is less than y+1
c) x is less than y
x is less than y+1
d) None of the mentioned

Answer: b
Explanation: x is always less than y and y+1 hence only the second condition will evaluate to false and corresponding code is executed.

Join The Discussion