GraphQL Interview Questions and Answers
Related differences
Ques 11. Explain the concept of fragments in GraphQL.
Fragments in GraphQL allow you to define reusable sets of fields that can be included in multiple queries. They help in avoiding duplication of field definitions and make queries more modular.
Ques 12. What is introspection in GraphQL?
Introspection is a feature in GraphQL that allows clients to query the schema itself. It enables clients to dynamically discover the types, fields, and directives available in the GraphQL API.
Ques 13. Differentiate between a query and a mutation in GraphQL.
A query is used to fetch data from the server, while a mutation is used to modify data on the server. Queries are read-only operations, and mutations are used for any operation that causes a change in the data.
Ques 14. What is a scalar type in GraphQL?
A scalar type in GraphQL represents a single value, such as a string, integer, boolean, or float. GraphQL provides a set of predefined scalar types, and custom scalar types can be defined as needed.
Ques 15. Explain the concept of a subscription in GraphQL.
A subscription in GraphQL allows clients to receive real-time updates from the server. It is used for scenarios where the server can push data to the client when certain events occur, providing a mechanism for real-time communication.
Most helpful rated by users: