Challenge - 5 Problems
Schema Testing Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
What does a GraphQL schema define?
In GraphQL, what is the main purpose of a schema?
Attempts:
2 left
💡 Hint
Think about what tells GraphQL what data can be requested and how.
✗ Incorrect
A GraphQL schema defines the data types and the operations (queries and mutations) clients can perform. It acts like a contract between client and server.
❓ query_result
intermediate2:00remaining
Output of a simple GraphQL query
Given this schema snippet:
And this resolver returns "Hello!" for greeting, what is the output of this query?
type Query { greeting: String }And this resolver returns "Hello!" for greeting, what is the output of this query?
{ greeting }Attempts:
2 left
💡 Hint
GraphQL responses always wrap data inside a 'data' field.
✗ Incorrect
GraphQL responses wrap the returned data inside a 'data' object. So the greeting field appears inside 'data'.
📝 Syntax
advanced2:00remaining
Identify the syntax error in this schema
Which option contains a syntax error in this GraphQL schema definition?
GraphQL
type User { id: ID! name: String! age: Int }Attempts:
2 left
💡 Hint
Look carefully at the colon usage between field name and type.
✗ Incorrect
Option B is missing a colon ':' between 'age' and 'Int', which is required syntax in GraphQL schema definitions.
❓ optimization
advanced2:00remaining
Best practice to avoid over-fetching in GraphQL schema
Which schema design helps avoid over-fetching data in GraphQL?
Attempts:
2 left
💡 Hint
GraphQL lets clients specify exactly what fields they want.
✗ Incorrect
GraphQL's power is letting clients request only the fields they need, avoiding over-fetching. Designing schema with nested fields supports this.
🔧 Debug
expert2:00remaining
Why does this schema cause an error?
Given this schema snippet:
Why might this schema cause issues in some GraphQL servers?
type Query { user(id: ID!): User }type User { id: ID! name: String! friend: User }Why might this schema cause issues in some GraphQL servers?
Attempts:
2 left
💡 Hint
Think about recursive types and how GraphQL handles them.
✗ Incorrect
The User type references itself in the friend field without making it nullable or a list, which can cause infinite recursion or stack overflow in some servers if not handled properly.