Spring Security MCQs with answers Page - 3

Here, you will find a collection of MCQ questions on Spring Security. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Arogya • 2.57K Points
Extraordinary

Q. Which annotation allows pre-authorization checks on methods?

  • (A) @PreAuthorize
  • (B) @RequestMapping
  • (C) @Qualifier
  • (D) @Value

A

Arogya • 2.57K Points
Extraordinary

Q. What does hasRole('ADMIN') mean?

  • (A) Checks if database exists
  • (B) Allows access only to ADMIN users
  • (C) Creates admin account
  • (D) Deletes user session

A

Arogya • 2.57K Points
Extraordinary

Q. Which component handles authentication logic?

  • (A) AuthenticationManager
  • (B) ViewResolver
  • (C) JdbcTemplate
  • (D) HandlerMapping

A

Arogya • 2.57K Points
Extraordinary

Q. Which class processes login credentials?

  • (A) UsernamePasswordAuthenticationToken
  • (B) SecurityContextHolder
  • (C) HttpSession
  • (D) FilterChain

A

Arogya • 2.57K Points
Extraordinary

Q. Spring Security supports which authentication provider?

  • (A) In-memory authentication
  • (B) JDBC authentication
  • (C) LDAP authentication
  • (D) All of the above

A

Arogya • 2.57K Points
Extraordinary

Q. Which security attack is prevented by session fixation protection?

  • (A) Session hijacking
  • (B) SQL injection
  • (C) XSS
  • (D) DDoS

A

Arogya • 2.57K Points
Extraordinary

Q. What does logout() configuration do?

  • (A) Deletes database
  • (B) Ends user session securely
  • (C) Stops server
  • (D) Encrypts password

A

Arogya • 2.57K Points
Extraordinary

Q. Which HTTP method is commonly required for CSRF protection tokens?

  • (A) POST
  • (B) GET
  • (C) DELETE
  • (D) OPTIONS

A

Arogya • 2.57K Points
Extraordinary

Q. Which feature is used for stateless authentication in APIs?

  • (A) JWT (JSON Web Token)
  • (B) Cookies only
  • (C) Sessions only
  • (D) HTML forms

A

Arogya • 2.57K Points
Extraordinary

Q. Which header usually carries JWT token?

  • (A) Authorization
  • (B) Content-Type
  • (C) Host
  • (D) Accept

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