Problemset Quizzes

Example of different quiz formats in a shiny based RTutor problemset

Adapt the working directory below and run the setup chunk in RStudio. This creates the problem set files and the sample solution from this solution file.

< ignore

library(RTutor)
setwd("D:/libraries/RTutor/RTutor/inst/examples")
ps.name = "QuizExample"; sol.file = paste0(ps.name,"_sol.Rmd")
# Important to add the parameter addons="quiz" !
create.ps(sol.file=sol.file, ps.name=ps.name,libs=libs, addons="quiz")
show.ps(ps.name)
stop()

>

Exercise 1 -- Quiz

A single choice quiz

< quiz "single"

question: What is 2020? sc: - 100 - 200 - 400 - 500 success: Great, your answer is correct! failure: Try again.

>

A multiple choice quiz

< quiz "multi"

question: Check all prime numbers mc: - 2 - 3 - 4 - 5 - 6 - 7 - 8 success: Great, all answers are correct! failure: Not all answers correct. Try again.

>

An open question

< quiz "music"

question: Johann ???? Bach answer: Sebastian

>

An open question with a numeric answer

< quiz "pi"

question: 2. State pi up to 2 digits answer: 3.14 roundto: 0.01

>

A quiz consisting of several questions (and a single check button)

< quiz "parts"

parts: - question: 1. What is 2020? choices: - 100 - 200 - 400 - 500 multiple: FALSE success: Great, your answer is correct! failure: Try again. - question: 2. State pi up to 2 digits answer: 3.14 roundto: 0.01

>

< award "Quiz master"

You solved the quiz!

>

Note that every problem set must have at least at one chunk in order to compile without error. Yeah... I was simply to lazy to implement all extra handling for problem sets without chunks, since the whole idea of RTutor is to have chunks.

Therefore one chunk at the end...

#< task_notest
(0.3-0.2-0.1)==0
#>

So better don't build rockets with R...



skranz/RTutor documentation built on Feb. 7, 2024, 12:53 a.m.