Home / Programming MCQs / Ruby MCQs / Question

Y

Yatendra Sir • 5.60K Points
Tutor III

Q. What will be output for the following code When input number is ""!""?

Code:
def catch_and_throw(value) 
  
  puts value 
  a = readline.chomp 
  
  throw :value_e if a == ""!""
  return a 
  
end
  
catch :value_e do
  
  number = catch_and_throw(""Enter Number: "") 
end
(A) Error
(B) 0
(C) Nil
(D) Infinite Loop

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.