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:
- The user can render the question at anytime by uploading it to Wikiversity
- Users can share quizzes, through Wikiersity
- 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, <math>\vec F = r^7\theta^9\hat r + r^7\theta^ 5\hat \theta</math> , 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, <math>\vec F = r^6\theta^8\hat r + r^7\theta^ 6\hat \theta</math> , 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, <math>\vec F = r^6\theta^6\hat r + r^8\theta^ 7\hat \theta</math> , 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);
Trn =readwikitext(path2onequestion);
Que=pickQuestion(Trn);
answercount=nAnswers(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
%facilitate use by a spreadsheet
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
for ncol= 2:answercount+1
questioninline{ncol}=Que{ncol};
end
questioninline{7}=nAnswers(Trn); %number of answers (to print) between 2 and 5
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{13}=getAttribution(path2onequestion);
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>