Examveda
Examveda

What does the ensure keyword do in Ruby exception handling?

A. It rescues specific types of exceptions

B. It raises an exception

C. It defines a new module

D. It ensures that a block of code is always executed, regardless of whether an exception is raised or not

Answer: Option D


This Question Belongs to Ruby Programming >> Exception Handling In Ruby

Join The Discussion

Related Questions on Exception Handling in Ruby

What is an exception in Ruby?

A. A way to group related methods and constants

B. A method for defining variables

C. An unexpected event that disrupts the normal flow of the program

D. A predefined object in Ruby