Subversion Repositories wimsdev

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
20 reyssat 1
%% This file is generated by preprocessor!
2
%% Do not edit it by hand.
3
%% Edit the source file cpp/qcm.cpp.
4
 
5
\language{en}
6
\author{XIAO, Gang}
7
\email{xiao@unice.fr}
8
\computeanswer{no}
9
\format{html}
10
\text{datafile=slib(oef/env datafile)}
11
\integer{datacnt=wims(recordcnt \datafile)}
12
\text{shuff=shuffle(\datacnt)}
13
 
14
 
15
\integer{questions=\confparm1 notsametext?\confparm1:1}
16
\integer{questions=\questions issametext NaN?1}
17
\integer{questions=min(min(20,\datacnt),max(1,\questions))}
18
\title{One by one in the original order}
19
\text{shuff=shuffle(\datacnt)}
20
\text{records=wims(sort numeric items \shuff[1..\questions])}
21
\text{steptype=step}
22
 
23
 
24
 
25
 
26
 
27
 
28
 
29
\text{choicename=Choice}
30
 
31
%% This file is language-independent.
32
 
33
\text{header=wims(nonempty lines wims(record 0 of \datafile))}
34
\integer{n=wims(linecnt \header)}
35
\text{commonq=}
36
\for{k=1 to \n}{
37
 \text{l=\header[\k;]}
38
 \text{test=wims(char 1 to 3 of \l)}
39
 \text{l=wims(char 4 to -1 of \l)}
40
 \text{commonq=\test issametext .IQ?\commonq \l}
41
}
42
 
43
\integer{qcnt=items(\records)}
44
\integer{givetrue=1}
45
\integer{minfalse=0}
46
\text{option=}
47
\integer{tot=8}
48
\text{anstype=checkbox iswordof \option?checkbox:radio}
49
\text{chars=A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z}
50
 
51
\text{ans=}
52
\text{list=}
53
\text{pick=}
54
\text{hint=}
55
\text{image=}
56
\text{feedback=}
57
\text{statement=}
58
\text{empty=}
59
\text{Tot=}
60
 
61
\for{rec in \records}{
62
 
63
\text{data=wims(trim wims(record \rec of \datafile))}
64
\text{data=wims(embraced randitem \data)}
65
\text{statement1=wims(line 1 of \data)}
66
\text{statement1=wims(singlespace wims(rows2lines \statement1))}
67
\integer{n=wims(linecnt \data)}
68
\text{true1=}
69
\text{false1=}
70
\text{contents=statement}
71
\text{fb1=}
72
\for{k=2 to \n}{
73
 \text{l=wims(trim wims(line \k of \data))}
74
 \text{c=wims(char 1 of \l)}
75
 \text{l=wims(char 2 to -1 of \l)}
76
 \text{l=wims(replace internal , by , in \l)}
77
 \text{l=wims(singlespace wims(rows2lines \l))}
78
 \text{contents=\contents,\l}
79
 \if{\c issametext 0}{
80
   \text{false1=wims(append item \k to \false1)}
81
 }
82
 \if{\c issametext 1}{
83
   \text{true1=wims(append item \k to \true1)}
84
 }
85
 \if{\c isin Ff and \k > 2}{
86
  \text{fb1=\fb1\l}
87
 }
88
 \if{\c isin Hh}{
89
  \text{hint=\l}
90
 }
91
 \if{\c isin Ii}{
92
  \text{image=wims(trim \l)}
93
 }
94
 \text{fb1=\fb1,}
95
}
96
\integer{truecnt=items(\true1)}
97
\integer{falsecnt=items(\false1)}
98
\integer{givetrue1=\givetrue>\truecnt?\truecnt:\givetrue}
99
\integer{tot1=\tot > \falsecnt+\givetrue?\falsecnt+\givetrue:\tot}
100
\integer{givetrue1=\givetrue1>\tot1-1?\tot1-1}
101
\integer{minfalse1=\minfalse>\tot1-\givetrue1?\tot1-\givetrue1:\minfalse}
102
\text{tsh=shuffle(\truecnt)}
103
\text{true=item(\tsh,\true1)}
104
\if{\minfalse1>0}{
105
 \text{false1=item(1..\minfalse1,\false1);}
106
 \text{false2=item(\minfalse1+1..\falsecnt,\false1)}
107
}{
108
 \integer{minfalse1=0}
109
 \text{false2=\false1}
110
 \text{false1=}
111
}
112
\text{fsh=shuffle(\falsecnt)}
113
\text{false2=item(\fsh,\false2)}
114
\text{pick1=item(1..\givetrue1,\true),\false1 item(1..\tot1-\givetrue1-\minfalse1,\false2)}
115
\text{ind=wims(makelist 1 for x=1 to \givetrue1),wims(makelist 0 for x=1 to \tot1-\givetrue1)}
116
\text{sh=shuffle(\tot1)}
117
\text{ind=item(\sh,\ind)}
118
\text{pick1=item(\sh,\pick1)}
119
\text{ans1=positionof(1,\ind)}
120
\text{list1=item(1..\tot1,\chars)}
121
\text{Tot=\Tot\tot1,}
122
\text{list=\list\list1;}
123
\text{ans=\ans\ans1;}
124
\text{feedback=\feedback\fb1[\pick1];}
125
\text{pick1=\contents[\pick1]}
126
\text{pick=\pick\pick1;}
127
\text{statement=\statement\statement1;}
128
 
129
}
130
 
