GraphQL - QueriesWhy does GraphQL require inline fragments when querying union or interface types?ABecause fields differ by type and must be selected conditionallyBBecause GraphQL does not support unions without fragmentsCBecause inline fragments improve query performanceDBecause inline fragments define new types in the schemaCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand union/interface behaviorUnions and interfaces can represent multiple types with different fields.Step 2: Explain need for inline fragmentsInline fragments let you select fields only for the actual type returned, avoiding errors.Final Answer:Because fields differ by type and must be selected conditionally -> Option AQuick Check:Inline fragments = conditional field selection by type [OK]Quick Trick: Inline fragments handle type-specific fields in unions/interfaces [OK]Common Mistakes:Thinking inline fragments create typesAssuming inline fragments improve performanceBelieving unions can't be queried without fragments
Master "Queries" in GraphQL9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More GraphQL Quizzes GraphQL Basics and Philosophy - GraphQL Playground and tools - Quiz 3easy Mutations - Update mutation pattern - Quiz 13medium Queries - Aliases for field renaming - Quiz 8hard Queries - Nested field queries - Quiz 10hard Resolvers - Context argument - Quiz 9hard Schema Definition Language (SDL) - Input types - Quiz 1easy Type Relationships - One-to-many relationships - Quiz 14medium Type Relationships - Relationship design patterns - Quiz 1easy Type Relationships - One-to-one relationships - Quiz 10hard Type Relationships - Nested resolver execution - Quiz 14medium