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