Home / Programming MCQs / Ruby MCQs / Question
Y
Q. What will be output for the following code?
begin raise 'Exception Created!' puts 'After Exception' rescue puts 'Finally Saved!' ensure puts 'ensure block execute' end
The output for the following code is Option D.
You must be Logged in to update hint/solution
What is the default value of a variable in Ruby if not initialized?
What is the output of the given code? counter = -50 while counter <0 puts counter counter+=10 end
Which method is used to add a number of months to a Date object in Ruby?
What is the output of the given code? i = 50 while i > 25 do print 50/i i -= 1 end
What is the purpose of the File.size method in Ruby?
What is the purpose of the raise keyword in Ruby?
Which modifier is used to perform single-line matching in Ruby regular expressions?
What is the correct syntax for creating a hash in Ruby?
What is the main difference between a lambda and a Proc in Ruby?
Discusssion
Login to discuss.