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=1
if x > 2
puts “x is greater than 2”
elsif x <= 2 and x!=0
puts “x is 1”
else
puts “I can’t guess the number”
end

What is the output of the given code?
x=1
if x > 2
puts “x is greater than 2”
elsif x <= 2 and x!=0
puts “x is 1”
else
puts “I can’t guess the number”
end
a) x is greater than 2
b) x is 1
c) I can’t guess the number
d) None of the mentioned

Answer: b
Explanation: The given condition is false so no other statement is executed.
Output: x is 1

Join The Discussion