1. What is the keyword used to define a conditional statement in Ruby?
2. Which of the following loops in Ruby is executed at least once?
3. In Ruby, what does the unless keyword do?
4. What is the purpose of the case statement in Ruby?
5. Which loop in Ruby allows you to iterate over a collection of elements?
6. What is the result of the expression 5 > 3 ? "Yes" : "No" in Ruby?
7. What does the break keyword do in a loop in Ruby?
8. Which of the following is NOT a comparison operator in Ruby?
9. What is the purpose of the redo keyword in Ruby?
10. What is the output of the following code snippet?
x = 10
unless x > 15
puts "Hello"
end
x = 10
unless x > 15
puts "Hello"
end
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.