🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Error Handling and Debugging: all 10 questions

Quiz: Error Handling and Debugging · Question 1 of 10

What does this print? (code)

What does this print?

try {
  console.log("A");
  null.x;
  console.log("B");
} catch (e) {
  console.log("C");
} finally {
  console.log("D");
}
  1. A.A B C D
  2. B.A C D
  3. C.A B D
  4. D.C D
Answer & explanation

Correct answer: A C D

The error on null.x skips "B"; catch prints C and finally always prints D. The printed lines are A, C, D.

Can you get the rest right without peeking?

Take the timed Quiz: Error Handling and Debugging quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →