Bird
0
0

Given the query { books(limit: 2) { title } } and a database with books titled 'A', 'B', 'C', what will the query return?

medium📝 query result Q13 of 15
GraphQL - Queries
Given the query { books(limit: 2) { title } } and a database with books titled 'A', 'B', 'C', what will the query return?
A[{ title: 'A' }, { title: 'B' }, { title: 'C' }]
B[] (empty list)
CError: 'limit' is not a valid argument
D[{ title: 'A' }, { title: 'B' }]
Step-by-Step Solution
Solution:
  1. Step 1: Understand the limit argument

    The limit: 2 argument restricts the number of returned books to 2.
  2. Step 2: Predict the returned data

    From books 'A', 'B', 'C', only the first two 'A' and 'B' will be returned.
  3. Final Answer:

    [{ title: 'A' }, { title: 'B' }] -> Option D
  4. Quick Check:

    limit: 2 returns 2 items [OK]
Quick Trick: Limit argument restricts number of results [OK]
Common Mistakes:
  • Assuming all items return ignoring limit
  • Thinking limit causes error
  • Expecting empty list when data exists

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes