🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← All topics

Quiz: Error Handling and Debugging: questions with answers

10 questions, each with the answer and a short explanation.

Take the timed quiz + get a certificate →
  1. Q1. What does this print? (code)
  2. Q2. What does this print? (code)
  3. Q3. What does this print? (code)
  4. Q4. Which error type do you get from undefined.length?
  5. Q5. Why throw new Error("…") instead of throw "failed"?
  6. Q6. In a catch block, you get an error your code does not know how to handle. What should you do?
  7. Q7. placeOrder() calls chargeCard(), which throws. Only main() has a try/catch around placeOrder(). What happens?
  8. Q8. Which is the correct way to catch a rejected promise in an async function?
  9. Q9. Which DevTools feature pauses your code on a chosen line so you can inspect variables?
  10. Q10. What is finally best used for?