GraphQL Quiz ( Beginner ) - All Questions
This easy-level GraphQL quiz is designed for beginners who want to understand GraphQL fundamentals such as queries, schemas, types, and resolvers. It’s perfect for learners starting with GraphQL or preparing for basic frontend and backend interviews.
Question 1: What is GraphQL?
- A database
- A query language for APIs
- A frontend framework
- A CSS library
Explanation: GraphQL is a query language for APIs.
Question 2: Who developed GraphQL?
- Google
- Facebook
- Microsoft
- Amazon
Explanation: GraphQL was developed by Facebook.
Question 3: What problem does GraphQL mainly solve?
- Over-fetching and under-fetching data
- UI rendering
- Database indexing
- State management
Explanation: GraphQL allows clients to request exactly the data they need.
Question 4: Which operation is used to fetch data in GraphQL?
Explanation: Queries are used to fetch data.
Question 5: Which operation is used to modify data in GraphQL?
Explanation: Mutations are used to modify data.
Question 6: What format does GraphQL typically use for responses?
Explanation: GraphQL responses are returned as JSON.
Question 7: Which component defines available data and operations in GraphQL?
- Resolver
- Schema
- Client
- Middleware
Explanation: The schema defines the API structure.
Question 8: What is a resolver in GraphQL?
- A database
- A function that returns data for a field
- A query type
- A UI component
Explanation: Resolvers fetch data for fields.
Question 9: Which GraphQL type represents a collection of fields?
Explanation: Object types contain fields.
Question 10: Which of the following is a GraphQL scalar type?
Explanation: String is a built-in scalar type.
Question 11: What symbol is used to request fields in GraphQL queries?
Explanation: Curly braces define requested fields.
Question 12: What does GraphQL allow clients to control?
- Database schema
- Server deployment
- Shape of the response
- Authentication logic
Explanation: Clients specify exactly what data they want.
Question 13: Which operation is optional in a GraphQL API?
- Query
- Mutation
- Subscription
- Schema
Explanation: Subscriptions are optional.
Question 14: What are GraphQL subscriptions used for?
- Authentication
- Real-time updates
- Batch queries
- Pagination
Explanation: Subscriptions enable real-time data updates.
Question 15: Which HTTP method is commonly used with GraphQL?
- GET only
- POST only
- POST or GET
- PUT
Explanation: GraphQL commonly uses POST, sometimes GET.
Question 16: What is introspection in GraphQL?
- API authentication
- Query optimization
- Ability to query the schema
- Caching mechanism
Explanation: Introspection allows querying schema details.
Question 17: Which tool is commonly used to test GraphQL APIs?
- Postman only
- GraphiQL
- Swagger UI
- Insomnia REST
Explanation: GraphiQL is a popular GraphQL IDE.
Question 18: What does the exclamation mark (!) indicate in GraphQL types?
- Optional field
- Deprecated field
- Non-null field
- Array field
Explanation: The ! indicates a non-nullable field.
Question 19: Which GraphQL feature reduces multiple API endpoints?
- Resolvers
- Single endpoint
- Subscriptions
- Enums
Explanation: GraphQL uses a single endpoint.
Question 20: What does a GraphQL query return?
- Only errors
- Only metadata
- Requested data
- Database schema
Explanation: Queries return requested data.
Question 21: Which keyword defines input data for mutations?
Explanation: Input types define mutation inputs.
Question 22: What is an enum in GraphQL?
- Dynamic values
- Fixed set of values
- Object type
- Query type
Explanation: Enums define a fixed set of allowed values.
Question 23: Which GraphQL type is used for arguments?
Explanation: Input types are used for arguments.
Question 24: What does GraphQL avoid compared to REST?
- Authentication
- Multiple endpoints
- HTTP requests
- JSON responses
Explanation: GraphQL typically uses a single endpoint.
Question 25: Which part of GraphQL handles data fetching logic?
- Schema
- Client
- Resolver
- Query
Explanation: Resolvers fetch data.
Question 26: What happens if a field resolver returns null for a non-null field?
- Ignored silently
- Query fails partially or fully
- Value is converted
- Server crashes
Explanation: Non-null violations propagate errors.
Question 27: Which GraphQL feature helps explore APIs without documentation?
- Resolvers
- Introspection
- Caching
- Batching
Explanation: Introspection enables self-documenting APIs.
Question 28: What does GraphQL client mainly do?
- Define schema
- Execute database queries
- Send queries and handle responses
- Deploy servers
Explanation: Clients send queries and handle results.
Question 29: Which company maintains GraphQL specification now?
- Facebook
- GraphQL Foundation
- Google
- Microsoft
Explanation: GraphQL is maintained by the GraphQL Foundation.
Question 30: Which GraphQL feature supports strongly typed APIs?
Explanation: Schema enforces strong typing.
Question 31: Which keyword defines root-level read operations?
Explanation: Query defines root read operations.
Question 32: What does GraphQL allow nested queries to do?
- Break APIs
- Fetch related data in one request
- Increase latency
- Disable caching
Explanation: Nested queries fetch related data efficiently.
Question 33: Which response field contains errors if any?
Explanation: Errors are returned in the errors field.
Question 34: What does GraphQL not enforce by default?
- Schema validation
- Authentication
- Type safety
- Query structure
Explanation: Authentication is handled externally.
Question 35: Which GraphQL feature improves frontend flexibility?
- Single endpoint
- Client-defined queries
- Resolvers
- Mutations
Explanation: Clients decide what data they need.
Question 36: What is the role of Apollo Client?
- GraphQL server
- GraphQL database
- GraphQL client library
- Schema validator
Explanation: Apollo Client is a GraphQL client library.
Question 37: Which GraphQL server library is popular in Node.js?
- Apollo Server
- Next.js
- Express Router
- Axios
Explanation: Apollo Server is widely used.
Question 38: What is the default GraphQL response structure?
- Only data
- Data and errors
- Only errors
- Metadata only
Explanation: Responses include data and errors if present.
Question 39: Which GraphQL feature enables versionless APIs?
- Deprecation
- Schema evolution
- Single endpoint
- Caching
Explanation: Schema evolution avoids versioning.
Question 40: What does @deprecated directive do?
- Removes fields
- Marks fields as outdated
- Blocks queries
- Throws errors
Explanation: It marks fields as deprecated.
Question 41: Which GraphQL operation listens for real-time data?
- Query
- Mutation
- Subscription
- Resolver
Explanation: Subscriptions handle real-time updates.
Question 42: What does GraphQL encourage instead of versioning?
- Breaking changes
- Schema evolution
- Multiple endpoints
- Client updates
Explanation: GraphQL evolves schemas without versions.
Question 43: Which GraphQL feature improves API discoverability?
- Caching
- Introspection
- Resolvers
- Pagination
Explanation: Introspection makes APIs self-documenting.
Question 44: Which type represents true or false values?
Explanation: Boolean represents true or false.
Question 45: What is the key advantage of GraphQL over REST?
- More endpoints
- Exact data fetching
- Simpler servers
- No authentication
Explanation: GraphQL allows precise data fetching.
Question 46: Which GraphQL concept defines relationships between data?
- Resolvers
- Fields
- Schema types
- Queries
Explanation: Schema types define relationships.
Question 47: What must every GraphQL API have?
- Mutation type
- Subscription type
- Query type
- Enum type
Explanation: Query type is mandatory.