Bird
0
0

Which of the following is true about the default behavior of @RequestParam in Spring Boot?

easy📝 Conceptual Q2 of 15
Spring Boot - REST Controllers
Which of the following is true about the default behavior of @RequestParam in Spring Boot?
AIt ignores missing query parameters by default
BIt requires the query parameter to be present by default
CIt automatically converts query parameters to JSON
DIt only works with POST requests
Step-by-Step Solution
Solution:
  1. Step 1: Check default required behavior

    By default, @RequestParam requires the query parameter to be present; otherwise, Spring throws an error.
  2. Step 2: Understand other options

    It does not ignore missing parameters unless specified, does not convert to JSON automatically, and works with all HTTP methods, not just POST.
  3. Final Answer:

    It requires the query parameter to be present by default -> Option B
  4. Quick Check:

    @RequestParam required = true by default [OK]
Quick Trick: Query params are required unless marked optional [OK]
Common Mistakes:
  • Assuming query params are optional by default
  • Thinking @RequestParam only works with POST
  • Believing it converts parameters to JSON automatically

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes