Bird
0
0

If a client sends a mutation to the GraphQL single endpoint to add a user:

medium📝 query result Q5 of 15
GraphQL - Basics and Philosophy
If a client sends a mutation to the GraphQL single endpoint to add a user:
mutation { addUser(name: "Anna") { id name } }
What is the expected output?
AAn error because mutations are not allowed
BThe new user's id and name
COnly the user's name without id
DA list of all users
Step-by-Step Solution
Solution:
  1. Step 1: Understand mutation request

    The mutation requests to add a user named Anna and asks for id and name in response.
  2. Step 2: Expected server behavior

    The server processes the mutation and returns the new user's id and name as requested.
  3. Final Answer:

    The new user's id and name -> Option B
  4. Quick Check:

    Mutation returns requested fields = id and name [OK]
Quick Trick: Mutations return requested fields after changes [OK]
Common Mistakes:
  • Assuming mutations are blocked at single endpoint
  • Expecting only partial fields returned
  • Thinking mutation returns all users

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes