AP® Cybersecurity Securing Applications and Data Practice Questions
Work through AP Cybersecurity practice questions on Securing Applications and Data, then check each answer against a worked solution.
Free · no sign-up Open questions need no account. Sign up or log in to open the rest.
Subtopic: Protecting Applications Clear filter
Question 2
A web application has a user profile page that displays the user's chosen display name embedded in HTML. An adversary sets their display name to a string containing </code> tags with malicious code. When other users view the adversary's profile, the script runs in their browsers and steals session cookies. Which TWO practices would MOST effectively prevent this vulnerability?</p><ul><li>I. Output encoding/escaping of HTML special characters when rendering user-supplied data</li><li>II. Encrypting the entire user database with AES-256</li><li>III. Implementing a Content Security Policy (CSP) restricting script execution</li><li>IV. Requiring MFA for all user accounts</li></ul>
Main Solution
Answer
This is cross-site scripting (XSS). Output encoding prevents user input from being interpreted as HTML/JavaScript; CSP restricts which scripts the browser will execute. Database encryption and MFA do not stop XSS.
Answer: Correct: B
Answer images
Question 3
Question 4
AP® and Advanced Placement® are registered trademarks of the College Board, which is not affiliated with, and does not endorse, Verityprep. Names are used for identification purposes only.

