Blog

MCQs

Disclaimer:

Educational Use Only:

The website links provided are to be used strictly for educational and knowledge-gaining purposes only.

No Misuse:

Do not misuse the links or the information contained therein for any commercial, illegal, or unethical activities.

Respect for Websites and Businesses:

Respect the intellectual property and business interests of the websites and their owners. Do not attempt to alter, copy, or redistribute content without proper authorization.

Acknowledge Value of Knowledge:

Recognize and value the knowledge and resources shared by these websites. Use the information responsibly and ethically.

No Endorsement:

The provision of these links does not imply endorsement of the linked sites, their content, or their products and services. Users are responsible for evaluating the suitability and accuracy of the information.

User Responsibility:

By accessing these links, you agree to use the information at your own risk and to comply with all applicable laws and website terms of use.


  1. Which attribute ensures cookies are sent only over HTTPS connections?
    a. Domain
    b. Secure
    c. Path
    d. Expires
    Answer: b. Secureinfosecinstitute​
  2. What attribute in cookies prevents access by JavaScript?
    a. Secure
    b. HttpOnly
    c. Path
    d. SameSite
    Answer: b. HttpOnlyacunetix​
  3. What is the main function of the SameSite cookie attribute?
    a. Control cookie expiry
    b. Block third-party cookies
    c. Restrict cookie transmission during cross-site requests
    d. Allow persistent sessions
    Answer: c. Restrict cookie transmission during cross-site requestsowasp​
  4. Which flag mitigates XSS cookie theft?
    a. Path
    b. Secure
    c. Domain
    d. HttpOnly
    Answer: d. HttpOnlyacunetix​
  5. Under which attribute will cookies never be sent with third-party requests?
    a. SameSite=Lax
    b. SameSite=None
    c. SameSite=Strict
    d. Secure
    Answer: c. SameSite=Strictowasp​
  6. Cookies without the Secure flag can be transmitted via what protocol?
    a. HTTPS only
    b. SMTP
    c. HTTP
    d. SSH
    Answer: c. HTTPinfosecinstitute​
  7. The Secure flag is useful to prevent what attack type?
    a. XSS
    b. CSRF
    c. Man-in-the-middle (MITM) cookie sniffing
    d. DNS poisoning
    Answer: c. Man-in-the-middle (MITM) cookie sniffinginfosecinstitute​
  8. When SameSite=Lax is used, cookies will be sent under what condition?
    a. Always
    b. Only for first-party top-level navigations
    c. During background image loads
    d. Never
    Answer: b. Only for first-party top-level navigationsowasp​
  9. The SameSite=None attribute requires which other flag?
    a. Domain
    b. Secure
    c. Path
    d. Expires
    Answer: b. Secureowasp​
  10. Which of the following is a secure cookie configuration?
    a. Set-Cookie: SID; Secure; HttpOnly; SameSite=Strict
    b. Set-Cookie: SID
    c. Set-Cookie: SID; Domain=example.com
    d. Set-Cookie: SID; Path=/public
    Answer: a. Set-Cookie: SID; Secure; HttpOnly; SameSite=Strictowasp​
  11. Which cookie flag reduces exposure to network sniffing?
    a. Secure
    b. Domain
    c. Max-Age
    d. Expires
    Answer: a. Secureinfosecinstitute​
  12. Which flag prevents cookies from being modified via client-side scripts?
    a. HttpOnly
    b. Secure
    c. Path
    d. Lax
    Answer: a. HttpOnlyacunetix​
  13. What risk is associated with missing HttpOnly flag?
    a. Unencrypted transmission
    b. Cookie theft via JavaScript (XSS)
    c. Session timeout
    d. Secure deletion failure
    Answer: b. Cookie theft via JavaScript (XSS)acunetix​
  14. Which cookie attribute limits its scope to a specific domain?
    a. Domain
    b. Secure
    c. SameSite
    d. HttpOnly
    Answer: a. Domaindeveloper.mozilla​
  15. The cookie “SameSite=None; Secure” is typically used for what?
    a. Blocking advertisements
    b. Full cross-site operation under HTTPS
    c. Limiting session duration
    d. Encrypting cookie data
    Answer: b. Full cross-site operation under HTTPSowasp​
  16. HttpOnly cookies protect against what type of script?
    a. Server-side Python
    b. JavaScript in web pages
    c. SQL injection logic
    d. NodeJS modules
    Answer: b. JavaScript in web pagesacunetix​
  17. Secure cookies should not be set for sites using what protocol?
    a. HTTPS
    b. FTP
    c. HTTP
    d. IMAP
    Answer: c. HTTPinfosecinstitute​
  18. A cookie is accessible to client scripts if which attribute is missing?
    a. Secure
    b. HttpOnly
    c. Path
    d. SameSite
    Answer: b. HttpOnlyacunetix​
  19. The flag that helps prevent session hijacking via sniffing is:
    a. Secure
    b. Domain
    c. Max-Age
    d. HttpOnly
    Answer: a. Secureinfosecinstitute​
  20. Which attribute is used to mitigate CSRF attacks?
    a. Expires
    b. SameSite
    c. Domain
    d. Max-Age
    Answer: b. SameSiteexamradar​
  21. Cookies transmitted over unsecured HTTP channels are vulnerable to:
    a. Cache poisoning
    b. Eavesdropping
    c. Log tampering
    d. CSRF
    Answer: b. Eavesdroppinginfosecinstitute​
  22. Which of the following helps prevent cookies from being sent during cross-origin requests?
    a. HttpOnly
    b. Secure
    c. SameSite
    d. Domain
    Answer: c. SameSiteowasp​
  23. The __Host- prefix in a cookie enforces what condition?
    a. Cookie has path=/, no domain attribute, Secure flag
    b. Cookie can have any domain
    c. Cookie uses default expiry
    d. Cookie can be sent via HTTP
    Answer: a. Cookie has path=/, no domain attribute, Secure flagowasp​
  24. Which cookie attribute must be applied to secure sensitive tokens like session IDs?
    a. HttpOnly
    b. Secure
    c. SameSite
    d. All of the above
    Answer: d. All of the aboveacunetix+2​
  25. What happens if Secure flag is set but site uses HTTP?
    a. Cookie visible to scripts
    b. Cookie ignored by browsers
    c. Cookie sent normally
    d. Cookie encrypted automatically
    Answer: b. Cookie ignored by browsersinfosecinstitute​
  26. SameSite=Strict provides:
    a. Maximum CSRF protection
    b. Automatic cookie deletion
    c. Enhanced caching speed
    d. Public cookie access
    Answer: a. Maximum CSRF protectionowasp​
  27. Which cookie attribute reduces risk of token leakage between sites?
    a. Max-Age
    b. SameSite
    c. Expires
    d. Domain
    Answer: b. SameSiteowasp​
  28. HttpOnly is primarily used to defend against:
    a. CSRF
    b. SQL injection
    c. XSS
    d. Session fixation
    Answer: c. XSSacunetix​
  29. Which flag combination gives best cookie protection?
    a. Secure; HttpOnly; SameSite=Strict
    b. Max-Age; Domain
    c. Secure only
    d. HttpOnly only
    Answer: a. Secure; HttpOnly; SameSite=Strictinfosecinstitute+2​
  30. Cookies used for authentication should always use:
    a. Secure and HttpOnly flags
    b. Domain flag only
    c. Expires only
    d. SameSite=None
    Answer: a. Secure and HttpOnly flagsacunetix+1​
  31. Why is the Secure flag essential for session cookies?
    a. It prevents cookie theft over HTTP
    b. It increases website loading
    c. It hides cookies from server logs
    d. It sets cookie expiry
    Answer: a. It prevents cookie theft over HTTPinfosecinstitute​
  32. SameSite=Lax is preferred for what reason?
    a. Balanced protection and usability
    b. Enables public access
    c. Blocks all cookies
    d. Encrypts cookies end-to-end
    Answer: a. Balanced protection and usabilityowasp​
  33. What common vulnerability arises if cookies lack Secure attribute?
    a. Cookie reuse
    b. Man-in-the-middle exposure
    c. Session timeout
    d. Flooding attack
    Answer: b. Man-in-the-middle exposureinfosecinstitute​
  34. What attribute prevents cookies from being shared during iframe loads?
    a. HttpOnly
    b. SameSite=Strict
    c. Path
    d. Secure
    Answer: b. SameSite=Strictowasp​
  35. Secure cookies can only be transmitted via what?
    a. HTTPS connections
    b. Any connection
    c. SSH
    d. Localhost connections
    Answer: a. HTTPS connectionsinfosecinstitute​
  36. HttpOnly cookies help protect from which JavaScript property?
    a. document.cookie
    b. console.log
    c. alert()
    d. window.location
    Answer: a. document.cookieacunetix​
  37. SameSite helps reduce the risk of what attack?
    a. Cross-site request forgery
    b. Brute-force
    c. SQL injection
    d. Password spraying
    Answer: a. Cross-site request forgeryexamradar​
  38. A common misconfiguration in cookies is:
    a. Missing Secure flag
    b. Short expiry time
    c. Too many cookies
    d. Large cookie size
    Answer: a. Missing Secure flaginfosecinstitute​
  39. HttpOnly cookies cannot be accessed using:
    a. HTTP header response
    b. JavaScript code
    c. PHP session
    d. Server-side APIs
    Answer: b. JavaScript codeacunetix​
  40. The Secure flag ensures cookies are sent:
    a. Only with HTTPS
    b. With HTTP and HTTPS
    c. Over local network only
    d. To localhost only
    Answer: a. Only with HTTPSinfosecinstitute​
  41. Which cookie attribute improves defense in depth?
    a. SameSite
    b. Secure
    c. HttpOnly
    d. All of the above
    Answer: d. All of the aboveacunetix+2​
  42. Which flag combination prevents cookies from being stolen through scripts or intercepts?
    a. Secure; HttpOnly
    b. Domain; Path
    c. Expires; Max-Age
    d. None
    Answer: a. Secure; HttpOnlyacunetix+1​
  43. Cookies lacking HttpOnly are exploitable under:
    a. XSS attacks
    b. DoS attacks
    c. SQL injection
    d. Command injection
    Answer: a. XSS attacksacunetix​
  44. What type of cookies ensure better protection for sessions?
    a. Secure cookies
    b. Persistent cookies
    c. Tracking cookies
    d. Third-party cookies
    Answer: a. Secure cookiesinfosecinstitute​
  45. Setting SameSite=None without Secure causes cookies to be:
    a. Ignored by browsers
    b. Sent across requests
    c. Prefetched in cache
    d. Expired early
    Answer: a. Ignored by browsersowasp​
  46. The Secure attribute should always be paired with:
    a. HTTPS
    b. HTTP
    c. FTP
    d. None
    Answer: a. HTTPSinfosecinstitute​
  47. Which cookie attribute helps limit session scope to domain?
    a. Domain
    b. Secure
    c. HttpOnly
    d. SameSite
    Answer: a. Domaindeveloper.mozilla​
  48. Secure cookie configuration example follows which format?
    a. Set-Cookie: __Host-SID=<token>; path=/; Secure; HttpOnly; SameSite=Strict
    b. Set-Cookie: SID
    c. Set-Cookie: Secure
    d. Cookie: Domain
    Answer: a. Set-Cookie: __Host-SID=<token>; path=/; Secure; HttpOnly; SameSite=Strictowasp​
  49. The main defense of Secure cookies is against:
    a. Network eavesdropping
    b. XSS
    c. SQL injection
    d. Phishing
    Answer: a. Network eavesdroppinginfosecinstitute​
  50. Which flag in cookies was introduced to stop browsers from sending cookies during cross-origin POST requests?
    a. SameSite
    b. HttpOnly
    c. Secure
    d. Domain
    Answer: a. SameSiteowasp​
  1. https://www.infosecinstitute.com/resources/general-security/securing-cookies-httponly-secure-flags/
  2. https://www.acunetix.com/blog/web-security-zone/httponly-flag-protecting-cookies/
  3. https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/06-Session_Management_Testing/02-Testing_for_Cookies_Attributes
  4. https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Cookies
  5. https://examradar.com/secure-cookies-attack-in-session-management-mcqs/
  6. https://www.sanfoundry.com/cyber-security-questions-answers-caches-cookies/
  7. https://examradar.com/question/5247/Secure-cookies-have-which-feature/
  8. https://testbook.com/objective-questions/mcq-on-cookies–5eea6a1439140f30f369f2c5
  9. https://www.sanfoundry.com/1000-cyber-security-questions-answers/
  10. https://www.programmingempire.com/40-mcqs-on-cookies-and-session-management-with-servlets/
  11. https://www.invicti.com/learn/cookie-security-flags
  12. https://www.theknowledgeacademy.com/blog/cyber-security-mcq-and-answers/
  13. https://owasp.org/www-project-secure-coding-practices-quick-reference-guide/stable-en/02-checklist/05-checklist
  14. https://owasp.org/www-community/controls/SecureCookieAttribute
  15. https://owasp.org/www-project-top-ten/
  16. https://www.yeahhub.com/20-multiple-choice-questions-on-website-security/
  17. https://www.reflectiz.com/blog/owasp-top-ten-2025/
  18. https://www.youtube.com/watch?v=utwfZ9hZrrE
  19. https://blog.codacy.com/owasp-top-10
  20. https://www.interviewbit.com/cyber-security-mcq/

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!