为了让表单创建者能够更好地控制哪些人可以回复,我们将为回复者引入精细的控制功能。2026 年 1 月 31 日之后使用该 API 创建的表单将默认处于未发布状态。如需了解详情,请参阅
Google 表单的 API 变更。
设置测验评分选项
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
举办测验是 Google 表单的关键功能之一。本指南介绍了如何使用 Google 表单 API 创建测验并添加评分选项。
创建基本测验
制作测验的第一阶段分为两步:您先创建表单,然后更新表单的设置以将其定义为测验。如需了解基本设置说明,请参阅创建表单或测验。
添加问题
创建测验后,添加题目(如需查看题目类型列表,请参阅 Question object
)。您可以在首次添加题目时添加评分选项,也可以稍后更新这些选项。包含评分选项的新题目项的 JSON 代码示例如下:
"item": {
"title": "Which of these singers was not a member of Destiny's Child?",
"questionItem": {
"question": {
"required": True,
"grading": {
"pointValue": 2,
"correctAnswers": {
"answers": [{"value": "Rihanna"}]
},
"whenRight": {"text": "You got it!"},
"whenWrong": {"text": "Sorry, that's wrong"}
},
"choiceQuestion": {
"type": "RADIO",
"options": [
{"value": "Kelly Rowland"},
{"value": "Beyoncé"},
{"value": "Rihanna"},
{"value": "Michelle Williams"}
]
}
}
}
}
如需了解如何向表单添加题目项,请参阅更新表单或测验。
添加评分选项
为知识问答添加评分选项有助于自动完成评分流程。您可以为每个问题分配分值,并向用户提供有关其答案的反馈。
对于以下题目类型,添加 correctAnswers
字段可让系统在用户提交知识问答时自动为其评分。您可以使用 whenRight
和 whenWrong
字段为正确答案和错误答案提供具体反馈。
您还可以通过添加 correctAnswers
字段来自动评分简答题,但只能提供 generalFeedback
反馈,而不能提供 whenRight
或 whenWrong
反馈。对于其他类型的题目,系统不会自动评分,您只能提供 generalFeedback
。
注意:除了通过文件上传方式回答的问题外,系统会将用户的回答作为文本捕获和评估(如需详细了解不同类型的回答的格式,请参阅 TextAnswer
对象)。答案必须与答案键完全匹配,才能算作正确答案。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-04-09。
[null,null,["最后更新时间 (UTC):2025-04-09。"],[],["Create a quiz in Google Forms by first building a form, then converting it to a quiz via settings. Add questions, specifying the question type and whether it's required. Include grading options like `pointValue`, `correctAnswers`, and feedback (`whenRight`, `whenWrong`). Questions with `correctAnswers` (Checkbox, Radio, Dropdown, Short answer) can be auto-graded. Feedback options are available for correct and incorrect answers, except for short answers that only offer `generalFeedback`. Answers are evaluated as text for correctness.\n"],null,["# Set up quiz grading options\n\nAdministering quizzes is one of the key features of Google Forms. This guide\nshows you how to create a quiz and add grading options with the Forms API.\n\nMake a basic quiz\n-----------------\n\nThe first stage of making a quiz is a two-step process: you create a form,\nthen update the form's settings to define it as a quiz. See\n[Create a form or quiz](/workspace/forms/api/guides/create-form-quiz#convert_a_form_to_a_quiz)\nfor basic setup instructions.\n\nAdd questions\n-------------\n\nAfter you've created the quiz, add the questions (see the\n[`Question object`](/workspace/forms/api/reference/rest/v1/forms#question) for a\nlist of question types). You can include\n[grading options](#grading-options) when you first add the questions, or\nupdate them later. Sample JSON code for a new question item that includes\ngrading options looks like this: \n\n \"item\": {\n \"title\": \"Which of these singers was not a member of Destiny's Child?\",\n \"questionItem\": {\n \"question\": {\n \"required\": True,\n \"grading\": {\n \"pointValue\": 2,\n \"correctAnswers\": {\n \"answers\": [{\"value\": \"Rihanna\"}]\n },\n \"whenRight\": {\"text\": \"You got it!\"},\n \"whenWrong\": {\"text\": \"Sorry, that's wrong\"}\n },\n \"choiceQuestion\": {\n \"type\": \"RADIO\",\n \"options\": [\n {\"value\": \"Kelly Rowland\"},\n {\"value\": \"Beyoncé\"},\n {\"value\": \"Rihanna\"},\n {\"value\": \"Michelle Williams\"}\n ]\n }\n }\n }\n }\n\nSee [Update a form or quiz](/workspace/forms/api/guides/update-form-quiz#add_an_item)\nto learn how to add a question item to a form.\n\nAdd grading options\n-------------------\n\nAdding grading options to quiz questions helps automate the grading process.\nEach question can have an assigned point value and give the user feedback about\ntheir answer.\n\nFor the question types below, adding a`correctAnswers` field enables them to\nbe automatically graded when the quiz is submitted. You can provide\nspecific feedback for correct and incorrect answers using the `whenRight` and\n`whenWrong` fields.\n\n- Checkbox\n- Radio\n- Dropdown\n\nShort answer questions can also be auto-graded by adding a `correctAnswers`\nfield, but you can only provide `generalFeedback`, not `whenRight` or\n`whenWrong` feedback. For other types of questions, grading is not automatic\nand you can only provide `generalFeedback`.\n\n**Note:** Except for questions where the answer is via a file upload, the\nuser's answer is captured and evaluated as text (see the\n[`TextAnswer`](/workspace/forms/api/reference/rest/v1/forms.responses#textanswer)\nobject for specifics about how different types of answers are formatted). To\nbe correct, the answer must match the answer key exactly."]]