CAPE Computer Science Unit 1 · 2012 · Paper 2
32 questions and parts from this paper. Open one to see it in full, then practise it on Quelpr and get it marked against the mark scheme.
- 1(a)(i)4 marksGive the truth table of the circuit.
- 1(a)(ii)6 marksUsing only primary logic gates, design and draw the circuit for F.
- 1(b)(i)4 marksDraw a clearly labelled block diagram of a 4-to-1 line multiplexer.
- 1(b)(ii)6 marksExplain how a multiplexer can be used for the described purpose and discuss how data from each sensor is transmitted through the alarm notification line.
- 1(c)(i)2 marksShowing all working, find the largest and smallest integers that can be stored in four bits when signed magnitude representation is used.
- 1(c)(ii)3 marksConsider a floating point representation with a 1-bit sign, 3-bit exponent, and 5-bit mantissa. Calculate the decimal equivalent of 101100011.
- 2(a)(i)2 marksExplain what is meant by the 'instruction set' of a central processing unit (CPU).
- 2(a)(ii)6 marksBriefly describe THREE types of instructions that are typically included in an instruction set.
- 2(a)(iii)3 marksExplain how cache memory can increase the efficiency of data retrieval.
- 2(b)(i)2 marksDistinguish between the opcode and the operands of an instruction.
- 2(b)(ii)6 marksTwo typical instruction formats are one-address and two-address. Describe how the operands are obtained in EACH case and specify where the results are stored.
- 2(c)(i)3 marksExplain how a hard disk differs from RAM in terms of access method and access speed.
- 2(c)(ii)3 marksExplain how RAM differs from a CD-R device in terms of volatility and storage capacity.
- 3(a)2 marksExplain the role of an algorithm in the problem-solving process.
- 3(b)(i)3 marksWhich of the algorithms illustrates bounded iteration? Justify your answer.
- 3(b)(ii)3 marksWhich of the algorithms illustrates unbounded iteration? Justify your answer.
- 3(c)(i)5 marksWrite an algorithm to find and print the number of students that voted for EACH of the colours: red, blue, green.
- 3(c)(ii)5 marksWrite an algorithm to find and print the TOTAL number of students that voted for red, blue or green.
- 3(d)7 marksWrite an algorithm that uses iteration to find the sum of all multiples of 4 and all multiples of 7 between m (inclusive) and n (inclusive) where m and n are two positive integers entered via the keyboard, assuming n >…
- 4(a)12 marksConstruct a flow chart to represent the given algorithm calculating commission based on numDays and numItemsSold.
- 4(b)3 marksGiven the input data line '3 2 1 5 7 4', determine what the provided algorithm would print. Show your working.
- 4(c)10 marksTrace through the execution of the provided algorithm and draw the output exactly as generated, noting the definitions of printSpaces, print, and println.
- 5(a)6 marksBriefly describe THREE stages of the program translation process.
- 5(b)7 marksWrite a C function which accepts a positive integer, n, and returns 2^n. State any assumptions made.
- 5(c)(i)7 marksWrite C code to store the even numbers from 2 (inclusive) to 40 (inclusive) in a file called "num.dat".
- 5(c)(ii)5 marksWrite C code to read the integers from the file "num.dat" created in (c)(i), add 5 to each integer and print the result on the screen.
- 6(a)6 marksExplain THREE ways in which good programming style can be maintained.
- 6(b)(i)2 marksWrite a declaration for a C struct productRec that can store the record for each product.
- 6(b)(ii)1 markDeclare TWO variables, item1 and item2, that have the record structure declared in (b)(i).
- 6(b)(iii)2 marksWrite C code to put data in the item1 struct declared in (b)(ii) using any values.
- 6(b)(iv)3 marksAssuming two productRec structs, item3 and item4, are already loaded with data, write C code to exchange their values.
- 6(c)11 marksWrite C code to read a 7-character uppercase string into a character array, print each vowel present in the string (or 'NO VOWELS' if none are present), and count and print the number of occurrences of the letter 'A'.