Ruby - Error Handling
Which of the following Ruby code snippets correctly demonstrates the use of
ensure to guarantee execution of cleanup code?ensure to guarantee execution of cleanup code?ensure placementensure block must be inside the begin...end block to guarantee execution.begin puts "Process" ensure puts "Always runs" endcorrectly places
ensure inside begin...end. begin puts "Process" rescue puts "Error" end ensure puts "Cleanup"places
ensure outside the block, which is invalid syntax. begin puts "Process" rescue puts "Error" ensure puts "Cleanup"is missing the closing
end. begin puts "Process" rescue puts "Error" finally puts "Cleanup"uses
finally, which is not valid Ruby syntax.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions