Sample questions
Question 1Easy
A JSON Web Token (JWT) consists of:
- Header, payload and signature
- Username, password and salt
- Cookie, session and cache
- Public key, private key and CA
Answer: A. Header, payload and signature
Explanation
The three parts are Base64URL-encoded and separated by dots.
Step-by-step solution
- A JWT is three Base64URL parts joined by dots.
- The first part is the header, which holds the algorithm and type.
- The middle part is the payload, and the last part is the signature.
- So a JWT is header, payload and signature.
Why the other options are wrong
- B. A username, password and salt are not JWT parts.
- C. Cookie, session and cache are browser or server concepts, not JWT parts.
- D. A JWT does not contain CA keys or a private key.
Tip: JWT = header.payload.signature.
Question 2Easy
Multi-factor authentication (MFA) requires:
- Two passwords typed one after another
- Factors of different types
- Logging in from two browsers
- A longer single password
Answer: B. Factors of different types
Explanation
Factors come from different categories: something you know, have or are.
Step-by-step solution
- MFA needs more than one factor to log in.
- The factors must be of different types.
- Types are something you know, have or are.
- So the answer is: factors of different types.
Why the other options are wrong
- A. Two passwords typed in sequence are both knowledge factors, so this is not MFA.
- C. Logging in from two browsers adds no factor.
- D. A longer password is still one knowledge factor.
Tip: MFA needs different factor types: know, have or are.
Question 3Easy
- An operating time period
- An open transport protocol
- An online tax portal
- A one-time password
Answer: D. A one-time password
Explanation
OTPs are valid for a single login or transaction.
Step-by-step solution
- OTP stands for One-Time Password.
- It is valid for one login or transaction only.
- It is often sent by SMS or an app.
Why the other options are wrong
- A. Not a real expansion.
- B. Not a real expansion.
- C. Not a real expansion.
Question 4Easy
A fingerprint scan is which type of authentication factor?
- Somewhere you are
- Something you know
- Something you are
- Something you have
Answer: C. Something you are
Explanation
Biometrics are inherence factors.
Step-by-step solution
- A fingerprint is a biological trait of the user.
- Biological traits are the inherence (something you are) factor.
- It is not a place, a secret or an item.
- So the answer is: something you are.
Why the other options are wrong
- A. Somewhere you are refers to location, not a biometric trait.
- B. A fingerprint is not something you know.
- D. A fingerprint is not an item you carry.
Tip: Biometrics (fingerprint, face, iris) are always the 'something you are' factor.
Question 5Medium
In OAuth, "scopes" are used to:
- Limit what the access token allows
- Set the token's colour
- Measure network latency
- Encrypt the refresh token
Answer: A. Limit what the access token allows
Explanation
Scopes such as read:email restrict the token to the permissions the user approved.
Step-by-step solution
- Scopes name the permissions an app asks for, such as read:email.
- The user approves these scopes.
- The token then allows only those actions.
- So scopes limit what the access token allows.
Why the other options are wrong
- B. Token colour is not a concept in OAuth.
- C. Network latency is not measured by scopes.
- D. Scopes do not encrypt the refresh token.
Tip: Scopes = permissions on a token. Fewer scopes means less damage if the token leaks.
Question 6Medium
What is the purpose of the exp claim in a JWT?
- Its expiry time
- Listing the user's friends
- Naming the signing algorithm
- Storing the user's password
Answer: A. Its expiry time
Explanation
Short expiry limits how long a stolen token can be used.
Step-by-step solution
- The exp claim is a time after which the token is invalid.
- It is stored as a numeric timestamp in the payload.
- A short expiry limits how long a stolen token works.
- So exp is the expiry time.
Why the other options are wrong
- B. Friends lists are not stored in exp.
- C. The signing algorithm is named in the header, not exp.
- D. Passwords must never be stored in a JWT.
Tip: exp = expiry time. Check it on every request.
Question 7Medium
OAuth 2.0 is primarily a framework for:
- Hashing passwords
- Delegated authorisation
- Encrypting hard disks
- Compressing tokens
Answer: B. Delegated authorisation
Explanation
OAuth lets a user grant an app limited access to their resources on another service without sharing their password.
Step-by-step solution
- OAuth 2.0 lets a user grant an app limited access to resources.
- The access is delegated, so the user does not share a password.
- This is authorisation, not hashing or encryption.
- So the answer is: delegated authorisation.
Why the other options are wrong
- A. OAuth does not hash passwords.
- C. Disk encryption is outside OAuth.
- D. Token compression is not the purpose of OAuth.
Tip: OAuth = authorisation (what an app may access). OIDC = authentication (who the user is).
Question 8Medium
Account lockout after several failed logins mainly protects against:
- Online brute-force attacks
- Cross-site scripting
- SQL injection in the login form
- Clickjacking of the login button
Answer: A. Online brute-force attacks
Explanation
Limiting attempts slows guessing; lockouts should be designed so attackers cannot easily lock out real users.
Step-by-step solution
- Account lockout stops further login attempts after several failures.
- Brute-force attacks try many passwords one after another online.
- Lockout slows or stops these guessing attacks.
- So lockout protects against online brute-force attacks.
Why the other options are wrong
- B. Cross-site scripting is a script injection issue, not a login-attempt issue.
- C. SQL injection is prevented with input handling, not lockout.
- D. Clickjacking is a UI overlay attack and not addressed by lockout.
Tip: Lockout and rate limiting slow online guessing. Lockouts should not let attackers lock out real users easily.
Question 9Hard
"Sign in with [a large provider]" on a third-party website typically uses:
- Kerberos with smart cards
- FTP
- Plain HTTP basic authentication
- OpenID Connect
Answer: D. OpenID Connect
Explanation
OIDC (built on OAuth 2.0) lets the site obtain verified identity information from the provider.
Step-by-step solution
- 'Sign in with' a provider lets a third-party site verify the user's identity.
- This is done with OpenID Connect, built on OAuth 2.0.
- The site receives verified identity information in an ID token.
- So the answer is: OpenID Connect.
Why the other options are wrong
- A. Kerberos with smart cards is an enterprise login system, not web social login.
- B. FTP is a file transfer protocol.
- C. Basic HTTP authentication is not used for social sign-in.
Tip: 'Sign in with' buttons are OIDC on top of OAuth 2.0.
Question 10Hard
Why should session IDs be regenerated after a user logs in?
- To avoid using HTTPS
- To prevent session fixation
- To make the session cookie smaller
- To speed up the database
Answer: B. To prevent session fixation
Explanation
If an attacker planted a known session ID before login, regenerating it ensures they cannot reuse it afterwards.
Step-by-step solution
- Session fixation tricks a user into using a session ID the attacker already knows.
- If the ID is not changed at login, the attacker can use it after the user logs in.
- Generating a new session ID at login cuts off the attacker's copy.
- So regeneration prevents session fixation.
Why the other options are wrong
- A. HTTPS is still needed; regenerating IDs does not replace it.
- C. Session ID size is not affected by regeneration in a way that matters here.
- D. Regenerating the ID does not speed up the database.
Tip: Always issue a new session ID after login or privilege change.
Practise all 29 questions free
The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.
Open this topic in the app →