Q. What will be output for the following code?

Code:
begin
         
    raise 'Exception Created!'
   
    puts 'After Exception' 
   
  rescue    
    puts 'Finally Saved!'
    
ensure
   puts 'ensure block execute'
end
  • (A) ensure block execute
  • (B) After exception! Finally Saved! ensure block execute
  • (C) Ecxception Created! Finally Saved! ensure block execute
  • (D) Finally Saved! ensure block execute
πŸ’¬ Discuss
βœ… Correct Answer: (D) Finally Saved! ensure block execute
Explanation: The output for the following code is Option D.
Explanation by: Yatendra Sir
The output for the following code is Option D.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
316
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Yatendra Sir
Publisher
πŸ“ˆ
89%
Success Rate