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