Bird
0
0

Given this GraphQL type definition:

medium📝 query result Q4 of 15
GraphQL - Schema Definition Language (SDL)
Given this GraphQL type definition:
type Product {
  id: ID!
  name: String
  price: Float!
}

Which fields are required when creating a new Product?
Aid and price
Bname and price
Cid and name
DAll fields are optional
Step-by-Step Solution
Solution:
  1. Step 1: Identify required fields by exclamation marks

    Fields with ! are required: id: ID! and price: Float!.
  2. Step 2: Check optional fields

    name: String has no !, so it is optional.
  3. Final Answer:

    id and price -> Option A
  4. Quick Check:

    Required fields have ! = id and price = B [OK]
Quick Trick: Only fields with ! are required, others optional [OK]
Common Mistakes:
  • Assuming all fields are required
  • Confusing optional fields as required
  • Ignoring exclamation marks

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes