# User:Guy vandegrift/Quizbank/Archive1/How a quiz question joins a quizbank

A quiz doesn't join Quizbank, Quizbank joins the quiz

• In the spirit of Wikiversity's effort to create a body of work that embraces both useful content and experimentation, very few quizzes will be subpages of Quizbank. Instead, a subpage will be appended to a quiz that renders the quiz into proper format. Then, the properly formatted version of the quiz will be entered into a category that is reserved only for quizzes that have been formatted for printout as pdf files.
• Example: Venus/Quiz and was written as a subpage of Venus before Quizbank was established, and does not conform to Quizbank standards. To render compatibility with Quizbank, the subpage Venus/Quiz/Quizbank was created. This subpage can by copied and pasted into a MATLAB program that creates wikitext that renders proper pagebreaks when printed.
• When a quiz is stored in Wikiversity files, it should be formatted and named in specific manner to be described later. This naming of the pdf files will facilitate the cataloging of rendered pdf files using Special:PrefixIndex. The formatting rules are somewhat complicated and subject to change. One rule is that the entire question must occupy one and only one line of wikitext (the <br> symbol may be used to create line-breaks in the rendered pdf text.

For a simple example of how Special:PrefixIndex can be used to sort and catalog the pdf files, see: PDF files

## A note about organization of the pdf files

### Birth on a Wikiversity or Wikibooks

A question can be "born" on any mw:Extension:Quiz that appears on any Wikiversity or Wikibooks page.[1] There will always be a set or restrictions regarding this quiz. For example, there are no plans to ever support the option "display = simple" or allow more than 5 multiple choice options.[2]

### Re-birth on a Wikiversity page

A collection of such questions is placed on a newly-created page in the proper format. This can be done by writing the quiz in the proper format, or rewriting it in subpage to the original page. There is some flexibility in how this Wikiversity page, but certain rules must be strictly followed.[3]

### Processing by a high-level language and submission as a Wikiversity file

This material documents how MATLAB renders the PDF files, but is out of date

The file shown in step 2 is downloaded directly onto a computer and forms the database. Or equivalently, the file is created on the computer and uploaded to Wikiversity. The text associated with steps 2 and 3 are identical, except that step 3, the questions are separated so that each question is stored in a different directory file. There are three advantages to storing the question in a computer's quizbank in exactly the same form it appears on Quizbank:

1. The user can render the question at anytime by uploading it to Wikiversity
2. Users can share quizzes, through Wikiersity
3. Each time the markup of a quiz is modified a chance of error results. By beginning with a renderable markup, we can debug at the very first step by uploading to Wikiversity.
The first three versions of a question as stored in the quizbank

==a07energy_lineIntegral_2_v1==
<quiz display="simple">
{<!--D044a07energy_lineIntegral_2-->Integrate the function, $\vec F = r^7\theta^9\hat r + r^7\theta^ 5\hat \theta$ , along the first quadrant of a circle of radius 8}
- a) 3.43E+07
- b) 3.67E+07
- c) 3.93E+07
+ d) 4.20E+07
- e) 4.49E+07
</quiz>
{{cot|copies}}
<pre>
===2===
{<!--D044a07energy_lineIntegral_2-->Integrate the function, $\vec F = r^6\theta^8\hat r + r^7\theta^ 6\hat \theta$ , along the first quadrant of a circle of radius 5}
- a) 1.15E+06
- b) 1.23E+06
+ c) 1.32E+06
- d) 1.41E+06
- e) 1.51E+06
===3===
{<!--D044a07energy_lineIntegral_2-->Integrate the function, $\vec F = r^6\theta^6\hat r + r^8\theta^ 7\hat \theta$ , along the first quadrant of a circle of radius 3}
- a) 6.96E+04
- b) 7.44E+04
- c) 7.97E+04
- d) 8.52E+04
+ e) 9.12E+04



### Other files stored in the same directory

This file resides on a computer with a directory path that looks something like

(root)\Quizbank\bank\a07energy_lineIntegral\a07energy_lineIntegral_2


This directory contains the following files and folders:

(root)\Quizbank\bank\a07energy_lineIntegral\attribution_.txt
(root)\Quizbank\bank\a07energy_lineIntegral\questions_.txt
(root)\Quizbank\bank\a07energy_lineIntegral\a07energy_lineIntegral_1
(root)\Quizbank\bank\a07energy_lineIntegral\a07energy_lineIntegral_2
(root)\Quizbank\bank\a07energy_lineIntegral\a07energy_lineIntegral_3
(root)\Quizbank\bank\a07energy_lineIntegral\a07energy_lineIntegral_4
(root)\Quizbank\bank\a07energy_lineIntegral\other_


attribution_.txt contains the attribution for the entire quiz. It must occupy only one line of wikitext.

questions_.txt is a text file with of four lines of text that is read every time an exam is contemplated that might select one or more questions from this permalink.

a07energy_lineIntegral_1.txt
a07energy_lineIntegral_2.txt
a07energy_lineIntegral_3.txt
a07energy_lineIntegral_4.txt


other_ is for anything related to this quiz (such the MATLAB code used to generate the quiz questions).

