Bird
0
0

Given this GraphQL object type:

medium📝 query result Q4 of 15
GraphQL - Schema Definition Language (SDL)
Given this GraphQL object type:
type Movie {
  title: String
  year: Int
}

Which query will correctly fetch the title and year of movies?
A{ Movie { title year } }
B{ movies { title year } }
C{ movies { title, year } }
D{ movies { title; year } }
Step-by-Step Solution
Solution:
  1. Step 1: Understand GraphQL query structure

    Queries use lowercase plural names for collections, fields are listed without commas or semicolons.
  2. Step 2: Identify correct syntax

    { movies { title year } } uses correct field listing and query name. { Movie { title year } } uses type name incorrectly. The other options use invalid punctuation.
  3. Final Answer:

    { movies { title year } } -> Option B
  4. Quick Check:

    Query fields listed without commas [OK]
Quick Trick: List fields without commas or semicolons in queries [OK]
Common Mistakes:
  • Using type names instead of query names
  • Adding commas or semicolons between fields
  • Capitalizing query names incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes