| Exam Board | AQA |
|---|---|
| Module | D1 (Decision Mathematics 1) |
| Year | 2007 |
| Session | January |
| Marks | 8 |
| Paper | Download PDF ↗ |
| Mark scheme | Download PDF ↗ |
| Topic | Sorting Algorithms |
| Type | Algorithm Tracing |
| Difficulty | Easy -1.2 This is a straightforward algorithm tracing exercise requiring students to follow simple arithmetic operations and conditional statements. Part (a) involves mechanical step-by-step execution with small numbers, part (b) requires recognizing the algorithm computes LCM (lowest common multiple), and part (c) applies this understanding. No complex problem-solving or novel insight needed—purely procedural work typical of D1 module. |
| Spec | 7.03c Working with algorithms: trace, interpret, adapt |
| Line 10 | Input \(A , B\) |
| Line 20 | Let \(C = 0\) and let \(D = 0\) |
| Line 30 | Let \(C = C + A\) |
| Line 40 | Let \(D = D + B\) |
| Line 50 | If \(C = D\) then go to Line 110 |
| Line 60 | If \(C > D\) then go to Line 90 |
| Line 70 | Let \(C = C + A\) |
| Line 80 | Go to Line 50 |
| Line 90 | Let \(D = D + B\) |
| Line 100 | Go to Line 50 |
| Line 110 | Print \(C\) |
| Line 120 | End |
| Answer | Marks | Guidance |
|---|---|---|
| \((D)\) \(2\), \((B)\) \(3\), \(C\) \(0\), \(D\) \(0\) with totals \(2\), \(2\), \(3\), \(4\), \(6\), \(6\) | M1, A1, A1 | SCA: as far as \(D = 3\); For 4; All correct (3 marks total) |
| Answer | Marks | Guidance |
|---|---|---|
| \((D)\) \(6\), \((B)\) \(8\), \(C\) \(0\), \(D\) \(0\) with totals \(6\), \(8\), \(12\), \(16\), \(18\), \(24\), \(24\) | M1, A1, A1 | SCA: as far as \(D = 8\); For 12; All correct (3 marks total) |
| Answer | Marks | Guidance |
|---|---|---|
| Find LCM | B1 | Allow lowest common denominator (1 mark total) |
| Answer | Marks | Guidance |
|---|---|---|
| \(600\) | B1 | (1 mark total) |
**5(a)(i)**
| $(D)$ $2$, $(B)$ $3$, $C$ $0$, $D$ $0$ with totals $2$, $2$, $3$, $4$, $6$, $6$ | M1, A1, A1 | SCA: as far as $D = 3$; For 4; All correct (3 marks total) |
**5(a)(ii)**
| $(D)$ $6$, $(B)$ $8$, $C$ $0$, $D$ $0$ with totals $6$, $8$, $12$, $16$, $18$, $24$, $24$ | M1, A1, A1 | SCA: as far as $D = 8$; For 12; All correct (3 marks total) |
**5(b)**
| Find LCM | B1 | Allow lowest common denominator (1 mark total) |
**5(c)**
| $600$ | B1 | (1 mark total) |
5 A student is using the following algorithm with different values of $A$ and $B$.
\begin{center}
\begin{tabular}{|l|l|}
\hline
Line 10 & Input $A , B$ \\
\hline
Line 20 & Let $C = 0$ and let $D = 0$ \\
\hline
Line 30 & Let $C = C + A$ \\
\hline
Line 40 & Let $D = D + B$ \\
\hline
Line 50 & If $C = D$ then go to Line 110 \\
\hline
Line 60 & If $C > D$ then go to Line 90 \\
\hline
Line 70 & Let $C = C + A$ \\
\hline
Line 80 & Go to Line 50 \\
\hline
Line 90 & Let $D = D + B$ \\
\hline
Line 100 & Go to Line 50 \\
\hline
Line 110 & Print $C$ \\
\hline
Line 120 & End \\
\hline
\end{tabular}
\end{center}
\begin{enumerate}[label=(\alph*)]
\item \begin{enumerate}[label=(\roman*)]
\item Trace the algorithm in the case where $A = 2$ and $B = 3$.
\item Trace the algorithm in the case where $A = 6$ and $B = 8$.
\end{enumerate}\item State the purpose of the algorithm.
\item Write down the final value of $C$ in the case where $A = 200$ and $B = 300$.
\end{enumerate}
\hfill \mbox{\textit{AQA D1 2007 Q5 [8]}}