Defining and Inserting Variables

To add more variety to questions on a test or in a testbank, you can define and include variable text or numbers in questions. Questions that include variable text or numbers are useful when you want to print multiple forms of a test or use a test in a web-based testing environment that uses the TestGen plug-in.

An Example of Variable Numbers

Using a simple example, the question

"Find the sum of 6 and 9."

is a static question that is always uses the numbers 6 and 9 and always has the answer 15. But if "6" and "9" are replaced by variables, then the question,

"Find the sum of V1 and V2."

represents more than one problem when V1, V2, and V3 (the answer) are defined as a set of linked variables. For example, to give the problem five variations, define linked variables as:

V1 = 56789

V2 = 75869

V3 = 1211151418

If V1 is 7, then V2 is 8 and V3, the answer, is 15. Each time the problem is printed, V1, V2, and V3 can have a different set of values, depending on which value is randomly selected for V1.

Using Randomized Variables

In TestGen, when you want to insert one or more variables in a test question, place the cursor where you want the first variable to be inserted and select "Variable" from the Insert menu. The Variable Definitions worksheet appears.

Decide how many variables you will need in the question and answer, and also decide how many variations you want.

Defining Variables

On the Variable Definitions worksheet, click in the Values field for V1, the first variable. Type the list of values for V1, separating the values by typing [Control] [\] to insert a bullet () symbol. Repeat the process for V2, V3, and more, depending on how many variables you need.

Linking Variables

Without linking, the value for each variable is randomly chosen from the set of values you enter on the worksheet, and you do not need to have the same number of values for each variable.

When the value of one variable is the result of a calculation involving one or more other variables, you need to link the variables. To link variable values, enter a number in the Link column for all the variables that are in the same group. When variable values are linked, the value that is randomly chosen for the first variable in the linked group determines which value is used for the other variables that are part of the same linked group.

The example above shows that variables 1 and 2 are linked, so that if "60.0" (the fifth value) is selected for the value of V1, then the value of V2 is "200" (the fifth value), the value of V3 is "12.0 (the fifth value)," and so on.  If these variables were not linked, then the values would be selected randomly from each list and would often produce incorrect answers for the problem.

You can have more than one group of linked variables for a problem; just use a different number in the Link column to identify each linked group.

Inserting Variables

In the question or answer field for a test or testbank question, place the cursor at the location where you want to insert one of your defined variables. Select Variable from the Insert menu to open the Variable Definitions worksheet, and click one of the value cells for V1 to V20. Click the Insert Selected Variable button to place a value in the question. Continue to work back and forth between the question and the worksheet to place the variables where you want them. Variable number values or variable names are highlighted with a colored background when the cursor is in the editing field for a question or answer.

Note: The inserted values for linked variables may not display the correct linked values until you have all the variables in place and you recalculate the values in the question.

Recalculating Values

To recalculate new values for the variables inserted into a question, select the question and then select "Calculate New Values" from the Question menu or use the keyboard shortcut [Ctrl] [R] for Windows or [Apple] [R] for Macintosh. You can also click the calculator icon on the Standard toolbar to recalculate new values.

Viewing Variable Names and Values

When you view questions that contain variables, you see one of the calculated values for each variable—this is the Variable Value view. There are two ways to identify where the variables are located in a question:

One method is to select "Variable Name" from the View menu to show the variable names instead of the variable values for all the variables in the entire testbank. Here is an example of variable name view and variable value view for a question:

With variable names:

v($1) told v($3) friends that v($2) was in v($4) for v($5) days.

With variable names replaced by values:

Myrna told 2 friends that she was in Florida for 7 days.

Note: When you view the names for inserted variables, the variable names include a dollar sign before the number, for example v($1) or v($2) to indicate that they are user-created string variables rather than publisher-supplied, algorithmically calculated variables, which are shown without dollar signs, for example v(1) or v(2).

To switch back to viewing variable values instead of names, select "Variable Values" from the View menu.

Another method to locate variables in a question is to click in the editing field for a question or answer. When you activate the editing field, all the variable names or values are highlighted with a colored background so you can easily see where they are.

Be careful not to delete the variable values.

Number of Variations and Variant Status

When variables are included in testbank or test question, you can display the number of variations for each questions by selecting "Preferences > Test Options" from the Tools menu and clicking the Descriptors tab. Check the box next to Number of Variations to display the number of variations below each question. The number can range anywhere from 1 to 50+ (more than 50), depending on the number of variables and the range for each variable. In addition, you can check the box next to Variant Status to display a marker (down arrowhead) next to each question that has more than one variation. Items with no variation will not have the marker.

Deleting Variables

To delete a variable, move the cursor to the right of the variable and press the [Backspace] or [Delete] key. You may also select the variable and then select "Cut" from the Edit menu. Deleting or cutting a variable from a question does not remove its definition from the Variable Definitions worksheet.

Uneditable Variables

In testbanks prepared for publishers, the variables used in algorithmic questions are uneditable. These variables are associated with mathematical calculations that use features beyond the scope of the published version of TestGen. The publisher-defined variables are displayed on the screen as "v's" with reference numbers, such as v(1) or v(2), in contrast to the user-created variables that are shown as v($1) or v($2).

Caution:  Altering or deleting algorithmically generated variables are likely to invalidate the mathematical calculations in the question or answer and the question will become incorrect and unusable.

Alternate Display of Negative Numbers

When requested by the publisher, some testbanks, such as those for accounting, will programmatically display variable negative numbers using parentheses rather than a negative sign. Both the negative sign and the parentheses are considered to be part of the algorithmically generated number and cannot be edited.