Bird
0
0

Consider this mutation:

medium📝 query result Q5 of 15
GraphQL - Mutations
Consider this mutation:
mutation { updateProfile(id: "42", input: {email: "new@example.com"}) { id email } }

If the user with id "42" does not exist, what will happen?
AThe mutation creates a new user with id "42"
BThe mutation silently ignores the request
CThe mutation returns null or an error depending on server setup
DThe mutation updates a random user
Step-by-Step Solution
Solution:
  1. Step 1: Understand update behavior on missing records

    Update mutations usually fail or return null if the target id does not exist.
  2. Step 2: Recognize server-specific error handling

    Some servers return errors, others return null; creation does not happen automatically.
  3. Final Answer:

    The mutation returns null or an error depending on server setup -> Option C
  4. Quick Check:

    Update missing id = error or null [OK]
Quick Trick: Update fails if id not found, no auto-creation [OK]
Common Mistakes:
  • Assuming update creates new record
  • Expecting silent ignore without error
  • Thinking update affects random records

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes