Question 121Asked in DSSSB TGT Computer Science, 24 Jun 2023, Shift 3 (4:30 PM)

Select the true statement about try-catch blocks.

  1. AA try block must have at least 1 catch to have a finally block.
  2. BA try block must have only 1 finally block for each catch block.
  3. CA try block can have many catches but only 1 finally block.
  4. DA try block can have many catches and many finally blocks.
Show answerHide answer

Correct answer: (C) A try block can have many catches but only 1 finally block.

Explanation

A try block can be followed by many catch blocks but at most one finally block. A try with only a finally (no catch) is also allowed, so A is wrong.

From DSSSB TGT Computer Science PYQ, 24 Jun 2023, Shift 3 (4:30 PM)

This is question 121 of DSSSB TGT Computer Science PYQ, 24 Jun 2023, Shift 3 (4:30 PM). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.