[{"id":"graphqlintermediate-001","courseId":"graphql-intermediate","domain":"schema-and-types","topic":"Non-Null fields","prompt":"A teammate's schema declares `name: String!` on a Person type. What does the `!` promise to clients?","hint":"Think about what the server must do when a resolver has no value to give.","explain":"Every field in a schema has a type, and a trailing marker on that type changes what counts as a valid answer. Consider what a resolver should do when the marker says a value is required.","source":"https://graphql.org/learn/schema/","interaction":{"type":"single"},"options":[{"id":"a","text":"name always has a value; if the resolver returns null, the server raises an execution error.","why":"The ! marks the field as Non-Null, so a null from the resolver is an error rather than a valid answer."},{"id":"b","text":"If the resolver returns null, the server replaces it with an empty string.","whyNot":"GraphQL doesn't invent default values; a null in a Non-Null field is an error."},{"id":"c","text":"name is stored as a string that must be at least one character long.","whyNot":"The ! concerns null, not length: String! still allows an empty string."},{"id":"d","text":"Every query must write the ! after name, or the server rejects it.","whyNot":"The ! is written in the schema, not in queries; clients select fields without it."}],"answer":"a","explanation":"A Non-Null field promises a value; if its resolver produces null, GraphQL raises an execution error instead.","concept":"A Non-Null field promises a value; if its resolver produces null, GraphQL raises an execution error instead.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","code":"type Person {\n  name: String!\n}","takeaways":["A ! in the schema is a promise the resolver must keep, not something clients write in queries."]},{"id":"graphqlintermediate-002","courseId":"graphql-intermediate","domain":"schema-and-types","topic":"Enum types","prompt":"A schema defines `enum Episode { NEWHOPE EMPIRE JEDI }`. Which TWO statements about the Episode type are true?","hint":"Think about what kind of type an enum is and what values it can hold.","explain":"A type can be limited to a fixed list of names instead of accepting any value of its base kind. That limit applies everywhere the type is used, in responses and in arguments.","source":"https://graphql.org/learn/schema/","interaction":{"type":"multiple","tellCount":true},"options":[{"id":"a","text":"Episode is a special kind of scalar that accepts only its listed names.","why":"An enum is a special kind of scalar restricted to a set of allowed values."},{"id":"b","text":"Wherever Episode is used, its value must be exactly NEWHOPE, EMPIRE, or JEDI.","why":"Each use of the enum type resolves to exactly one of its declared values."},{"id":"c","text":"Clients can send any string for Episode, and the server treats unlisted ones as a new value.","whyNot":"The type is restricted to its listed values; other strings are not valid Episode values."},{"id":"d","text":"Episode can declare its own fields, the same way an object type does.","whyNot":"Enum values are plain names with no fields; a type with fields is an object type."},{"id":"e","text":"Episode can only be used as an output type, never as an argument type.","whyNot":"Enums can also be argument types, the same way scalars are used as input types."},{"id":"f","text":"Each enum value must be given a description string in the schema.","whyNot":"Descriptions are optional; an enum needs only its value names."}],"answer":"ab","explanation":"An enum is a scalar-like type limited to a fixed set of names, and every value of that type must be one of those names.","concept":"An enum is a scalar-like type limited to a fixed set of names, and every value of that type must be one of those names.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","code":"enum Episode {\n  NEWHOPE\n  EMPIRE\n  JEDI\n}","takeaways":["An enum limits both the values a field returns and the values an argument accepts."]},{"id":"graphqlintermediate-003","courseId":"graphql-intermediate","domain":"schema-and-types","topic":"Non-Null lists","prompt":"A field typed `[Int!]!` can never return an empty list.","hint":"Check what the two ! markers guarantee, and what they leave open.","explain":"Each ! in a list type sets a rule, one for the list and one for its items. Those rules govern which values can be null, so think about whether an empty array has any items that could be null.","source":"https://graphql.org/learn/schema/","interaction":{"type":"true-false"},"options":[{"id":"a","text":"True","whyNot":"The Non-Null markers on both levels force at least one item to exist."},{"id":"b","text":"False","why":"[] is valid: a Non-Null list must be an array, but that array may hold zero items."}],"answer":"b","explanation":"Non-null markers on a list only rule out null values; a Non-Null list may still be empty.","concept":"Non-null markers on a list only rule out null values; a Non-Null list may still be empty.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["[Type!]! guarantees an array with non-null items, not a non-empty array."]},{"id":"graphqlintermediate-004","courseId":"graphql-intermediate","domain":"schema-and-types","topic":"List nullability","prompt":"A field is declared as `tags: [String!]`. Which part of its value is allowed to be null?","hint":"Compare where the ! sits relative to the brackets.","explain":"In a list type, a marker inside the brackets applies to each item, and a marker after the brackets applies to the list. Find where the marker sits to see which level it protects.","source":"https://graphql.org/learn/schema/","interaction":{"type":"single"},"options":[{"id":"a","text":"The list itself may be null, but no item in it may be null.","why":"[String!] allows a null list, while its String! items can never be null."},{"id":"b","text":"The items may be null, but the list itself cannot be null.","whyNot":"That describes [String]!; here the ! sits inside the brackets, not after them."},{"id":"c","text":"Neither the list nor its items may be null.","whyNot":"That would need a trailing ! as well, written [String!]!."},{"id":"d","text":"Both the list and its items may be null.","whyNot":"Null items would need [String]; the inner ! rules that out here."}],"answer":"a","explanation":"In a list type, a ! inside the brackets makes items Non-Null, and a ! after the brackets makes the list Non-Null.","concept":"In a list type, a ! inside the brackets makes items Non-Null, and a ! after the brackets makes the list Non-Null.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","code":"type Post {\n  tags: [String!]\n}","takeaways":["Read a list type from the inside out: the marker inside the brackets guards items, the one outside guards the list."]},{"id":"graphqlintermediate-005","courseId":"graphql-intermediate","domain":"schema-and-types","topic":"Interface implementation","prompt":"A schema has `interface Character { name: String! }`. Which object type correctly implements that interface?","hint":"Check which fields an implementing type must include, and how it declares the interface.","explain":"An interface lists fields that other object types promise to provide. An object type that takes on an interface has to match its field names, arguments and return types, and it can add more fields of its own.","source":"https://graphql.org/learn/schema/","interaction":{"type":"single"},"options":[{"id":"a","text":"type Human implements Character { id: ID! name: String! }","why":"It declares the interface and includes name with the same type, so it meets the interface's requirements."},{"id":"b","text":"type Human implements Character { id: ID! }","whyNot":"It omits name; an implementing type must include every field the interface defines."},{"id":"c","text":"type Human implements Character { id: ID! fullName: String! }","whyNot":"fullName has a different name, so the interface's name field is still missing."},{"id":"d","text":"type Human { id: ID! name: String! }","whyNot":"It never declares that it implements Character, so it isn't an implementation even though the field matches."}],"answer":"a","explanation":"An object type implements an interface by declaring it and including every interface field with the same name, arguments and return type.","concept":"An object type implements an interface by declaring it and including every interface field with the same name, arguments and return type.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","code":"interface Character {\n  name: String!\n}","takeaways":["An implementing object may add its own fields, but it must include every field the interface defines."]}]