πŸ“Š Ruby
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

πŸ‘οΈ
278
Total Visits
πŸ“½οΈ
2 y ago
Published
πŸŽ–οΈ
Yatendra Sir
Publisher
πŸ“ˆ
90%
Success Rate