You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

exams2canvas生成的schoice含a.1类前缀是否为Bug?

问题与解答

问题背景

我制作了最小示例文件q2.Rmd,代码如下:

```{r data generation, echo = FALSE, results = "hide"}
mu = runif(1,200,800)
sig = runif(1,10,70)
n = sample(8:12,1)
x = round(rnorm(n,mu,sig),1)
correct_val_1 = round(mean(x),1)
correct_val_2 = round(sd(x),1)
num_under_1 = sample(0:3,1)
num_under_2 = sample(0:3,1)
mults_1 = c(0,sample(-1:-5,num_under_1),sample(1:5,3-num_under_1))
mults_2 = c(0,sample(-1:-5,num_under_2),sample(1:5,3-num_under_2))
choices_1 = sort(correct_val_1+0.2*mults_1)
choices_2 = sort(correct_val_2+0.2*mults_2)
ans1 = paste0((choices_1==correct_val_1)*1,collapse="")
ans2 = paste0((choices_2==correct_val_2)*1,collapse="")
Question

A biologist investigated a population of turtles. They weighed turtles from a simple-random sample; those weights are shown below in grams.

opts <- options(knitr.kable.NA = "")
mydf = data.frame(x)
colnames(mydf) = c("Turtle weights (g)")
knitr::kable(mydf,format="html", align = "c",row.names=F,table.attr='class="bordered-table"')

\

Find the sample mean, $\bar{x}$, and the sample standard deviation, $s$ (using Bessel's correction).

$\bar{x} =$ ##ANSWER1##

$s =$ ##ANSWER2##

Answerlist

  • r choices_1[1]
  • r choices_1[2]
  • r choices_1[3]
  • r choices_1[4]
  • r choices_2[1]
  • r choices_2[2]
  • r choices_2[3]
  • r choices_2[4]
Solution

The correct answers were $\bar{x} = r correct_val_1$ and $s = r correct_val_2$

r sd(x)

Meta-information

extype: cloze
exclozetype: schoice|schoice
exsolution: r ans1|r ans2
exname: find sample mean and sample standard deviation
exshuffle: FALSE

运行`exams2canvas("q2.Rmd")`生成ZIP文件,通过Canvas的“Import Existing Content”默认设置(旧版测验)导入后,预览时发现schoice选项的下拉框带有`a.1`、`a.2`类前缀。即使关闭选项洗牌设置,前缀变为有序的`a.1.`、`a.2.`等,但该前缀的存在使选项洗牌功能失去意义。未修改源码,也未发现`exams2canvas`相关设置问题,请问该前缀存在是否合理?是否属于Bug?

## 解答
这个前缀**不属于Bug**,是`exams2canvas`工具为兼容Canvas旧版测验导入规范的设计,但确实会干扰选项洗牌功能的实际作用。

### 原因
Canvas旧版测验的导入格式要求,cloze题型下的多个子题选项需要唯一标识,`exams2canvas`通过添加`a.1`、`a.2`这类前缀来避免不同子题的选项ID冲突。但当开启选项洗牌时,前缀的有序性会暴露选项原本的排列顺序,导致洗牌失去随机化的意义。

### 可行处理方式
- 手动修改生成的ZIP包内的XML文件,移除选项的前缀标识;
- 向`exams`包提交功能需求,请求添加控制选项前缀显示的开关参数;
- 如果不需要严格区分子题选项,也可以尝试调整cloze题型的配置(比如改用其他题型组合,但可能不符合需求)。

内容的提问来源于stack exchange,提问作者Chad Worley
相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.11 04:43:18