summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/alterqcm/doc/latex/doc-aq-excomp.tex
blob: 5d49ddf3fe9297d89c06d56b946a10588c7cb94f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
\section{Additional examples} 
\subsection{The symbolists: use of the macro \tkzcname{includegraphics}}  
\Imacro{includegraphics}

\begin{alterqcm}[lq=8cm,numprop=true,sep]
\AQquestion[pq=2 cm]{Among the three paintings opposite, which is the one painted by \textbf{Gustave Moreau}\vfill}%
{{%
\hfil\includegraphics[scale=.20]{The_Wounded_Angel_-_Hugo_Simberg.jpg}\hfil
},{%
\hfil\includegraphics[scale=.4]{180px-Gustave_Moreau_007.jpg}\hfil
},{%
\hfil\includegraphics[scale=.4]{240px-Mort_du_fossoyeur.jpg}\hfil}}%
 \AQquestion[pq=1 cm]{The following picture was painted by which of these three painters?\\
\hfil\includegraphics[height=3in]{240px-Mort_du_fossoyeur.jpg}\hfil}%
{{Gustav Klimt},{Carlos Schwabe},{Odilon Redon}}
\end{alterqcm} 

\begin{tkzltxexample}[small]
 \begin{alterqcm}[lq=8cm,numprop=true,sep]
 \AQquestion[pq=2 cm]{Of the three paintings, which is the one painted by \textbf{Gustave Moreau}\vfill}%
 {{%
 \hfil\includegraphics[scale=.25]{The_Wounded_Angel_-_Hugo_Simberg.jpg}\hfil
 },{%
 \hfil\includegraphics[scale=.5]{180px-Gustave_Moreau_007.jpg}\hfil
 },{%
 \hfil\includegraphics[scale=.4]{240px-Mort_du_fossoyeur.jpg}\hfil}}
  \AQquestion[pq=1 cm]{The following painting, was painted by which of these three painters?\\
 \hfil\includegraphics[height=3in]{240px-Mort_du_fossoyeur.jpg}\hfil}%
 {{Gustav Klimt},{Carlos Schwabe},{Odilon Redon}}
 \end{alterqcm} 
\end{tkzltxexample}

\subsection{Using a \tkzname{tikzpicture} environment in a question} 
\Ienv{tikzpicture}

\medskip

\begin{alterqcm}[lq=120mm,pre=true,pq=3mm]
 \AQmessage{\begin{minipage}{15cm}
\vspace*{6pt}   
The three trees given below represent probabilistic situations. %
  The numbers shown on the various arrows are probabilities, and,%.
    in the second level, conditional probabilities. Thus for the given tree %
      in question 1 : $0,35 = P(A)$ and $0,1 =  P_{\text{A}}(E)$.
\vspace*{6pt}    
\end{minipage}  
}
\AQquestion{The probability of event E is equal to : \\
\begin{tikzpicture}[yscale=1.2] 
[parent anchor=east,child anchor=west,grow=east]
\tikzstyle{every node}=[text=Maroon,fill=fondpaille,font=\small]
\tikzstyle{every child}=[level distance=25mm]
\tikzstyle{edge from parent}=[draw,->,thin] 
\tikzstyle{level 2}=[sibling distance=12mm]
\node {}
[grow=right]   
child {node {B}
      child { node {F}
        edge from parent node {$0,5$}}
      child { node {E}
        edge from parent node {$0,5$}
            }
         edge from parent node {$0,65$}
       }
child {node {A}
        child { node {F}
          edge from parentnode {$0,9$}}
        child { node {E}
          edge from parent node {$0,1$}}
      edge from parent node {$0,35$}
      };
\end{tikzpicture}}
{{$0,5$},%
{$0,1$},%
{$0,6$},%
{$0,36$}}
\end{alterqcm} 

\begin{tkzltxexample}[small]
 \begin{alterqcm}[lq=120mm,pre=true,pq=3mm]
  \AQmessage{The three trees given below represent probabilistic situations.
   The numbers shown on the different arrows are probabilities, and,
   in the second level, conditional probabilities. Thus for the given tree 
   in question 1: $0,35 = P(A)$ and $0,1 =  P_{\text{A}}(E)$.}
 \AQquestion{The probability of event E is equal to : \\
 \begin{tikzpicture} 
 ...
 \end{tikzpicture}}
 {{$0,5$},%
 {$0,1$},%
 {$0,6$},%
 {$0,36$}}
 \end{alterqcm} 
\end{tkzltxexample}

\begin{tkzexample}[vbox]
\begin{alterqcm}[lq=8cm,numprop=true,sep]
\AQquestion{Among the figures opposite, indicate the one that is a rhombus. :}
{{\hspace{1cm}  \begin{minipage}{5cm} \begin{tikzpicture} 
  \draw (0,0)--(1.5,0)--(2,1)--(.5,1)--cycle; 
\end{tikzpicture} \end{minipage}},
{\hspace{1cm}  \begin{minipage}{5cm} \begin{tikzpicture}
   \draw[rotate=30] (0,0) rectangle (1.5,1); \end{tikzpicture} \end{minipage}},
{\hspace{1cm}  \begin{minipage}{5cm} \begin{tikzpicture}
   \draw (0,0) rectangle (1,1); \end{tikzpicture} \end{minipage} }}
