What lines of the following program gets executed, given that the exception is thrown at LINE D.
try { // LINE A // LINE B // LINE C // LINE D } catch(Exception e) { // LINE E // LINE F } // LINE G
D, E, F, G
A, B, C, D, E, F, G
A, B, C, D, G
A, B, C, D, E, F
Correct Answer : B
The first four lines will be executed and then the exception is thrown in LINE D and so the catch block gets executed. Hence LINE E and LINE F also get executed. After the catch block, LINE G gets executed in the usual way.
Hence, the answer is B.