In: Computer Science
1. Any “case” statement can be written as an “if” statement.
| True |
| False |
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
| 0 |
| 7 |
| This loop is syntactically incorrect. |
| 9 |
| 8 |
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
| True |
| False |
4.Which one of the following is NOT a Ruby Exception?
| TypeError |
| NoMethodError |
| IOError |
| None of the choices. |
| ArgumentError |
| RuntimeError |
5.In Ruby, you can raise predefined exceptions or create your own in code with the “rescue” keyword.
| True |
| False |
6.Which of the following is not a valid keyword in Ruby?
| yield |
| in |
| until |
| unless |
| each |
| next |
| stop |
1)True
Any case can be written using if statements
2)This loop is syntactically incorrect.
next unless n==10 is correct
when n==10 is used
9 hey are printed
3)False
first
expression prints 1 second expression prints nothing.
4)None of the choices.

All the errors mentioned are present.
5)True
6)stop
all other keyword are present in ruby.