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

Quiz: XSS: questions with answers

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

Take the timed quiz + get a certificate →
  1. Q1. A malicious comment is saved in the database and runs in every reader's browser. This is:
  2. Q2. What is the main fix for XSS?
  3. Q3. In React, which is dangerous with user input?
  4. Q4. What did html.escape turn the < of the payload into?
  5. Q5. Which header acts as a safety net that blocks inline scripts if an XSS bug slips through?
  6. Q6. A search page prints "Results for" plus the q parameter without encoding, and the attacker sends a crafted link. Which type of XSS is this?
  7. Q7. Which line in plain JavaScript is safe for showing a user's comment?
  8. Q8. What does this print? (code)
  9. Q9. A course description must allow bold text and links from instructors. What is the safe approach?
  10. Q10. Why can XSS be as serious as stealing a password?