-
Notifications
You must be signed in to change notification settings - Fork 0
/
exam_paper_template_with_cover.tex
343 lines (236 loc) · 7.03 KB
/
exam_paper_template_with_cover.tex
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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
%% exam_paper_template_with_cover.tex
%% Author: Lawrence Ong
%% Created: 23/08/2020
%% Modified: 21/04/2023
%%
%% This is a template for final examination papers
%% created according to the specifications required
%% by the University of Newcastle
%%
%% NOTE: This version includes the cover page.
\newif\ifsoln
\solntrue %%% uncomment to turn on solutions | comment to turn off solution
\documentclass[a4paper,12pt]{article}
% ==========
% Insert semester, year, module name, and other information here
\newcommand{\semester}{1} % semester
\newcommand{\examyear}{2023} % year
\newcommand{\subjectname}{Subject} % subject name
\newcommand{\quiznumber}{1} % quiz number
\newcommand{\modulecode}{ELECXXXX} % subject code
\newcommand{\school}{School of Engineering} % school
\newcommand{\totalqn}{TEN~(10)} % total number of questions
\newcommand{\totalmarks}{100} % total marks
% ==========
% Use Helvetica for everything
\renewcommand{\familydefault}{\sfdefault}
\usepackage[scaled]{helvet}
\usepackage{couriers} % Use couriers font for ttfamily. It's fixed wideth and is too wide. But better for displaying ~ and ^.
\usepackage[helvet]{sfmath}
\everymath={\sf}
\usepackage[T1]{fontenc}
\usepackage{amssymb,amsmath}
\usepackage{bm}
\usepackage{lastpage}
\usepackage{color}
\usepackage{listings}
%\usepackage{amssymb}
% Change the section title font size
\usepackage[sf,bf,compact]{titlesec}
\titleformat*{\section}{\sffamily \bfseries \normalsize}
\usepackage{graphicx}
\graphicspath{{figures/}{./}}
\usepackage[shortlabels]{enumitem}
\usepackage{setspace}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead[L]{\fontsize{10}{0} \selectfont Semester~\semester,~\examyear}
\fancyhead[R]{\fontsize{10}{0} \selectfont \hfill \modulecode~\subjectname}
\fancyfoot[C]{\fontsize{10}{12} \selectfont Page \thepage\ of \pageref{LastPage}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\setlength{\voffset}{-1.2cm} % -1in + 1.25cm = -1.29cm
\setlength{\topmargin}{0in}
\setlength{\headheight}{8.85pt}
\setlength{\headsep}{1.12cm}
\setlength{\oddsidemargin}{0cm}
\setlength{\hoffset}{0.65cm} %-1in + 3.25cm = 0.71cm
\setlength{\textwidth}{15.25cm}
\setlength{\textheight}{24.5cm}
\setlength{\footskip}{1.12cm}
\fancyheadoffset[LO,RE]{1.5cm} %move start of header to the left
\fancyheadoffset[RO,LE]{1cm} %move end of header to the right
\setlength\parindent{0pt}
\newcounter{question}[section]
\newenvironment{question}[2][]
{\refstepcounter{question} %\par\medskip
\textbf{Question~\thequestion. \hfill (#1 marks)}\newline #2}{\bigskip\bigskip\bigskip}
% Used for the solution
\usepackage{boxedminipage}
\setlength{\fboxrule}{2pt}
\setlength{\fboxsep}{4mm}
\newenvironment{mysol}[1][]%
{\color{red} %
\bigskip \begin{boxedminipage}[t]{\textwidth} %
\color{black}#1} %
{\end{boxedminipage} \medskip}
\newcommand\solution[1]{\ifsoln \begin{mysol} {#1} \end{mysol} \else \fi}
\newcommand\answerfield{\bigskip Answer: \rule{2.5cm}{0.2mm}}
\lstset{
basicstyle=\ttfamily,
frame=single,
columns=fullflexible
}
% Example of usage
% Note: The first argument in the "question" environment
% is the total mark for that question
% ===============
% %% Make sure that there is no space before the % sign below
% \begin{question}[10]\label{q2}%
% % Include \vspace{-1.5\topsep} if there is no text preceeding enumerate
% \vspace*{-1.5\topsep}
% \begin{enumerate}[(a)]
% \item XXX
% \begin{enumerate}[(i)]
% \item Question~\ref{q2}
% \end{enumerate}
% \item YYY
% \end{enumerate}
% \end{question}
%
% Use \begin{itemize}[\large $\square$] for multiple choice boxes
%
% Use \solution{} for solutions
%
% Code:
% \begin{boxedminipage}[t]{\textwidth}
% \begin{verbatim}
% printf("hello\n");
% \end{verbatim}
% \end{boxedminipage}
%
% \lstinline{printf("hello\n");}
% ===============
\begin{document}
% ========== COVER PAGE ==========
\begin{doublespace}
\vspace*{-10mm}
\begin{minipage}[t]{0.23\linewidth}
\footnotesize
Desk Number:
\vspace{0.5mm}
Student Number:
\vspace{0.5mm}
Student Name:
{\ }
\end{minipage} \begin{minipage}[t]{0.4\linewidth}
\footnotesize
\rule{2cm}{0.2mm}
\vspace{0.5mm}
\rule{5cm}{0.2mm}
\vspace{0.5mm}
\rule{5cm}{0.2mm}
{\ }
\end{minipage}\hfill
\begin{minipage}[b]{3.78cm}
\hspace*{10mm}\includegraphics[height=3.78cm]{uon_logo_black_square.pdf}
\vspace*{-3.78cm}
\end{minipage}
\vspace{20mm}
\begin{center}
\textbf{\large \school}
\vspace{1mm}
\textbf{\large EXAMINATION}
\textnormal{\footnotesize Semester~\semester,~\examyear}
\textbf{\large \modulecode~\subjectname}
\textit{\footnotesize This paper is for CALLAGHAN students.}
\end{center}
{\footnotesize
\begin{minipage}[t]{0.33\linewidth}
\footnotesize
Examination Duration:
Reading Time:
\end{minipage}
\begin{minipage}[t]{0.3\linewidth}
\footnotesize
120 minutes
10 minutes
\end{minipage}\\
\vspace{-1mm}
This exam has \underline{\totalqn} questions
Total marks: \totalmarks~marks
\textbf{Exam Conditions:}
This is a RESTRICTED OPEN book examination
Notes Permitted
Non Programmable Calculators Permitted
\textbf{Materials Permitted In The Exam Venue:}
1 A4 double sided sheet of handwritten or typed notes (Memory Aid sheet)
Non programmable calculators are permitted
\textbf{Materials To Be Supplied To Students:}
1 $\times$ 12 Page Answer Booklet
\textbf{Special Instructions:}
Answer ALL questions.
You must show workings in your answers.
{\ }}
\end{doublespace}
% ========== END COVER PAGE ==========
\newpage
% ========== CONTENT STARTS HERE ==========
% Make sure that there is no space before the % sign below
\begin{question}[2]\label{rtos}%
Which of the following statements is/are true? Select ALL correct answers.
\begin{lstlisting}
void main () {
printf("Hello\n");
}
\end{lstlisting}
\begin{enumerate}[A.]
\item \lstinline{printf("Hello\n");}
\item\label{rtos-correct} Blah Blah
\item Blah Blah
\item Blah Blah
\end{enumerate}
\answerfield
\solution{
The answer is \ref{rtos-correct}\\
2 marks for the correct answer. $-2$ marks for each wrong answer.
}
\end{question}
\begin{question}[10]\label{q2}%
% Include \vspace{-1.5\topsep} if there is no parapgraph preceeding enumerate
\vspace*{-1.5\topsep}
\begin{enumerate}[(a)]
\item XXX
\begin{enumerate}[(i)]
\item Question~\ref{q2}
\end{enumerate}
\item YYY
\end{enumerate}
\answerfield
\end{question}
\newpage
\begin{question}[20]\label{q3}%
XXX \lstinline{scanf()}.
\begin{enumerate}[(a)]
\item XXX
\begin{enumerate}[(i)]
\item Question~\ref{q3}
\end{enumerate}
\end{enumerate}
\begin{lstlisting}
printf("Hello world\n");
\end{lstlisting}
\end{question}
\bigskip
\begin{center}
\textbf{END OF EXAMINATION}
\end{center}
\newpage
\appendix
\textbf{APPENDIX}
\section{Formulae}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End: