1. Any “case” statement can be written as an “if” statement.
2.How many iterations does the following “loop” statement
have?
n = 1
loop do
n = n + 1
puts “hey"
next unless n = 10
break
end
|
This loop is syntactically incorrect. |
3.The following two conditional expressions are equivalent
outcome wise:
n = 1
begin
puts n
end while n < 1
n = 1
while n < 1
puts n
end
4.Which one of the following is NOT a Ruby Exception?
5.In Ruby, you can raise predefined exceptions or create your
own in code with the “rescue” keyword.
6.Which of the following is not a valid keyword in Ruby?