1. Engineering
  2. Computer Science
  3. 1 any case statement can be written as an if...

Question: 1 any case statement can be written as an if...

Question details

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
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution