Most Important GraphQL And Apollo Client MCQS

Most Important GraphQL And Apollo Client MCQS

GraphQL is a query language for API’s.It is a runtime for fulfilling those query’s with your existing data. GraphQL provides a complete description of the data in your API. It gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time, and enables powerful developer tools.

  • What are the valid graphQL operation?
    a. Query
    b. Mutation
    c. Subscription
    d. All of these
All of these

  • Working with GraphQL has following major advantages.
    a. No Overfetching
    b. Single source of truth
    c. Typed Query Language
    d. Declartive data fetching
    e. All of the operation
All of the Operation

  • Apollo provides only client side libraries support and not for the server side.
    a. True
    b. False
True

  • Apollo’s ecosystem is stable for other major languages as well.
    a. True
    b
    . False
True

  • Apollo uses below operation to fetch data from server.
    a. Query
    b. Mutation
Query

  • GrapgQL “fragments” are used to share common fields in multiple operation.
    a. True
    b. False
True

  • There is a limitation in “fragments”. We can share pieces of logic for “queries” only but cannot for “mutation”.
    a. True
    b. False
True

  • Variables in grapgQL starts with “$” sign
    a. True
    b. False
True

  • We use below sign to make fields mandatory/not null in GraphQL.
    a. $
    b. —
    c. !
    d. @
    e. None of the option
!

  • Data graph uses a “Schema” to define data and its type.
    a. True
    b. False
True

  • For every “query”. We need to write its resolver function.
    a. True
    b. False
True

  • ApolloProvider” wraps the whole React app so that we can access it from anywhere throughout the app
    a. True
    b. False
True

  • What is the correct syntax to use the “ useQuery” hook in react?
    a. Cont{ loading, error,data} =useQuery(GET_LIST)
    b. Cont { data, error, loading} =useQuery(GET_LIST)
    c. Const {error, data, loading} = useQuery(GET LIST)
    d. None of the options
Count{loading, error,data}=useQuery(GET_LIST)

  • What is the correct syntax of using the “useQuery” hook along with variable.
    (“GET _LIST” is a constant containing a gql query)
    a. Const{ loading, error, data} = useQuery(GET_LIST {variable {fruits, “Mango”}})
    b. Const{ loading, error, data} = useQuery({variables (fruit, “Mango”},)GET_LIST)
    c. Const{ loading, error, data} = useQuery(GET_LIST, {variables {fruit, “Mango”}})
    d. None of the option
Const{ loading, error, data} = useQuery(GET_LIST {variable {fruits, “Mango”}})

  • What is the correct syntax of using the “useMutation” hook in react?
    a. Const[addTodo,{data}] = useMutation(ADD_TODO);
    b. Const{addTodo, data} = useMutation(ADD_TODO);
    c. Const[addTodo, data ] = useMutation(ADD_TODO)
    d. None of the options
a. Const[addTodo,{data}] = useMutation(ADD_TODO)

  • We use “subscritions” operation to get live event updates from server
    a. True
    b. False
True

  • Apollo client supports the following error policies for an..
    a. Ignore
    b. None
    c. None of these
Ignore

  • This is not possible to update “Headers” in graphQL requests
    a. True
    b. False
False

  • It is a beauty of graphQL subscriptions that it does not uses “pub/sub” pattern
    a. True
    b. False
False

  • Apollo client store the results of its queries in the following way.
    a. In memory cache
    b. Database
    c. Local File
    d. Apollo cache
In memory Cache

  • Which of the following pattern is used GraphQL’s Subscription.
    a. Pub/sub
    b. Request/response
    c. Streaming
    d. None of the options
Pub/sub

  • Which of the following GraphQL’s hooks
    a. useQuery
    b. useLazyQuery
    c. useQueryLazy
    d. None of these
useQuery

  • Which of the following GraphQL’s hooks should be used to update data on server
    a. useQuery
    b. useMutation
    c. useSubscription
    d. none of the options
useMutation

Read More: Most Important React JS Interview Questions and Answers 2021

1 thought on “Most Important GraphQL And Apollo Client MCQS”

Leave a Comment

Your email address will not be published. Required fields are marked *