| Exam Board | AQA |
|---|---|
| Module | D1 (Decision Mathematics 1) |
| Year | 2012 |
| Session | June |
| 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 through a loop with 4 iterations. The miscopied line question (part b) requires only basic observation that it creates an infinite loop. No problem-solving or mathematical insight needed beyond careful bookkeeping. |
| Spec | 7.03c Working with algorithms: trace, interpret, adapt |
| Line 10 | Let \(A = 1 , B = 1 , C = 1\) |
| Line 20 | Let \(D = A\) |
| Line 30 | Let \(C = C \times B\) |
| Line 40 | Let \(D = D + ( 1 / C )\) |
| Line 50 | If \(B = 4\) then go to Line 80 |
| Line 60 | Let \(B = B + 1\) |
| Line 70 | Go to Line 30 |
| Line 80 | Print 'An estimate of e is', \(D\) |
| Line 90 | End |
| Answer | Marks | Guidance |
|---|---|---|
| Answer | Marks | Guidance |
| Correct trace table showing iterations: | M1 | Method for tracing |
| \(B=1\): \(C=1\times1=1\), \(D=1+1/1=2\) | A1 | |
| \(B=2\): \(C=1\times2=2\), \(D=2+1/2=2.5\) | A1 | |
| \(B=3\): \(C=2\times3=6\), \(D=2.5+1/6=2.6\overline{6}\) | A1 | |
| \(B=4\): condition met, print \(D \approx 2.708\overline{3}\) | A1 A1 | Final value and print statement |
| Answer | Marks | Guidance |
|---|---|---|
| Answer | Marks | Guidance |
| Algorithm returns to Line 10 resetting \(A=1, B=1, C=1\), causing an infinite loop | B1 B1 | B1 for restart/reset, B1 for infinite loop conclusion |
## Question 8:
**(a)**
| Answer | Marks | Guidance |
|--------|-------|----------|
| Correct trace table showing iterations: | M1 | Method for tracing |
| $B=1$: $C=1\times1=1$, $D=1+1/1=2$ | A1 | |
| $B=2$: $C=1\times2=2$, $D=2+1/2=2.5$ | A1 | |
| $B=3$: $C=2\times3=6$, $D=2.5+1/6=2.6\overline{6}$ | A1 | |
| $B=4$: condition met, print $D \approx 2.708\overline{3}$ | A1 A1 | Final value and print statement |
**(b)**
| Answer | Marks | Guidance |
|--------|-------|----------|
| Algorithm returns to Line 10 resetting $A=1, B=1, C=1$, causing an infinite loop | B1 B1 | B1 for restart/reset, B1 for infinite loop conclusion |
8 The following algorithm finds an estimate of the value of the number represented by the symbol e:
\begin{center}
\begin{tabular}{ l l }
Line 10 & Let $A = 1 , B = 1 , C = 1$ \\
Line 20 & Let $D = A$ \\
Line 30 & Let $C = C \times B$ \\
Line 40 & Let $D = D + ( 1 / C )$ \\
Line 50 & If $B = 4$ then go to Line 80 \\
Line 60 & Let $B = B + 1$ \\
Line 70 & Go to Line 30 \\
Line 80 & Print 'An estimate of e is', $D$ \\
Line 90 & End \\
\end{tabular}
\end{center}
\begin{enumerate}[label=(\alph*)]
\item Trace the algorithm.
\item A student miscopied Line 70 .
His line was\\
Line 70 Go to Line 10\\
Explain what would happen if his algorithm were traced.
\end{enumerate}
\hfill \mbox{\textit{AQA D1 2012 Q8 [8]}}