31. In Ruby, what is the purpose of the `redo` keyword?
32. Which keyword in Ruby is used to exit a loop prematurely?
33. In Ruby, which of the following is used to handle multiple conditions with one expression?
34. In Ruby, what does the `else` keyword do?
35. In Ruby, what does the `elsif` keyword do?
36. The following syntax is correct for if conditional statement.
if condition
code
end
if condition
code
end
37. If expression.
The expression can be of which type?
The expression can be of which type?
38. What error does the if condition gives if not terminated with end statement?
39. What is the output of the following?
if 1<2
print "one is less than two"
end
if 1<2
print "one is less than two"
end
40. What is the output of the code?
if 11<2
print "Eleven is less than two"
end
print "11 is greater"
if 11<2
print "Eleven is less than two"
end
print "11 is greater"
Read More Section(Control Structures in Ruby)
Each Section contains maximum 100 MCQs question on Control Structures in Ruby. To get more questions visit other sections.