```{r dgp, include = FALSE}
library(exams)
library(magrittr)
library(knitr)
options(scipen = 999) #prevent scientific notation 

## RANDOM DATA 
Mu <- 100:999 %>% sample(6)

## SOLUTION
Mean <- mean(Mu) %>% round(2)
Max <- max(Mu)
Min <- min(Mu)

## QUESTION/SOLUTION/EXPLANATION GENERATION
questions <- character()
solutions <- logical()
explanations <- character()

while (!any(solutions)) {  #garantir ao menos uma resposta verdadeira

  q <- c(Mean, Max, Min, Mu) %>% sample(3)

  questions[1] <- paste0("A média dos valores é igual a ", q[1])
  solutions[1] <- q[1] == Mean
  explanations[1] <- paste0("A média dos valores é igual a ", Mean)
  
  questions[2] <- paste0("O maior valor é ", q[2])
  solutions[2] <- q[2] == Max
  explanations[2] <- paste0("O maior valor é ", Max)
  
  questions[3] <- paste0("O menor valor é ", q[3])
  solutions[3] <- q[3] == Min
  explanations[3] <- paste0("O menor valor é ", Min)
}

## SORT ORDER
o <- sample(1:3)
questions <- questions[o]
solutions <- solutions[o]
explanations <- explanations[o]
```

Question
========
Considere a sequência de números abaixo:  

`r Mu`

Assinale toda as alternativas verdadeiras:

```{r questionlist, echo = FALSE, results = "asis"}
 answerlist(questions, markup = "markdown")
```

Solution
========
```{r explanations, echo = FALSE, results = "asis"}
 answerlist(ifelse(solutions, "VERDADEIRA", "FALSA"), explanations, markup = "markdown")
```

Meta-information
================
exname: media
extype: mchoice
exsolution: `r mchoice2string(solutions)`
