21.) What is the primary use of strict mode in JavaScript?
A) To optimize performance.
B) To enhance security by catching common coding errors.
C) To enforce HTTPS.
D) To prevent API misuse.
22.) Which storage type is most vulnerable to XSS attacks?
A) localStorage
B) sessionStorage
C) cookies
D) cache
23.) What type of attack is prevented by using the X-Frame-Options header?
A) clickjacking
B) sniffing
C) phishing
D) injection
24.) What is a potential risk of using inline JavaScript?
A) Reduced performance.
B) Difficulty in debugging.
C) Exposure to XSS attacks.
D) Increased file size.
25.) How can developers avoid exposing sensitive information in source maps?
A) Disable source maps in production.
B) Use unminified files.
C) Store source maps in cookies.
D) Avoid debugging tools.
26.) Why is it important to set an expiration time for JWTs (JSON Web Tokens)?
A) To reduce server load.
B) To prevent unauthorized access after a specific time.
C) To improve token generation speed.
D) To simplify authentication.
27.) What is the purpose of a nonce attribute in a CSP?
A) To prevent HTTP requests.
B) To block all external scripts.
C) To encrypt inline scripts.
D) To allow specific inline scripts to execute securely.
Related