C. Missing closing curly braces for 'user' and 'query'.
D. Query should not have nested fields.
Solution
Step 1: Check query syntax completeness
The query opens braces for 'user' and 'query' but does not close them.
Step 2: Confirm correct use of keywords and fields
'query' keyword is correct; 'id' and 'name' are valid fields; nested fields are allowed.
Final Answer:
Missing closing curly braces for 'user' and 'query'. -> Option C
Quick Check:
Unclosed braces cause syntax error [OK]
Hint: Count opening and closing braces carefully [OK]
Common Mistakes:
Forgetting to close all braces
Assuming keywords are wrong
Thinking nested fields are invalid
5. You want to fetch a list of users with their id and name using GraphQL. Which query correctly does this assuming the server has a 'users' field returning a list?
hard
A. query { users: id, name }
B. query { users { id name } }
C. query { user { id name } }
D. query users { id name }
Solution
Step 1: Identify the correct root field for multiple users
The server field for multiple users is 'users', not 'user'.
Step 2: Check query syntax for nested fields
query { users { id name } } correctly queries 'users' with nested 'id' and 'name' fields inside braces.
Final Answer:
query { users { id name } } -> Option B
Quick Check:
Correct root field and nested fields = query { users { id name } } [OK]
Hint: Use plural field for lists, nest fields inside braces [OK]
Common Mistakes:
Using singular 'user' for list data
Incorrect field alias syntax
Omitting braces for nested fields
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.