Bird
0
0

Given the URL /books/45/chapters/3, what resource does the identifier 3 represent?

medium📝 Predict Output Q4 of 15
Rest API - URL and Resource Design
Given the URL /books/45/chapters/3, what resource does the identifier 3 represent?
AThe book with ID 3
BThe chapter with ID 3 of book 45
CThe book with ID 45
DThe author of book 45
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the URL structure

    The URL shows nested resources: books/45 and then chapters/3 inside that book.
  2. Step 2: Identify what '3' refers to

    The '3' is the ID of the chapter resource under book 45, so it is the chapter ID.
  3. Final Answer:

    The chapter with ID 3 of book 45 -> Option B
  4. Quick Check:

    Nested resource ID = chapter 3 under book 45 [OK]
Quick Trick: Last ID in URL path is the current resource [OK]
Common Mistakes:
  • Assuming '3' is a book ID
  • Confusing parent and child resource IDs
  • Ignoring URL nesting order

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes