Complete the code to declare a variable for a GraphQL query.
query GetUser($id: [1]) { user(id: $id) { name } }The variable $id is declared as a String type because user IDs are usually strings.
Complete the code to pass a variable in the GraphQL query arguments.
query GetPost($postId: ID!) { post(id: [1]) { title content } }$ prefix.Variables in GraphQL queries are referenced with a $ prefix, so $postId is correct.
Fix the error in the variable declaration for a required integer variable.
query GetComments($limit: [1]) { comments(limit: $limit) { text } }The exclamation mark ! means the variable is required (non-null). Since limit is an integer and required, Int! is correct.
Fill both blanks to declare and use a Boolean variable in a query.
query GetTasks($completed: [1]) { tasks(completed: [2]) { id title } }
$ inside the query.The variable $completed is declared as a required Boolean with Boolean! and used with the $ prefix inside the query.
Fill all three blanks to declare a variable, use it in the query, and specify its type as a list of IDs.
query GetUsers($ids: [1]) { users([3]: [2]) { name email } }
$ inside the query.The variable $ids is declared as a list of non-null IDs with [ID!]. Inside the query, the variable is used with $ids, and the argument name is ids.