# Test and Quiz

See also: Quiz Welcome to the test and quiz department, for all Wikiversity's test and quiz needs. The page will eventually teach you how to write quizzes and tests for wikiversity and when and where to use them.

## Current functionality

Wikiversity is still producing Test and Quiz functionality. Currently available is what are known as a Self-Quizzes, Flashcards, and Handout tests.

### Quiz

The wikiversity's Quiz extension allows you to create a quiz with a simplified syntax.

### Self-Quizzes

Self Quizzes are quizzes that can be placed on a lesson page or a separate page. They are not graded in the sense that users may answer as many times as they like and no question affects any other question. The answers are hidden from view until the "expand" button above the answer is clicked.

#### When to use

Self Quizzes can be used as examples in lesson plans, such as in Ohm's Law, or as stand alone quizzes to test knowledge of a chapter of a book, such as College Algebra/GrammarQuiz. When writing a question, make sure that the answer is not obvious. The best questions are the ones that make the test-taker think about what they have learnt. You should consider the difficulty of a question before adding it to a quiz. If a question is too easy, you should examine whether or not it is really necessary, or consider posing a more difficult question.

#### Usage

Copy and paste the template into the page where the quiz should be made available. Don't forget to delete the spaces before the pipes. There will be multiple types of quizes: two answer, three answer, four answer, or five answer. Presently only the type with four answers works, pending research into a multi-answer system.
    {{ABCD
    | Question = Question goes here
    | Atext = A text goes here
    | Aanswer = Answer for A goes here
    | Btext = B text goes here
    | Banswer = Answer for B goes here
    | Ctext = C text goes here
    | Canswer = Answer for C goes here
    | Dtext = D text goes here
    | Danswer = Answer for D goes here
This template will give you:
* Question goes here
| A text goes here Answer for A goes here | B text goes here Answer for B goes here | C text goes here Answer for C goes here | D text goes here Answer for D goes here |
Note that choices are automatically bold, but the answers are not. The number of questions can be increased to 5 by using the template ABCDE, and the answers can be randomly placed by using the template ABCDR. Both work the same as ABCD.
===Math questions===d Math questions have special functionality. Functions can be evaluated by using {{ #expr: }}. {{ #expr: 1+1}} produces: 2. Random numbers can be produced by using the current second {{#time:s}} (which is currently 39). This produces a random number from 0 to 59. However, the random number will stay the same until the page is purged from the user's computer memory. Also, only one random number can be generated that way. {{#time:m}} (09) can be used, but it doesn't change as quickly.

### Picture Questions

For the more visual oriented, a picture may be included in a self quiz, such as the template used in the Biology department.
    {{Whatplantquiz
    | First image = Wikiversity-logo-Snorky.svg
    | Binomial = Wikiversutus
    | Common name = Wikiversity
    | Wikipedia = Wikiversity
    | Wikibooks = Wikiversity
    | Commons = Wikiversity
That produces:
What plant is this? :
* Scientific Name
* Wikiversutus
* Common (English) Name
* Wikiversity
* Links
* Wikipedia article
* Wikibooks chapter
* More images on Commons

### Flashcards

When studying a large amount of simple concepts or questions, users and editors might not want all the information to appear at the same time. In the future, large databases of facts and concepts will be stored on Wikiversity. In order to test a sampling of knowledge, a system known as "Flashcards" has been created.

#### Usage

The flashcard system has many levels. Inorder to make a card around the flash card, the entire system can had a div header like:
<div class="multilingual" style="background-color:#f7f8ff; text-align:justify; padding:5px; border:1px solid #8888aa; border-right-width:2px; border-bottom-width:2px; margin-bottom:2em" >
Remember to close the box at the end with a </div> tag. The rest of the system is a very large switch statement, written as
:{{#switch:{{#expr:({{#time:U}} mod 3) + 1}}
    |1=
    This is the visible part of the first flashcard
    <div style="clear:both" class="NavFrame">
    <div class="NavHead" align="{{{alignT|center}}}">''Solution''</div>
    <div class="NavContent" style="display:none; text-align:left">
    This is the hidden part of the first flashcard
    </div>
    <div class="NavEnd"> </div>
    </div>
    |2=
    This is the visible part of the second flashcard
    <div style="clear:both" class="NavFrame">
    <div class="NavHead" align="{{{alignT|center}}}">''Solution''</div>
    <div class="NavContent" style="display:none; text-align:left">
    This is the hidden part of the second flashcard
    </div>
    <div class="NavEnd"> </div>
    </div>
    |3=
    This is the visible part of the third flashcard
    <div style="clear:both" class="NavFrame">
    <div class="NavHead" align="{{{alignT|center}}}">''Solution''</div>
    <div class="NavContent" style="display:none; text-align:left">
    This is the hidden part of the third flashcard
    </div>
    <div class="NavEnd"> </div>
    </div>
This code produced:
This is the visible part of the first flashcard
This is the hidden part of the first flashcard
To produce the random number, the expression {{#expr:({{#time:U}} mod 3) + 1}} is used. For other than three cards, change the number 3 to the number of cards needed.

#### The Calculation

The expression {{#expr:({{#time:U}} mod 3) + 1}} is based on the Parser Functions. {{#expr}} performs the calculation. {{#time:U}} returns the number of seconds since January 1, 1970. mod is the modulo operator, which performs integer division and returns the remainder.
The effect is that this expression takes a big number that changes every second, divides by the number of cards in the flashcard switch statement, and gets the remainder. It then adds 1 so that the result is one-based rather than zero-based.
For example, if the number of cards is 3, the remainder from the calculation will be 0, 1, or 2, no matter how many seconds have elapsed since 1970. Adding 1 returns a value of 1, 2, or 3. This value is then passed to the switch statement to selec

#### Purge/Get new card

Since mediawiki heavily caches pages to lighten load (stores a copy of the page without reloading it), to get a new card, the stored copy must first be purged. This also is needed on random math questions. A link such as: Get new card is needed.

#### Another Approach

Flashcards may also be produced using the {{Collapsible toggle}} template. This template is more flexible in that it is a bare <div> that can be styled to meet the needs of the page design rather than the limitations of the NavFrame class. For example:
Click on the card text to see the answer.
* Flashcard Example
* This is the visible part of the first flashcard. This is the hidden part of the first flashcard.
* Next Card

### Handout tests

For the purpose of having a graded test, tests can be created via a template, and the answers can be added in later by the test maker. The "students" can take the tests by editing the template, and the grades can be collected by looking at the history of the page that the template was placed on at the time the answers were edited in by the "teacher". Note that there still is no way that looking at other people's tests can be prevented at this time. This encourages collaberative test taking. "Teachers" should be reminded that these tests are not to facilitate a pass/fail type mentality. These types of tests are meant to allow for critical thought as opposed to randomly clicking through the answers as is possible with the self quizes.
To create a template test, enter Template:Nameoftest in the search function, and create the test in the new page. Test makers can start off with the sample code found on the sameple test: [[Template:Sampletest]] Note the active part of the code is contained in the include only tags. This code can be substitutide into the students talk page, or a subpage thereof as
    {{Sampletest
    | Q1=D
    | Q2=B
Which will produce
Instructions: Edit the Q1= and Q2= to your choice
* Question goes here
| A text goes here | B text goes here | C text goes here | D text goes here |
    This will be D's answer
* Question goes here
| A text goes here | B text goes here | C text goes here | D text goes here |
    You chose B for question 2, ?. To change your answer, click the edit tab and edit Q2=
Question 3: this is an essay question. Create a subheader named ==Question three== and answer it by editing below.
    You have 70 more days to finish this test, which was started on 11/2
Note that in practice the template can be substituted without the answers, with a ? instead of B and D. The instructions can be altered by editing the line beginging with instructions, and the questions can be edited just like with the self quiz.

### Timer

The timer can be set and reset for the test, to let test takers know when the answers will be edited into the test. The current code shows {{#expr:31-((({{CURRENTMONTH}}-11)*31)+({{CURRENTDAY}}-2))}} which corrisponds to a month long test starting on 11/2. To reset the timer to another start day, change the month from 11 to the current month and the day from 2 to the current day. Simmilar schemes can be done for day long or year long tests. Note the current formulation of the timer does not function properly when the new year is within the month of the test. To shorten the test length, edit the first 31 to the number of days that the test should go.

#### Answers

When the time has run out, edit the subpages of the your test, and they will be automatically included in the test takers pages. Note that once the test is over, the template can be reused, though the history of the previous test will be stored, so do not use the exact questions.

## Things to do

* Look into multi-question templates
* Look into adding buttons like the multilingual on on beta
* Look into finding or making a standard random number generator
* Bug meta devs into making a gradable version
* Use random number generator to make a flashcard system for mirwin's java cards.
* Make a random test generator

## The testing grounds

For testing new ideas -->Test and Quiz sandbox

## Participants

* Rayc 19:51, 11 November 2006 (UTC)
* McCormack 17:49, 29 March 2007 (UTC)
* Lrbabe 13:53, 10 May 2007 (UTC)
* CQ 20:57, 24 May 2007 (UTC)
* (Add name here)