\end{alterqcm} 
\end{tkzexample}

\subsection{Use of a \tkzname{array} environment in the proposals} 
\Ienv{array}

It is possible to use tables and other structures in the question code or proposals. An example is shown below:

\medskip


\begin{tkzexample}[vbox]
\begin{alterqcm}[lq=88mm,symb=$\Box$]
\AQquestion{The couple $(1~;~-1)$ is a solution of }
{%
{$ \left\lbrace
\begin{array}{ll}
 0,75a + 0,5b &= 0,25 \\
 0,25a + 0,5b &=-0,25
\end{array}\right.$},
{$ \left\{
\begin{array}{ll}
 a &=  0,75a +0,5b \\
 b &=  0,25a +0,5b
\end{array}\right.$},
{$ \left\lbrace
\begin{array}{ll}
 0,75a - 0,5b &= 0,25 \\
 0,5a + 0,25b &=-0,25
\end{array}\right.$}
}
\end{alterqcm}\end{tkzexample}  


\subsection{Use of code \tkzname{verbatim} in questions and proposals} 
\Ienv{verbatim}

Here is an example from Pascal Bertolino. It is preferable to use as Pascal did the macro \tkzcname{texttt}, otherwise avoid the use of the mode 
|verbatim|. We will see on the next page how to proceed if this mode is really necessary.

\begin{alterqcm}[lq=80mm,title=false,long] 

%--------------------------------------------------------------
\AQquestion{What was the precursor language of the C language?}
{{Fortran},
 {Language B},
 {Basic}}

%--------------------------------------------------------------
\verbdef\argprop|int a = 3 ^ 4 ;|
\AQquestion{\argprop}
{{raises 3 to the power of 4},
 {makes an exclusive OR between 3 and 4},
 {is not a C}}

%--------------------------------------------------------------
\AQquestion{What is the correct syntax to shift the integer 8 bits to the left? \texttt{a} ?}
{{\texttt{b = lshift(a, 8) ;}},
 {\texttt{b = 8 << a ;}},
 {\texttt{b = a << 8 ;}}}
%--------------------------------------------------------------
\verbdef\argprop|{ printf ("hello") ; return 0 ; \}|
\AQquestion{The complete program:	\\
\texttt{int main() \\
~~\argprop}}
{{displays \texttt{hello}},
 {gives an error to the compilation},
 {gives an error in execution}}
%--------------------------------------------------------------
\verbdef\arg|float tab[10]|
\verbdef\propa|*tab|\global\let\propa\propa
\verbdef\propb|&tab|\global\let\propb\propb
\verbdef\propc|tab|\global\let\propc\propc
\AQquestion{Let's say the declaration \arg ; \\The first real in the table is \ldots}
{{\propa},
 {\propb},
 {\propc}}

%--------------------------------------------------------------
\AQquestion{The line \texttt{printf("\%c", argv[2][0]) ;}
 of \texttt{main} of  \texttt{monProg} run like this : 
\texttt{monProg parametre }}
{{displays \texttt{p}},
 {displays nothing},
 {can cause a crash}}
%--------------------------------------------------------------
\AQquestion{What is the memory size of a \texttt{long int} ?}
{{4 octets},
 {8 octets},
 {ça dépend \ldots}}
%--------------------------------------------------------------
\AQquestion{Following the declaration \texttt{int * i} ;}
{{\texttt{*i} is an address},
 {\texttt{*i} is an integer},
 {\texttt{*i} is a pointer}}
%--------------------------------------------------------------
\AQquestion{One of the following choices is not a standard C library}
{{\texttt{stdlib}},
 {\texttt{stdin}},
 {\texttt{math}}}

\end{alterqcm}

\medskip
Let's look at the source code

the simplest way is often to use the command \tkzcname{texttt}

\begin{tkzexample}[code only]
 \AQquestion{Following the declaration \texttt{int * i} ;}
 {{\texttt{*i} is an address},
 {\texttt{*i} is an integer},
 {\texttt{*i} is a pointer}}
\end{tkzexample}

\begin{tkzexample}[code only]
\AQquestion{The line \texttt{printf("\%c", argv[2][0]) ;}
 of \texttt{main} of  \texttt{monProg} run like this : 
\texttt{monProg parametre }}
{{displays \texttt{p}},
 {displays nothing},
 {can cause a crash}}
\end{tkzexample}

Alternatively, we can load the \tkzname{verbdef} package:
\tkzNamePack{verbdef}

\tkzcname{usepackage\{verbdef\}}

\begin{tkzexample}[code only]
 \verbdef\argprop|int a = 3 ^ 4 ;|
 \AQquestion{\argprop}
 {{raises 3 to the power of 4},
 {does an exclusive OR between 3 and 4},
  {is not a C-instruction}}
\end{tkzexample}

More than one variable may be required:

\begin{tkzexample}[code only]
 \verbdef\arg|float tab[10]|
 \verbdef\propa|*tab|\global\let\propa\propa
 \verbdef\propb|&tab|\global\let\propb\propb
 \verbdef\propc|tab|\global\let\propc\propc
 \AQquestion{Either the declaration  \arg ; \\
 The first real in the table is \ldots}
 {{\propa},
  {\propb},
  {\propc}}
\end{tkzexample}

\endinput