131
\text{repind=}
132
\text{indcolor=}
133
\text{reps=}
134
\text{steps=wims(makelist r x for x=1 to \qcnt)}
135
\text{steps=\steptype notsametext all?wims(items2lines \steps)}
136
\steps{\steps}
137
 
138
\statement{
139
\if{\image notsametext }{
140
  <img align=right hspace=10 src=\imagedir/\image> <p>
141
}
142
\commonq
143
\for{q=1 to \qcnt}{
144
 \if{\steptype issametext all or (\status issametext end and \q<=\step) or \q=\step}{
145
  \if{\qcnt>1}{<p> \q. }
146
  \statement[\q;]
147
  <p><table border=0 cellspacing=4>
148
  \for{i=1 to \Tot[\q]}{
149
   <tr><td nowrap>\embed{reply \q,\i}.</td>
150
   <td>\pick[\q;\i]</td></tr>
151
  }
152
  </table>
153
  \if{\status issametext end and \repind[\q]>0 and \feedback[\q;\repind[\q]] notsametext }{
154
   <p><font color=\indcolor[\q]><em>\feedback[\q;\repind[\q]]</em></font>
155
  }
156
  \if{\q<\qcnt and (\steptype issametext all or \q<\step)}{<p><hr>}
157
 }
158
}
159
\if{\image notsametext }{<br clear=right>}
160
}
161
 
162
\answer{\choicename 1}{\ans[1;];\list[1;]}{type=\anstype}{option=\option}
163
\answer{\choicename 2}{\ans[2;];\list[2;]}{type=\anstype}{option=\option}
164
\answer{\choicename 3}{\ans[3;];\list[3;]}{type=\anstype}{option=\option}
165
\answer{\choicename 4}{\ans[4;];\list[4;]}{type=\anstype}{option=\option}
166
\answer{\choicename 5}{\ans[5;];\list[5;]}{type=\anstype}{option=\option}
167
\answer{\choicename 6}{\ans[6;];\list[6;]}{type=\anstype}{option=\option}
168
\answer{\choicename 7}{\ans[7;];\list[7;]}{type=\anstype}{option=\option}
169
\answer{\choicename 8}{\ans[8;];\list[8;]}{type=\anstype}{option=\option}
170
\answer{\choicename 9}{\ans[9;];\list[9;]}{type=\anstype}{option=\option}
171
\answer{\choicename 10}{\ans[10;];\list[10;]}{type=\anstype}{option=\option}
172
\answer{\choicename 11}{\ans[11;];\list[11;]}{type=\anstype}{option=\option}
173
\answer{\choicename 12}{\ans[12;];\list[12;]}{type=\anstype}{option=\option}
174
\answer{\choicename 13}{\ans[13;];\list[13;]}{type=\anstype}{option=\option}
175
\answer{\choicename 14}{\ans[14;];\list[14;]}{type=\anstype}{option=\option}
176
\answer{\choicename 15}{\ans[15;];\list[15;]}{type=\anstype}{option=\option}
177
\answer{\choicename 16}{\ans[16;];\list[16;]}{type=\anstype}{option=\option}
178
\answer{\choicename 17}{\ans[17;];\list[17;]}{type=\anstype}{option=\option}
179
\answer{\choicename 18}{\ans[18;];\list[18;]}{type=\anstype}{option=\option}
180
\answer{\choicename 19}{\ans[19;];\list[19;]}{type=\anstype}{option=\option}
181
\answer{\choicename 20}{\ans[20;];\list[20;]}{type=\anstype}{option=\option}
182
 
183
\text{reps=\reply1,\reply2,\reply3,\reply4,\reply5,\reply6,\reply7,\preply8,\preply9,\reply10,
184
  \reply11,\reply12,\reply13,\reply14,\reply15,\reply16,\reply17,\preply8,\preply9,\reply20}
185
\for{t=1 to \qcnt}{
186
  \text{ind=positionof(\reps[\t],\chars)}
187
  \text{repind=\repind\ind,}
188
  \text{indcolor=\ind isitemof \ans[\t;]?\indcolor[]green,:\indcolor[]red,}
189
}
190
 
191
\hint{\hint}