LearnThatStack Ace your next interview
Frontend Development

GraphQL.

Start free Change topic Change
Practice · Questions

All questions

Showing of 60
Beginner 18
01

What are the main benefits of using GraphQL?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

GraphQL lets each client fetch exactly the data it needs in one request, from a typed schema that describes the API.

  • No over-fetching. The client names the fields it wants and gets only those.
  • No under-fetching. Related data, like a user and their posts, comes in one request instead of several round trips.
  • A typed contract. The schema defines every type and field, and the server rejects queries for fields that do not exist.
  • Self-documenting. Introspection lets tools read the schema, which powers editor tooling, documentation and debugging.
  • Web and mobile clients can ask the same endpoint for different fields.
  • The API evolves without versions. New fields do not break old queries, and old fields are deprecated instead of removed.
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

02

What are the three main operation types in GraphQL?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

GraphQL has three operation types: query for reading, mutation for writing, and subscription for real-time updates. Each starts at its own root type in the schema, Query, Mutation or Subscription, whose fields are that operation's entry points.

  1. A query reads data. The server can resolve its fields in parallel.
  2. A mutation writes data. Its top-level fields run one after another, so two writes in one request never race.
  3. A subscription keeps a long-lived request open, and the server pushes new data each time an event happens.
query GetUser {
  user(id: "123") { name }
}

mutation CreateUser {
  createUser(input: { name: "John" }) {
    name
  }
}

subscription UserUpdates {
  userUpdated(id: "123") {
    name
  }
}
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

03

What is a GraphQL schema?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

A GraphQL schema is the contract between client and server. It defines every type and its fields, how the types relate, and which operations a client can run.

The server checks each request against the schema before running it, so a query for a missing field fails early. That makes the schema the single source of truth for what data can be fetched and how.

Schemas are usually written in the Schema Definition Language (SDL). Here Query lists the entry points for reading, and User.posts links each user to their posts.

type User {
  id: ID!
  name: String!
  email: String!
  posts: [Post!]!
}

type Query {
  user(id: ID!): User
  users: [User!]!
}
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

04

What are GraphQL scalars?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Scalars are the primitive data types in GraphQL, and they represent leaf values. A scalar field has no sub-fields to select, so the query stops there. Scalars also type arguments and variables.

The five built-in scalars are:

  • String: a UTF-8 character sequence.
  • Int: a 32-bit signed integer.
  • Float: a double-precision floating-point number.
  • Boolean: true or false.
  • ID: a unique identifier. It is serialized like a String and often used as a cache key.

You can also define custom scalars such as Date or Email, and the server supplies the code that serializes, parses and validates them. @specifiedBy can link one to its format specification.

scalar Date
scalar Email
scalar URL

type User {
  id: ID!
  email: Email!
  birthDate: Date
}
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

05

Explain the difference between nullable and non-nullable fields in GraphQL

Visual

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain
Visual

Every field in GraphQL is nullable by default, so it may return null. An exclamation mark after the type, as in String!, makes the field non-nullable, which promises it will never be null.

The default exists because many things can fail in a networked service. A database can go down or a permission check can fail. A nullable field lets that one field come back as null while the rest of the response still arrives.

A non-nullable field trades that safety for a stronger promise. If its resolver fails or returns null, the null propagates to the nearest nullable parent field, which becomes null instead.

Lists combine both markers. [Post!]! means neither the list nor its items can be null, while [String] allows both to be null.

type User {
  id: ID!           # Required field
  name: String!     # Required field
  email: String     # Optional field (can be null)
  age: Int          # Optional field
  posts: [Post!]!   # Required array of required Posts
  tags: [String]    # Optional array of optional strings
}
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

06

What are GraphQL object types and how do you define them?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

An object type describes one kind of entity in your domain, like a user or a post. It lists the named fields a client can ask for. Object types are the most common type in a GraphQL schema.

