21. Which of the following is used to create a range in Ruby?
22. What is the output of the following code snippet?
for i in 1..5
print i, " "
end
for i in 1..5
print i, " "
end
23. In Ruby, what does the `break` keyword do when used within nested loops?
24. Which of the following is NOT a valid way to exit a loop in Ruby?
25. In Ruby, what does the `until` keyword do?
26. What does the `retry` keyword do when used within a loop in Ruby?
27. In Ruby, what does the `case` statement allow you to compare against?
28. In Ruby, which of the following is NOT a valid loop construct?
29. What is the purpose of the loop keyword in Ruby?
30. Which of the following is used to define a block of code that executes repeatedly until a condition is met in Ruby?
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.