Skip to content
codinganthem

GraphQL skill check

Practise GraphQL: schema design, queries and mutations, resolvers and the N+1 problem, pagination, errors, auth, and performance, including short schemas and queries you read.

15

Questions

14 min

Timer can't pause

Multiple choice

One answer out of four

Choose a level

Question type

About 40% code reading

Topics

  • Schema design
  • Queries and mutations
  • Resolvers and the N+1 problem
  • Pagination
  • Errors
  • Auth
  • Subscriptions
  • Performance

Do

Use scratch paper or a notepad to work things out. Skip a question and come back to it later.

Don't

Run the code or look up answers during the check. Open the check in more than one tab or window.

Easy · Mixed · 15 questions · 14 min

By starting, you agree to the Terms and Privacy Policy.

Start practice

Practice checks each answer as you go, with an explanation. The exam is checked when you submit; 9 of 15 passes and earns a certificate.

Checking your levels…

Certificates come from the certified exam: pass with 9 of 15 while signed in. View a sample certificate.

Sample GraphQL questions with answers

These are never used in a check, so seeing their answers here won't give anything away.

  1. Question 1 · Easy · Schema design

    In GraphQL Schema Definition Language (SDL), what does an exclamation mark (!) indicate when placed after a type name, such as String!?
    1. A.The field is non-nullable and must return a value.
    2. B.The field accepts a regular expression pattern.
    3. C.The field requires administrative authentication.
    4. D.The field is marked as deprecated.
    Show answer

    A. The field is non-nullable and must return a value.

    In GraphQL SDL, an exclamation point denotes a non-nullable type. If a resolver returns null for a non-nullable field, an execution error is raised and propagated up the query tree.
  2. Question 2 · Easy · Queries and mutations

    What is the primary execution difference between top-level fields in a Query operation versus top-level fields in a Mutation operation?
    1. A.Query fields run against a read replica, whereas Mutation fields run against the primary database.
    2. B.Query fields must return objects, whereas Mutation fields must return scalars.
    3. C.Top-level Query fields execute in parallel, whereas top-level Mutation fields execute serially.
    4. D.Mutation fields cannot accept arguments, whereas Query fields can.
    Show answer

    C. Top-level Query fields execute in parallel, whereas top-level Mutation fields execute serially.

    According to the GraphQL specification, root mutation fields must be executed serially in order to prevent race conditions during side effects. Conversely, root query fields may be executed in parallel.
  3. Question 3 · Moderate · Resolvers and the N+1 problem

    In a naive GraphQL server resolving a list of 50 posts, each with an author field resolved via a database query by post.authorId, how many database queries are issued and how does DataLoader solve this?
    1. A.51 queries; DataLoader batches keys requested within a single tick of the event loop into one query.
    2. B.50 queries; DataLoader replaces individual database queries with a Redis cache layer.
    3. C.100 queries; DataLoader parallelizes the 50 queries across worker threads.
    4. D.51 queries; DataLoader generates a SQL JOIN across all resolvers at schema compile time.
    Show answer

    A. 51 queries; DataLoader batches keys requested within a single tick of the event loop into one query.

    Resolving 1 query for posts and 50 separate queries for authors produces 51 queries (the N+1 problem). DataLoader collects all keys queued in the current execution frame and passes them to a single batch function.
  4. Question 4 · Advanced · Errors

    In GraphQL error handling, what behavior occurs when a resolver throws an unhandled error while resolving a field typed as non-nullable ('!') inside an object?
    1. A.The non-nullable field becomes null in the response 'data' map without affecting its parent object.
    2. B.The error is appended to 'errors', and null bubbles upward until it encounters a nullable parent field or the root document.
    3. C.The server aborts the entire HTTP request and immediately returns a 500 status code with an empty payload.
    4. D.The field value falls back to a default value specified in the schema definition while logging a warning to 'errors'.
    Show answer

    B. The error is appended to 'errors', and null bubbles upward until it encounters a nullable parent field or the root document.

    Per the GraphQL specification's field error handling rules, if a non-nullable field errors out, it cannot be null, so the null result bubbles up to its parent field. This bubbling continues recursively until a nullable field is reached or the root 'data' object itself becomes null.

How scoring and certificates work

  • Each check has 15 multiple-choice questions with one correct answer, and one timer for the whole check. A question you leave unanswered scores nothing.
  • Practice is free without an account and shows whether each answer is right as you go, with an explanation.
  • The certified exam is scored when you submit. 60% passes, which is 9 of 15. Easy unlocks Moderate, and Moderate unlocks Advanced.
  • Passing the exam while signed in earns a free certificate, valid for one year, with its own verification page. See a sample certificate.

Free tools for GraphQL: JSON Formatter, JSON Schema Generator, cURL to Fetch