Due to the complexity of the software used to generate exams, the exams for a given course might be created by a specialist and made available to instructors. This inflexibility is unusual, since most instructors pick their own exam questions. On the other hand, this arrangement actually saves labor and allows instructors to focus on other aspects of the course. Keep in mind that the problems and solutions are already available to help the student learn the material.

## MATLAB code to print questions

### sample cellarray created by makeinline

The key call is to makeinline, which takes the address of a question (with all its variations) and returns one version in the form of a 15 element cell array that gives us everything we need. Except for elements 7 and 14, all elements are string arrays.

1: The spring constant is 630N/m,  and the initial compression is 0.25m. What is the mass if the cart reaches a height of 1.26m,  before coming to rest?[[File:Roller coaster energy conservation.jpg|260px|right]]
2: - a) 1.312  kg
3: - b) 1.377  kg
4: - c) 1.446  kg
5: - d) 1.518  kg
6: + e) 1.594  kg
7: 5
8: 048
9: a07energy_cart2_1
10: \Users\User\Documents\MATLAB\Quizbank\bank
11: \Users\User\Documents\MATLAB\Quizbank\bank\a07energy_cart2\a07energy_cart2_1.txt
12: \Users\User\Documents\MATLAB\Quizbank\bank\a07energy_cart2
13: https://en.wikiversity.org/w/index.php?title=Physics_equations/07-Work_and_Energy/Q:cart2&oldid=1380821
14: 21
15: <!--a07energy_cart2_1-->The spring constant is 630N/m,  and the initial compression is 0.25m. What is the mass if the cart reaches a height of 1.26m,  before coming to rest?[[File:Roller coaster energy conservation.jpg|260px|right]]


### function folder

 :Copy_of_pickQuestion.m not needed? :IDquestion.m extracts the ID from the question as stored in bank :extractDEN.m obsolete finds the DEN (density) code :findRootBank.m returns root to bank :findRootPrintExams.m returns root to pringExams :getAttribution.m gets attribution :getAttributionQuizfolder.m obsolete? :getpath2quiz.m obsolete? :getpath2quizOLD.m obsolete? :inventory_.m inventorys functions in functions :makeExamArray.m obsolete? :makeExamCellArray.m returns [examcellarray,textfilename,questionlist] :makeexamb.m obsolete? :makeinline.m converts question's path into 15 col cell array :nAnswers.m counts the answer to a question :pickQuestion.m selects a question from T (Trn), randomly if choice = 0 :readwikitext.m reads raw quizbank file, cleans and returns as cell array w/o attributions :textfile2cellarray.m converts anytextfile to a cell array :versionsInBank.m returns from T (Trn) the number of versions of a question.

### current content of makecellarray (will be modified)

clc,clear all,close all;
%function [questioninline ] = makeinline(path2onequestion )
path2onequestion = 'a07energy_cart2\a07energy_cart2_1.txt'; %aka pathID
addpath('functions','-frozen'); % remove when placed in functions

% reads path and returns questioninline (1x13 cell array for one question)
% random version
path2quizzesroot='\Users\User\Documents\MATLAB\Quizbank\bank';
path2onequestion = fullfile(path2quizzesroot,path2onequestion);
Que=pickQuestion(Trn);
mystring = Que{1};

%% Do columns 1 and 12 first.  Col DOES NOT the ID,{,} from the question.  Col 1 does
questioninline{15}=mystring ; %<!--D048a07energy_cart2_1-->The spring constant is 676N/m,  and the initial compression is 0.14m. What is the mass if the cart reaches a height of 2.73m,  before coming to rest?[[File:Roller coaster energy conservation.jpg|260px|right]]
%15 is the long version of the question, the short version is at 1 to
sizestring = size(mystring,2);
longstring = mystring;
%If not commented out find the last element of the ID
for n = 7:numel(mystring)
lookforend = [mystring(n-2) mystring(n-1) mystring(n)];
if strcmp(lookforend,'-->');
shortstring =mystring(n+1:sizestring);
questioninline{1} = mystring(n+1:sizestring);
end
end

%%% now do the answers which are columns 2,3,4,5,6
questioninline{ncol}=Que{ncol};
end

questioninline{8}=extractDEN(Trn); %Density
questioninline{9}=IDquestion(Trn); %ID
questioninline{10}= findRootBank(  );
questioninline{11}=path2onequestion;
% use trick to get path2quiz
% lastel=size(path2onequestion,2);
% cut = max(strfind(path2onequestion,'\'));
% path2quiz = path2onequestion(1:cut-1);
% questioninline{12} = path2quiz;
% tespringpat3quiz=path2quiz
questioninline{12} = getpath2quiz(path2onequestion);%path2quizfolder
questioninline{14}=versionsInBank(Trn);

for count = 1:15
example=questioninline{count};
if count == 7 || count == 14;
example = num2str(example);
end
fprintf('%i: %s\n',count,example);
end

rmpath('functions')
%end % of function


## Footnotes and references

</references>

1. It is not certain whether Wikipedia supports mw:Extension:Quiz
2. Bells and whistles need to be proposed right now. Once this code is done, I want to use it.--user:Guy vandegrift
3. For example, that the first line is a single footnote containing attribution information. My understanding is that it must be possible to place this attribution on every printed exam.