0
0
GraphQLquery~20 mins

Schema linting in GraphQL - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Schema Linting Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What is the main purpose of schema linting in GraphQL?

Schema linting helps developers by:

  • A. Checking the schema for errors and style issues before deployment
  • B. Automatically generating queries from the schema
  • C. Running queries faster by optimizing the schema
  • D. Encrypting the schema for security
AChecking the schema for errors and style issues before deployment
BAutomatically generating queries from the schema
CRunning queries faster by optimizing the schema
DEncrypting the schema for security
Attempts:
2 left
💡 Hint

Think about what 'linting' usually means in programming.

query_result
intermediate
2:00remaining
What error will this GraphQL schema linting tool report?

Given this schema snippet:

type User { id: ID! name: String! age: Int }

The linting tool requires all fields to have descriptions. What is the linting error?

AMissing description for field 'age'
BMissing description for field 'name'
CMissing description for field 'id'
DNo errors found
Attempts:
2 left
💡 Hint

Check which fields lack descriptions.

📝 Syntax
advanced
2:00remaining
Which schema snippet will cause a linting syntax error?

Identify the schema snippet that will fail linting due to syntax issues:

Atype Query { user(id: ID!): User type User { id: ID! name: String! }
Btype Query { user(id: ID!): User } type User { id: ID! name: String! }
Ctype Query { user(id: ID!): User } type User { id: ID! name: String! age: Int }
Dtype Query { user(id: ID!): User } type User { id: ID! name: String! } enum Role { ADMIN USER }
Attempts:
2 left
💡 Hint

Look for missing braces or keywords.

optimization
advanced
2:00remaining
How can schema linting improve GraphQL API performance?

Choose the best explanation for how schema linting can indirectly improve API performance:

ABy automatically caching all queries defined in the schema
BBy encrypting schema fields to speed up data retrieval
CBy compressing the schema file size to reduce network load
DBy detecting inefficient schema designs that cause slow queries
Attempts:
2 left
💡 Hint

Think about how errors or bad designs affect query speed.

🔧 Debug
expert
3:00remaining
Why does this schema linting tool report a duplicate type error?

Given these schema definitions:

type Product { id: ID! name: String! } type Product { sku: String! price: Float! }

What is the cause of the linting error?

AThe 'Product' type is missing a description
BThe 'Product' type is defined twice with different fields
CThe 'Product' type fields have conflicting types
DThe schema is missing a Query type
Attempts:
2 left
💡 Hint

Check if type names are unique in the schema.