11.) What is a secure way to handle sensitive API keys in JavaScript?
A) Store them in local storage.
B) Store them in the backend server.
C) Store them in plain text files.
D) Embed them in the HTML file.
12.) How can you prevent clickjacking attacks?
A) Use HTTPS.
B) Use strong passwords.
C) Avoid using iframes.
D) Use the X-Frame-Options header.
13.) Why should third-party libraries be used cautiously?
A) They reduce code size.
B) They are harder to debug.
C) They always introduce compatibility issues.
D) They might contain vulnerabilities or malicious code.
14.) What is a Same-Origin Policy (SOP)?
A) A rule to prevent HTTP requests.
B) A policy restricting how scripts interact with content from different origins.
C) A browser feature to cache data.
D) A method for improving performance.
15.) What is the purpose of the Secure flag in cookies?
A) To allow cookies to be accessed over HTTP.
B) To encrypt cookie data.
C) To restrict cookies to HTTPS connections only.
D) To prevent cookies from expiring.
16.) Why is it important to use parameterized queries in JavaScript?
A) To improve code readability.
B) To prevent SQL Injection attacks.
C) To reduce code execution time.
D) To simplify database queries.
17.) Which JavaScript API helps sanitize user inputs?
A) Sanitizer API
B) DOMParser
C) Fetch API
D) JSON.stringify
18.) Which type of data should never be stored in client-side storage like localStorage?
A) User preferences
B) API keys
C) Non-sensitive data
D) Caching information
19.) What is the main security benefit of using modules in JavaScript?
A) Improved performance.
B) Code readability.
C) Isolation of variables and functions.
D) Debugging ease.
20.) What should you do before deploying a JavaScript application?
A) Minify and compress files.
B) Scan for vulnerabilities using automated tools.
C) Perform thorough testing.
D) All of the above.
Related