GraphQL Interview Question-Answer Part – 1
Q.1 The following are default scalar types in GraphQL, except _____________.
A. Char
B. Boolean
C. Float
D. Int
Ans : Char
Q.2 ___________ is the popular response format that is usually used for mobile and web applications.
A. JSON
B. XML
C. XLS
D. CSV
Ans : JSON
Q.3 What are GraphQL subscriptions used for?
A. Event-based real-time functionality
B. Schema-based real-time functionality
C. To combine Queries and Mutations and to allow you to read and write data
D. To subscribe to the GraphQL weekly newsletter
Ans : Event-based real-time functionality
Q.4 A resolver function is ______________.
A. A function that a GraphQL client uses to resolve a query on the frontend
B. A function that solves all your problems
C. A synonym for serverless functions
D. A function on a GraphQL server that is responsible for fetching the data for a single field
Ans : A function on a GraphQL server that is responsible for fetching the data for a single field
Q.5 What is the significant benefit of using a GraphQL client library?
A. It saves you from writing infrastructure code for networking and caching
B. GraphQL clients do not provide actual advantages but it is always good to use third party libraries
C. It makes it easier to use animations inside your app
D. A GraphQL client is mainly used to improve security
Ans : It saves you from writing infrastructure code for networking and caching
Q.6 Which of the following functions in GraphQL-tools helps you to bind schema and resolver?
A. inheritResolversFromInterfaces
B. allowIndefinedInResolve
C. resolverValidationOptions
D. makeExecutableSchema
Ans : makeExecutableSchema
Q.7 GraphQL is not tied to any specific database.
A. True
B. False
Ans : True
Q.8 GraphQL queries allows to pass multiple arguments.
A. True
B. False
Ans : True
Q.9 _____________ is a collection of functions that generate response for a GraphQL query.
A. Subscriptions
B. Mutations
C. Resolver
D. Directives
Ans : Resolver
Q.10 Which of the following mutations is present in GraphQL?
A. Deleting data
B. Creating data
C. Updating data
D. All the options
Ans : All the options
Q.11 ____________ makes the queries more dynamic and flexible.
A. Fragments
B. Aliases
C. Variable names
D. Operation names
Ans : Variable names
Q.12 Which transport does Apollo use to implement subscriptions?
A. WebSockets
B. TCP
C. UDP
D. HTTP 2
Ans : WebSockets
Q.13 SDL stands for _____________.
A. System Derived Language
B. System Definition Language
C. Schema Derived Language
D. Schema Definition Language
Ans : Schema Definition Language
Q.14 The loading of data with React and Apollo can be declared ______________.
A. Using XMLHTTPRequest and placing the query in the body of the request
B. Using ‘fetch’ and placing the query in the body of the request
C. Using a higher-order component called ‘graphql’
D. Using the ‘<Query />’ component and passing GraphQL query as prop
Ans : Using the ‘<Query />’ component and passing GraphQL query as prop
Q.15 What is the benefit of the GraphQL schema and strong type system?
A. GraphQL does not have a type system
B. It solves the n+1 request problem
C. They work well with the JavaScript type system
D. Once the schema is defined, frontend and backend teams can work independently of each other
Ans : Once the schema is defined, frontend and backend teams can work independently of each other
Q.16 The following statements are true, except ___________.
A. GraphQL has a built-in date type
B. Aliases can be used to name the result objects for multiple queries
C. Fragments are useful for the structure and reusability of your GraphQL code
D. Every field in a GraphQL type can be associated with zero or more arguments
Ans : GraphQL has a built-in date type
Q.17 _________ is a response where the client doesn’t get enough data.
A. Under-fetching
B. Over-fetching
C. In-fetching
D. Out-fetching
Ans : Under-fetching
Q.18 GraphQL is a query language for API.
A. True
B. False
Ans : True
Q.19 Over-fetching unnecessarily increases the payload size.
A. True
B. False
Ans : True
Q.20 The development speed in GraphQL is faster than REST.
A. True
B. False
Ans : True
Q.21 Which languages that can be used to implement GraphQL server.
A. Python
B. java
C. Go
D. All the options
Ans : All the options
Q.22 _________ fetching extra data for an API request.
A. Under-fetching
B. Over-fetching
C. In-fetching
D. Out-fetching
Ans : Over-fetching
Q.23 Overfetching increases payload size.
A. True
B. False
Ans : True
Q.24 GraphQL is a query language, but REST is not.
A. True
B. False
Ans : True
Q.25 What is mutation ?
A. Mutation is used for the write operation.
B. A mutation is used for operations like add, delete and edit data.
C. Both
D. None
Ans : Both
Q.26 Does GraphQL support server-side caching?
A. Yes
B. No
Ans : No
Q.27 GraphQL can be used only with SQL.
A. True
B. False
Ans : False