You define one in the Schema Definition Language (SDL) with the type keyword, a name and typed fields. A field can return a scalar like String! or another object type like User!. That is how types link: User.posts returns posts, and Post.author returns a user.

The root Query type is an object type too. Its fields are the entry points for reading data.

type User {
  id: ID!
  name: String!
  email: String!
  posts: [Post!]!
  createdAt: String!
}

type Post {
  id: ID!
  title: String!
  content: String!
  author: User!
  published: Boolean!
}
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

07

What are GraphQL enums and when would you use them?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

An enum is a type whose value must be one of a fixed list of names, such as ADMIN or GUEST. It adds type safety and validation in both directions.

For input, the server rejects an argument outside the list before any resolver runs. For output, clients know the field holds only those values. They can handle each case, and code generators can produce matching types.

Use an enum for a small set of values known ahead of time, like roles, statuses or sort orders. If the values change often or come from data, use a String or an object type instead.

enum UserRole {
  ADMIN
  MODERATOR
  USER
  GUEST
}

type User {
  id: ID!
  name: String!
  role: UserRole!
}
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

08

What are input types and how do they differ from regular types?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

An input type is an object you pass in as an argument, while a regular object type is what the server returns. You declare an input type with the input keyword instead of type.

The two cannot be mixed. An input type's fields can only be scalars, enums or other input types, and lists of those. Input fields also cannot take arguments. An object type's fields, by contrast, can return other object types and can each have a resolver.

Input types are used for arguments in mutations and queries. They group many values into one structured argument. A common pattern is one input per mutation. CreateUserInput has required fields, while UpdateUserInput has optional ones, so a client sends only the fields it changes.

input CreateUserInput {
  name: String!
  email: String!
  age: Int
}

input UpdateUserInput {
  name: String
  email: String
  age: Int
}

type Mutation {
  createUser(input: CreateUserInput!): User!
  updateUser(id: ID!, input: UpdateUserInput!): User!
}
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

09

What are arguments in GraphQL queries?

Part of Pro
10

What are aliases in GraphQL?

Part of Pro
11

What are variables in GraphQL?

Part of Pro
12

How do mutations differ from queries?

Part of Pro
13

What are resolvers in GraphQL?

Part of Pro
14

What are the four resolver arguments?

Part of Pro
15

What is Apollo Server?

Part of Pro
16

What is Apollo Client?

Part of Pro
17

What is GraphQL Playground?

Part of Pro
18

What is GraphQL, and how is it different from REST?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

GraphQL is a query language for APIs, and a runtime that executes those queries against a typed schema. The client describes the data it wants, and gets exactly that shape back.

The main differences:

  • REST exposes many URLs, one per resource. GraphQL usually exposes one endpoint.
  • A REST endpoint returns a fixed shape, so clients over-fetch unused fields or under-fetch and make extra calls. A GraphQL query gets related data in one request.
  • A GraphQL schema is typed, and tools can read it through introspection, a query that returns the schema. REST APIs describe themselves with separate documentation.
  • REST APIs often add versions such as /v2. GraphQL APIs usually add fields and deprecate old ones.

REST is easier to cache over HTTP, because each URL is a natural cache key.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

Intermediate 30
19

What are interfaces in GraphQL?

Part of Pro
20

What are union types in GraphQL?

Part of Pro
21

What are fragments in GraphQL?

Part of Pro
22

What are inline fragments?

Part of Pro
23

What are directives in GraphQL?

Part of Pro
24

What is the best practice for mutation input design?

Part of Pro
25

How do you handle errors in mutations?

Part of Pro
26

What are GraphQL subscriptions?

Part of Pro
27

How are subscriptions typically implemented?

Part of Pro
28

What is the resolver chain?

Part of Pro
29

How do you handle asynchronous operations in resolvers?

Part of Pro Visual
30

What is the N+1 query problem in GraphQL?

Part of Pro
31

How do you solve the N+1 problem with DataLoader?

