You can use the WebAssign randomization functions to select values from a table stored as a two-dimensional array. This is particularly useful in subjects like chemistry where simple substitution of independent values like a coefficient is often not possible.
- Prerequisites
- Use Perl Array Variables
- Use Randomized Numbers
- Use Matching Randomized Values from Two Lists
- Use Randomized Values from a List
Example Question Using Array and Randomization
The following table summarizes an actual question.
| QID |
|
|---|---|
| Name |
|
| Mode | Multiple-Choice |
| Question |
|
| Answer |
|
| Display to Students |
|
Randomized chemPad Example Using a Table
The following table summarizes an actual question.
|
QID |
|
|---|---|
|
Name |
|
|
Mode |
|
|
Question |
|
|
Answer |
|
|
Display to Students |
|
Example Multiple-Select Question with a Random Number of Correct Answers
The following table summarizes an actual question.
Note In this example, the second column of @dat displays as
ARRAY(0xnnnnnnnn) in the
Array tab of the Question Previewer.
This is because the answer key is stored as an array within the @dat array.
|
QID |
|
|---|---|
|
Name |
|
|
Mode |
|
|
Question |
|
|
Answer |
|
|
Display to Students |
|