Discussion
In exception handling, which block is executed regardless of whether an exception occurs ?
Answer: C
The block is finally.
In languages such as Java, C# and Python, a finally block after try/catch runs whether the try block completes normally, throws an exception that is caught, or throws one that is not caught. It is used for cleanup, such as closing files and releasing locks.
The try block holds the code that may fail, and it stops at the first exception. A catch block runs only when a matching exception is thrown. throw is a statement that raises an exception, not a block that always runs.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development