Part of Pro Visual
32

What are some GraphQL caching strategies?

Part of Pro
33

How do you implement authentication in GraphQL?

Part of Pro
34

How do you implement authorization in GraphQL?

Part of Pro
35

How do you prevent introspection attacks?

Part of Pro
36

What is the difference between schema-first and code-first development?

Part of Pro
37

What are some popular GraphQL code generators?

Part of Pro
38

How do you handle file uploads in GraphQL?

Part of Pro
39

What are GraphQL middlewares and how do you use them?

Part of Pro Visual
40

How do you version a GraphQL API?

Part of Pro
41

What is the difference between GraphQL and gRPC?

Part of Pro
42

What are some GraphQL testing strategies?

Part of Pro
43

How do you implement cursor-based pagination?

Part of Pro
44

How do you handle errors and logging in a GraphQL server?

Part of Pro
45

What are the limitations of GraphQL?

Part of Pro
46

How does a normalized client cache like Apollo Client's work?

Part of Pro Visual
47

How would you handle optimistic UI after a mutation?

Part of Pro
48

How does GraphQL work over HTTP?

Part of Pro
Expert 12
49

What is query complexity analysis?

Part of Pro
50

How do you implement query timeout and rate limiting?

Part of Pro
51

What are some common GraphQL security vulnerabilities?

Part of Pro
52

What is GraphQL Federation?

Part of Pro
53

What is schema stitching?

Part of Pro
54

How do you implement real-time features with subscriptions?

Part of Pro
55

What are persisted queries and query allowlisting?

Part of Pro
56

How do you implement custom directives?

Part of Pro
57

How do you handle database transactions in GraphQL?

Part of Pro Visual
58

What is the difference between Apollo Federation and schema stitching?

Part of Pro
59

How do you migrate from REST to GraphQL?

Part of Pro
60

What is the GraphQL execution algorithm?

Part of Pro

No matches

Try a different filter or search term.

Know someone prepping for GraphQL? Send them this set.
Quick recap

GraphQL in pictures.

A quick recap of GraphQL in 36 short animated pictures, one idea at a time. About 9 min to get the whole topic back in your head before you walk in. Pause any picture, slow it down, or step through it.

Pro The first chapter is free to play. The other 32 pictures come with Pro.

Get Pro · $10/mo
Pro · $10/mo

51 of 60 GraphQL answers are in Pro.

Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.

  • Full answers + code
  • AI explanations, simpler or deeper
  • 1,000 AI credits / month
  • Cancel anytime

Change topic

Pick a different technology or stack. Your current topic stays put until you choose a new one.

Technologies
No technologies match “”.
Cross-cutting topics
No topics match “”.
By role
Stacks & frameworks

MEAN

MongoDB, Express, Angular, Node.js

MERN

MongoDB, Express, React, Node.js

LAMP

Linux, Apache, MySQL, PHP

Django

Python Full-Stack Development

Ruby on Rails

Convention over Configuration

Serverless on AWS

Serverless Architecture on AWS

Flutter Mobile

Flutter Cross-Platform Mobile Development

Spring Boot

Enterprise Java Development

.NET

Microsoft Ecosystem

Vue

Vue.js, Vite, TypeScript, Tailwind, Node.js

Go Backend

Golang, gRPC, PostgreSQL, Redis, RabbitMQ

FastAPI

Python, FastAPI, SQLAlchemy, PostgreSQL

React Native

React, TypeScript, Redux, Firebase

iOS Native

Swift, SwiftUI, UIKit, Firebase

Android Native

Java, Jetpack Compose, Firebase

DevOps / Platform

Docker, Kubernetes, Terraform, CI/CD

AI Engineer

LLMs, RAG, Agents, Evals

AI-Powered Developer

Claude Code, Copilot, Agentic Workflows

Core SWE Interview Prep

Data structures, algorithms, OS, concurrency, networking, git