11. What does the `next` keyword do in a loop in Ruby?
12. In Ruby, what does the `elsif` keyword allow you to do?
13. Which of the following is NOT a logical operator in Ruby?
14. What is the output of the following code snippet?
x = 5
while x > 0
puts x
x -= 1
end
x = 5
while x > 0
puts x
x -= 1
end
15. What does the `retry` keyword do in Ruby?
16. Which loop in Ruby allows you to execute code while a condition is true?
17. What does the unless keyword do in Ruby?
18. What is the purpose of the next keyword in a loop in Ruby?
19. What is the output of the following code snippet?
x = 1
loop do
puts x
x += 1
break if x > 5
end
x = 1
loop do
puts x
x += 1
break if x > 5
end
20. In Ruby, what is the purpose of the `case` statement when combined with `when` clauses?
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.