Bird
0
0

What does an inline fragment in GraphQL allow you to do?

easy📝 Conceptual Q1 of 15
GraphQL - Queries
What does an inline fragment in GraphQL allow you to do?
ADefine a reusable fragment outside the query
BCreate a new type in the schema
CQuery fields conditionally based on the object type
DExecute mutations inside a query
Step-by-Step Solution
Solution:
  1. Step 1: Understand the purpose of inline fragments

    Inline fragments let you select fields only if the object matches a specific type.
  2. Step 2: Compare with other options

    Reusable fragments are defined separately, not inline; mutations are separate operations; creating types is schema design.
  3. Final Answer:

    Query fields conditionally based on the object type -> Option C
  4. Quick Check:

    Inline fragments = Conditional field selection [OK]
Quick Trick: Inline fragments filter fields by type inside queries [OK]
Common Mistakes:
  • Confusing inline fragments with reusable fragments
  • Thinking inline fragments create new types
  • Mixing queries and mutations inside inline fragments

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes