
\documentclass[10pt]{article} 

\usepackage[french]{alterqcm}
\usepackage{fullpage}
\usepackage{longtable}
\usepackage{shortvrb}
\usepackage[french]{babel}

\pagestyle{empty}
\AtBeginDocument{\MakeShortVerb{\|}} % link to shortvrb
%--------------------------------------------------------------
\begin{document}
%--------------------------------------------------------------
\parindent=0pt
\begin{center}
C Language Control \\

\vspace{5mm}
Name : \hspace{5cm}
First name :   \\

\vspace{5mm}
{\small For each question, 3 answers are proposed. One and only one is correct. It's up to you to find it and to choose the corresponding box. 
Correct answer = +1 point. No answer = 0 point. Wrong answer = -0.5 point.}
\begin{alterqcm}[lq=90mm,title,num=true,alea,long] 
% rajouter ou enlever l'option correction pour voir ou non les corrections :-)
%--------------------------------------------------------------

\AQquestion{What was the precursor language of the C language?}
{{Fortran},%
 {Langage B},%
 {Basic},%
 {X},%
 {Y}}
%--------------------------------------------------------------
\verbdef\arg|int a = 3 ^ 4 ;|
\AQquestion{\arg}
{{raises 3 to the power of 4},
 {makes an exclusive OR between 3 and 4},
 {is not an instruction 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 ;}}}
%--------------------------------------------------------------
\AQquestion{The complete program:	\\
\texttt{int main() \\
~~\{ printf ("bonjour") ; return 0 ; \}}}
{{displays \texttt{bonjour}},
  {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} exécuté ainsi : \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},
 {it depends \ldots}}
%--------------------------------------------------------------
\AQquestion{Following the declaration \texttt{int * i} ;}
{{\texttt{*i} is an address},
 {\texttt{*i} is an integer},
 {\texttt{*i} is a pointer}}
%--------------------------------------------------------------
\AQquestion{Following the declaration \texttt{char tab[12]} ;}
{{\texttt{\&tab} is the address of the table},
 {\texttt{\&tab} is the pointer to the array},
 {\texttt{\&tab} means nothing}}

%--------------------------------------------------------------
\AQquestion{One of the following choices is not a standard C library}
{{\texttt{stdlib}},
 {\texttt{stdin}},
 {\texttt{math}}}
%--------------------------------------------------------------
\AQquestion{The full syntax of the \texttt{main} function is \ldots}
{{\texttt{int main(int argc, char* argv)}},
 {\texttt{int main(int argc, char argv*[])}},
 {\texttt{int main(int argc, char* argv[])}}}
%--------------------------------------------------------------
\AQquestion{Le programme complet :
\texttt{int main()\\
\{ char a[2]="x" ; char b[2]="y" ; \\
~~return (a[0] == b[0]) ; \}
}}
{{has 0 error},
 {contains 1 error},
 {has 2 errors}}

%--------------------------------------------------------------
\AQquestion{To free a dynamically allocated memory area in C, use the function \ldots}
{{\texttt{delete}},
 {\texttt{clear}},
 {\texttt{free}}}

%--------------------------------------------------------------
\AQquestion{The expression  \texttt{val char[32] ; }}
{{is syntactically incorrect},
 {declares a chain},
 {declares a table}}

 %--------------------------------------------------------------
\verbdef\arga|char s[10] ; int i ;|
\verbdef\argb|scanf("%d, %s", \&i, s) ;|
\AQquestion{We count in the following lines :\\
\arga \\
\argb}
{{0 compilation error},
 {1 compilation error},
 {2 compilation errors}}
%--------------------------------------------------------------
\AQquestion{A global variable is \ldots}
{{\texttt{static}},
 {stored in the stack},
 {initialized with default zeros}}
%--------------------------------------------------------------
\AQquestion{The scope of a local variable is \ldots}
{{the function},
 {the module},
 {the block}}
%--------------------------------------------------------------
\verbdef\argprop|int a = 3 ^ 4 ;| 
\AQquestion{The line \texttt{int c = argv[1] + argv[2] ;}
 of \texttt{main} of  \texttt{monProg} run like this :
|int a = 3 ^ 4 ;| }
{{assigns 579 to \texttt{c}},
 {gives an error to the compilation},
 {assigns an undetermined value to \texttt{c}}}
 \end{alterqcm}
\end{center}
\end{document}

% utf8
% pdflatex
% Pascal Bertolino Alain Matthes
%