---
title: "GraphQL Fundamentals: Queries, Mutations & Schema Design"
description: "Master GraphQL foundations: queries, mutations, subscriptions, and schema design."
author: "Mohammad Abu Mattar"
canonical: https://mkabumattar.com/quizzes/post/graphql-fundamentals-quiz
---

# GraphQL Fundamentals: Queries, Mutations & Schema Design

Welcome to the GraphQL Basics Quiz! Learning GraphQL well matters for building efficient, flexible APIs that let clients request exactly what they need. This quiz will test your understanding of core GraphQL concepts like queries, mutations, schema design, and more. Each question checks a specific part of the GraphQL fundamentals. Good luck!

## Questions

### 1. What is the primary difference between GraphQL and REST?

- GraphQL lets clients request specific fields; REST returns fixed data shapes
- GraphQL requires a specific database; REST works with any data storage
- GraphQL uses XML for transport; REST relies exclusively on JSON objects
- GraphQL is a server-side language; REST is a client-side routing library

**Hint:** Think about what data you request and how you request it.

### 2. In GraphQL, what is a query?

- A read-only fetch operation used to request specific data from the server
- A write operation used to modify existing records within the database
- A persistent connection that pushes real-time updates to the client
- A configuration file that defines the relationship between API types

**Hint:** Think about how you ask for data.

### 3. What is the purpose of a GraphQL schema?

- To define the types, fields, and operations available in the API
- To manage the internal caching logic for expensive database calls
- To encrypt sensitive field data before it is sent over the network
- To automatically generate SQL queries based on client request shapes

**Hint:** Think about what defines the structure and capabilities of an API.

### 4. What is a mutation in GraphQL?

- An operation used to create, update, or delete data on the server
- A validation function that checks if a query is syntactically correct
- A way to combine multiple query results into a single JSON response
- A specialized field that handles real-time data streaming via sockets

**Hint:** Think about modifying data (create, update, delete).

### 5. What is a resolver in GraphQL?

- A function that populates the data for a specific field in the schema
- A middleware component that handles user authentication and sessions
- A tool that resolves naming conflicts between different schema versions
- A client-side library used to normalize and store query results locally

**Hint:** Think about how fields get their values.

### 6. In GraphQL, what is a scalar type?

- A primitive leaf type representing values like String, Int, or Boolean
- A complex type that groups multiple fields into a single object
- A specialized query used to fetch large datasets in paginated chunks
- A directive used to modify the behavior of a specific field or query

**Hint:** Think about primitive data types (strings, numbers, booleans).

### 7. What does "strongly typed" mean in the context of GraphQL?

- The server validates the query structure against the schema before execution
- The API requires an encrypted connection to ensure data type integrity
- The system only allows one specific database type to be used as a backend
- The API is written in a language like TypeScript or Java for performance

**Hint:** Think about type validation before execution.

### 8. What is a GraphQL fragment used for?

- To define a reusable set of fields that can be shared across queries
- To break a single large query into multiple smaller HTTP requests
- To allow the server to return partial data if a database error occurs
- To provide temporary authorization for specific sensitive fields

**Hint:** Think about reusing field selections.

### 9. What is a subscription in GraphQL?

- An operation that maintains a connection to push real-time data updates
- A recurring billing model for users to access premium API endpoints
- A way for developers to follow updates to the GraphQL documentation
- A method for caching frequently accessed data on the client device

**Hint:** Think about real-time updates when data changes.

### 10. What does the term "N+1 query problem" mean in GraphQL?

- Fetching a list of items results in one database call for every item
- A security flaw where a single query can bypass N layers of protection
- A schema design rule where every object must have at least N+1 fields
- The maximum number of concurrent connections a single server can handle

**Hint:** Think about making one query per item causing many database calls.

### 11. In GraphQL, what is an "object type"?

- A schema type that contains a collection of named fields and their types
- The raw JSON response that the server returns to the client
- A specialized input format used exclusively for mutation arguments
- A reference to a specific row within a relational database table

**Hint:** Think about complex types with multiple fields.

### 12. What is a GraphQL argument?

- A value passed to a field to customize or filter the data it returns
- A logic error in the schema that prevents the server from starting
- A specific type of resolver used to calculate mathematical results
- A comment left in the schema to explain complex logic to developers

**Hint:** Think about parameters passed to fields.

### 13. What does "introspection" mean in GraphQL?

- The ability to query the schema itself to learn about its structure
- A performance monitoring tool used to track resolver execution time
- The process of optimizing database indexes for GraphQL queries
- A security protocol that hides internal field names from the public

