[{"id":"graphqlbeginner-001","courseId":"graphql-beginner","domain":"schema-and-types","topic":"Object types and fields","prompt":"A schema defines Character with only name and appearsIn fields. Which fields can any part of a query that operates on Character select?","hint":"Think about which fields an Object type actually declares.","explain":"An Object type is a named type with a fixed set of fields. Think about where the fields of a type come from, and which of them a query on that type is allowed to name.","source":"https://graphql.org/learn/schema/#object-types-and-fields","interaction":{"type":"single"},"options":[{"id":"a","text":"Only name and appearsIn, the fields the Character type declares","why":"name and appearsIn are the only fields that can appear in any part of a query that operates on Character."},{"id":"b","text":"Any field the underlying data holds for a character, including friends","whyNot":"The schema describes what can be queried, so data behind it does not add fields to the type."},{"id":"c","text":"Any field the client names, including friends, since the client picks the selection","whyNot":"A selection must name a field the type declares; choosing a name in the query does not declare one."},{"id":"d","text":"Every field of every type in the schema, since fields are shared across Object types","whyNot":"Fields belong to the type that declares them; a query on Character is limited to Character's own fields."}],"answer":"a","explanation":"The fields an Object type declares are the only fields that can appear in a query that operates on that type.","concept":"The fields an Object type declares are the only fields that can appear in a query that operates on that type.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","code":"type Character {\n  name: String!\n  appearsIn: [Episode!]!\n}","takeaways":["If a field is missing from a type, a query on that type cannot select it."]},{"id":"graphqlbeginner-002","courseId":"graphql-beginner","domain":"schema-and-types","topic":"Built-in scalar types","prompt":"A teammate says: because a field is typed ID instead of String, GraphQL sends its value in a different serialized format.","hint":"Think about what the ID type is meant to signal, not how it is written.","explain":"GraphQL ships with built-in scalars such as Int, Float, String, Boolean and ID. Each scalar is a leaf value, and its type name tells clients what the value means.","source":"https://graphql.org/learn/schema/#scalar-types","interaction":{"type":"true-false"},"options":[{"id":"a","text":"True","whyNot":"ID is serialized the same way as a String; defining a field as ID signals an identifier, not a new format."},{"id":"b","text":"False","why":"The ID type shares the String wire format and only marks the value as an identifier not meant to be human-readable."}],"answer":"b","explanation":"ID is serialized the same way as String; the ID type signals an identifier that is not meant to be human-readable.","concept":"ID is serialized the same way as String; the ID type signals an identifier that is not meant to be human-readable.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["ID is a String on the wire; the type name marks identifiers, not a different encoding."]},{"id":"graphqlbeginner-003","courseId":"graphql-beginner","domain":"schema-and-types","topic":"Enum types","prompt":"A schema has an enum Episode with the values NEWHOPE, EMPIRE and JEDI, and a field hero(episode: Episode). A client sends episode: ROTJ. What happens?","hint":"Think about what a value of an Enum type is restricted to.","explain":"An Enum type is a scalar limited to a fixed set of named values. Think about what the schema checks for an argument of that type before the field runs.","source":"https://graphql.org/learn/schema/#enum-types","interaction":{"type":"single"},"options":[{"id":"a","text":"The request fails validation, because ROTJ is not one of the Episode values","why":"An Enum argument must be one of the values the enum lists; anything else is rejected."},{"id":"b","text":"The resolver receives the string ROTJ unchanged, because enums accept any string","whyNot":"Enum arguments are restricted to the listed values, so a string outside that set is not accepted."},{"id":"c","text":"The resolver receives null, because an unknown enum value is treated as missing","whyNot":"Enum arguments are checked against the allowed values; an unlisted value is not quietly turned into null."},{"id":"d","text":"The server maps ROTJ to its position in the list, because enums are stored as integers","whyNot":"Implementations may use integers internally, but clients work with the string names, and ROTJ is not one of them."}],"answer":"a","explanation":"An argument of an Enum type must be one of the enum's listed values; other values are rejected by validation.","concept":"An argument of an Enum type must be one of the enum's listed values; other values are rejected by validation.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","code":"enum Episode {\n  NEWHOPE\n  EMPIRE\n  JEDI\n}","takeaways":["Enum arguments accept only the names the enum lists; any other value fails."]},{"id":"graphqlbeginner-004","courseId":"graphql-beginner","domain":"schema-and-types","topic":"Reading a query against the schema","prompt":"A client sends a GraphQL query to a server. Put these steps of handling that request, from arrival to the response, in the order the server performs them.","hint":"Each step needs what the step before it produced.","explain":"A GraphQL server works on a request in stages, and each stage depends on what the previous stage produced. Think about what each stage needs in hand before it can do its job.","source":"https://graphql.org/learn/validation/","interaction":{"type":"sort","items":[{"text":"Parse the query text into a document","why":"Parsing turns the request text into a document the server can examine; nothing can be checked before that exists."},{"text":"Validate the parsed document against the schema","why":"Validation checks the document against the schema, so an unknown field is rejected before any field runs."},{"text":"Execute the validated operation, resolving each field","why":"Only a validated operation is executed; each field's resolver supplies its data."},{"text":"Deliver the response to the client","why":"The result, shaped like the query, is sent back only after execution has produced it."}]},"options":[],"answer":"o:abcd","explanation":"A request is parsed into a document, validated against the schema, executed field by field, and only then is a response delivered to the client.","concept":"A request is parsed into a document, validated against the schema, executed field by field, and only then is a response delivered to the client.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["A request is parsed and validated before it is executed, and the response comes last."]},{"id":"graphqlbeginner-005","courseId":"graphql-beginner","domain":"schema-and-types","topic":"Non-null fields","prompt":"A schema has type Character { name: String! }. The resolver for name returns null for one character. What does the client get?","hint":"The exclamation mark is a promise about what the service returns.","explain":"An exclamation mark after a type means the field must always produce a value. Consider when the service checks whether a resolver's result actually meets that promise.","source":"https://graphql.org/learn/schema/#non-null","interaction":{"type":"single"},"options":[{"id":"a","text":"A GraphQL execution error for name, because the non-null promise was broken","why":"A Non-Null field whose resolver returns null triggers an execution error, which tells the client something went wrong."},{"id":"b","text":"The query is rejected before it runs, because name is non-null","whyNot":"Non-null on an output field is checked when the value is produced, not as a request validation error."},{"id":"c","text":"name comes back as an empty string, so the value stays present","whyNot":"No substitution happens: a null result for a Non-Null field is an error, not an empty string."},{"id":"d","text":"name is left out of the response and the query still succeeds silently","whyNot":"A null for a Non-Null field triggers an error, so the client is told something went wrong."}],"answer":"a","explanation":"A Non-Null field whose resolver returns null triggers a GraphQL execution error, letting the client know something went wrong.","concept":"A Non-Null field whose resolver returns null triggers a GraphQL execution error, letting the client know something went wrong.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","code":"type Character {\n  name: String!\n}","takeaways":["A ! on an output field is a promise: a null result is reported as an error."]}]