OCR D1 2012 January — Question 6 9 marks

Exam BoardOCR
ModuleD1 (Decision Mathematics 1)
Year2012
SessionJanuary
Marks9
PaperDownload PDF ↗
Mark schemeDownload PDF ↗
TopicDynamic Programming
TypeRecurrence relation solution
DifficultyEasy -1.2 This is a straightforward algorithm trace question requiring systematic execution of given steps with no conceptual insight needed. Students simply follow instructions to compute values at each iteration, which is routine D1 work testing careful arithmetic and table completion rather than problem-solving ability.
Spec7.03a Algorithm definition: input, output, deterministic, finite7.03b Algorithm awareness: uses and practical limitations7.03c Working with algorithms: trace, interpret, adapt8.02a Number bases: conversion and arithmetic in base n

The function INT(\(C\)) gives the largest integer that is less than or equal to \(C\). For example: INT(4.8) = 4, INT(7) = 7, INT(0.8) = 0, INT(−0.8) = −1, INT(−2.4) = −3. Consider the following algorithm. Line 10 \quad Input \(A\) and \(B\) Line 20 \quad Calculate \(C = B \div A\) Line 30 \quad Let \(D =\) INT(\(C\)) Line 40 \quad Calculate \(E = A \times D\) Line 50 \quad Calculate \(F = B - E\) Line 60 \quad Output the value of \(F\) Line 70 \quad Replace \(B\) by the value of \(D\) Line 80 \quad If \(B = 0\) then stop, otherwise go back to line 20
  1. Apply the algorithm using the inputs \(A = 10\) and \(B = 128\). Record the values of \(A\), \(B\), \(C\), \(D\), \(E\), and \(F\) every time they change. Record the output each time line 60 is reached. [4]
  2. Show what happens when the input values are \(A = 10\) and \(B = -13\). [5]

The function INT($C$) gives the largest integer that is less than or equal to $C$.
For example: INT(4.8) = 4, INT(7) = 7, INT(0.8) = 0, INT(−0.8) = −1, INT(−2.4) = −3.

Consider the following algorithm.

Line 10 \quad Input $A$ and $B$
Line 20 \quad Calculate $C = B \div A$
Line 30 \quad Let $D =$ INT($C$)
Line 40 \quad Calculate $E = A \times D$
Line 50 \quad Calculate $F = B - E$
Line 60 \quad Output the value of $F$
Line 70 \quad Replace $B$ by the value of $D$
Line 80 \quad If $B = 0$ then stop, otherwise go back to line 20

\begin{enumerate}[label=(\roman*)]
\item Apply the algorithm using the inputs $A = 10$ and $B = 128$. Record the values of $A$, $B$, $C$, $D$, $E$, and $F$ every time they change. Record the output each time line 60 is reached. [4]

\item Show what happens when the input values are $A = 10$ and $B = -13$. [5]
\end{enumerate}

\hfill \mbox{\textit{OCR D1 2012 Q6 [9]}}