**Hint:** Think about querying schema information.

### 14. In GraphQL, what is a "non-null" type?

- A field that is guaranteed to return a value instead of a null result
- A data type that can only store numeric values like integers or floats
- A validation rule that prevents users from submitting empty forms
- A field that is hidden from the schema unless a valid token is provided

**Hint:** Think about fields that must always have a value.

### 15. What is a GraphQL union type?

- A type that allows a field to return one of several different object types
- A method for merging two different GraphQL APIs into a single endpoint
- A field that returns a list of items from multiple database tables
- A specific type of resolver that connects to multiple data sources

**Hint:** Think about fields that can return different types.

### 16. What syntax represents a list of items in a GraphQL schema?

- Wrapping the type name in square brackets, such as [User]
- Placing a plus sign after the field name, such as User+
- Wrapping the field name in curly braces, such as {User}
- Adding the keyword "List" before the type name, such as List User

**Hint:** Think about square brackets in type definitions.

### 17. What is an "input type" in GraphQL?

- A special type used to pass complex objects as arguments to fields
- A field that accepts raw text input from a standard HTML form
- A primitive data type like String or Int used for basic queries
- A directive that forces a field to accept only uppercase strings

**Hint:** Think about data structures for mutation arguments.

### 18. What is the difference between a root query and a root mutation?

- Queries are for fetching data; mutations are for changing data
- Queries are public; mutations require a private administrative key
- Queries run on the database; mutations run on the local cache
- Queries are limited to 10 fields; mutations have no field limit

**Hint:** Think about read vs. write operations.

### 19. What is a "directive" in GraphQL?

- A modifier starting with @ that changes how a query is executed
- A mandatory header required for every GraphQL request sent
- A specific type of error returned when a resolver fails to run
- A database command used to index fields for faster search results

**Hint:** Think about metadata or modifiers on fields (@ symbol).

### 20. What does the @deprecated directive do?

- Marks a field as no longer supported to discourage its future use
- Immediately deletes a field from the schema so it cannot be seen
- Encrypts the field data to prevent it from being intercepted
- Optimizes the field so it returns data much faster than others

**Hint:** Think about marking fields as no longer recommended.

### 21. What is the primary purpose of a "DataLoader"?

- To batch and memoize data requests to reduce database overhead
- To provide a visual progress bar for long-running API queries
- To automatically upload files from the client to a cloud storage
- To encrypt data during the transmission between server and client

**Hint:** Think about batching database queries to avoid N+1 problems.

### 22. What is a GraphQL "interface" type?

- An abstract type that defines a set of fields multiple types must implement
- A graphical user interface used by developers to test their queries
- A connection between the GraphQL server and a third-party REST API
- A configuration setting that enables multi-language support for the API

**Hint:** Think about shared fields across multiple types.

### 23. How are variables passed to a GraphQL query?

- By defining them with a $ prefix and passing values in a JSON object
- By hardcoding the values directly into the query string as text
- By storing them in the server schema as static global constants
- By appending them to the URL as standard query string parameters

**Hint:** Think about using $ syntax to define parameters.

### 24. What is "query complexity" in GraphQL?

- A calculation of the resource cost of a query to prevent server abuse
- A measurement of how many lines of code are in a specific resolver
- A rating system used to identify how difficult a query is to write
- The total number of unique types defined within the entire schema

**Hint:** Think about deeply nested queries consuming too many resources.

### 25. What is "rate limiting" in GraphQL?

- Restricting the number of requests a client can make in a timeframe
- Slowly decreasing the speed of the API as the database grows larger
- Limiting the number of fields a user can see based on their role
- Setting a maximum file size for all image uploads via mutations

**Hint:** Think about preventing abuse from excessive queries.

### 26. What is "schema stitching" in GraphQL?

- The process of merging multiple underlying APIs into one gateway
- The act of fixing broken types in a schema after a database update
- A method for compressing the schema to reduce initial load times
- The practice of manually writing schema files in a text editor

**Hint:** Think about combining multiple GraphQL schemas.

### 27. What is an "enum" type in GraphQL?

- A special scalar that restricts a field to a fixed set of values
- A dynamic list that automatically expands as more data is added
- A numeric field that only accepts values between zero and ten
- A type that combines multiple objects into a single search result

**Hint:** Think about fields with predefined allowed values.

### 28. When would you use an "alias" in a GraphQL query?

- To rename the result key of a field to avoid name collisions
- To hide the real name of a database table from the end user
- To create a temporary shortcut for a very long field name
- To assign a nickname to a user within a social media application

**Hint:** Think about querying the same field multiple times with different results.
