0
0
GraphQLquery~10 mins

Scalar types (String, Int, Float, Boolean, ID) in GraphQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a GraphQL field that returns a string.

GraphQL
type Query { greeting: [1] }
Drag options to blanks, or click blank then click option'
AInt
BBoolean
CString
DFloat
Attempts:
3 left
💡 Hint
Common Mistakes
Using Int or Float for text fields.
Confusing Boolean with String.
2fill in blank
medium

Complete the code to define a GraphQL field that returns an integer.

GraphQL
type Query { age: [1] }
Drag options to blanks, or click blank then click option'
AInt
BBoolean
CFloat
DString
Attempts:
3 left
💡 Hint
Common Mistakes
Using Float instead of Int for whole numbers.
Using String for numeric values.
3fill in blank
hard

Fix the error in the code by choosing the correct scalar type for a price field that can have decimals.

GraphQL
type Product { price: [1] }
Drag options to blanks, or click blank then click option'
ABoolean
BFloat
CInt
DID
Attempts:
3 left
💡 Hint
Common Mistakes
Using Int which only supports whole numbers.
Using Boolean or ID for numeric values.
4fill in blank
hard

Fill both blanks to define a GraphQL type with a Boolean field and an ID field.

GraphQL
type User { isActive: [1] id: [2] }
Drag options to blanks, or click blank then click option'
ABoolean
BString
CID
DInt
Attempts:
3 left
💡 Hint
Common Mistakes
Using String instead of Boolean for true/false.
Using Int instead of ID for unique identifiers.
5fill in blank
hard

Fill all three blanks to define a GraphQL type with a String name, an Int age, and a Boolean isMember field.

GraphQL
type Member { name: [1] age: [2] isMember: [3] }
Drag options to blanks, or click blank then click option'
ABoolean
BInt
CString
DFloat
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up Int and Float for age.
Using Boolean for name or age fields.