【问题标题】:Using App Script to generate a quiz with random numbers使用 App Script 生成带有随机数的测验
【发布时间】:2023-03-15 01:45:01
【问题描述】:

我编写了一些创建 Google 表单的应用脚本代码。表格上的问题包含随机数,例如

function question_1 () {
     var a = getRandomInt(1,10);
     var b = getRandomInt(1,10);

     var question_string = "What is " + a + " + " + b + '?';
     var ans = a + b;
     return [question_string, ans];
 }

function create_quiz () {
     var form = FormApp.create("Quiz");

     var item = form.addMultipleChoiceItem();
     q1 = question_1()

     var question = q1[0]
     var answer = q1[1]

     item.setTitle(question)
     item.setChoices([
          item.createChoice(answer), 
          item.createChoice(answer+1),
          item.createChoice(answer-1)
     ]);
}

我想设置表单,以便正确的回答与问题一起出现,例如,添加类似

的内容
   item.setResponse(answer)

以便在学生完成测验后自动为测验评分。

谁能建议我需要进行哪些 API 调用(以及在哪里)来实现这一点?

【问题讨论】:

标签: google-apps-script google-forms google-form-quiz


【解决方案1】:

更新:2017 年 4 月 Google announced 现在可以通过编程方式创建 Google 表单测验。


目前,Google Apps 脚本中的表单服务不包含用于处理测验响应的类/方法。你可以在Forms Service上查找所有可用的类和方法

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多