CAPE Computer Science Unit 1 · 2015 · Paper 2
38 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)8 marksWrite down the truth table showing all possible input bit combinations and outputs for the alarm scenario.
- 1(a)(ii)4 marksUsing only primary logic gates, design and draw the circuit for the alarm system.
- 1(b)2 marksExplain the meaning of the term 'demultiplexer'.
- 1(c)3 marksDraw a clearly labelled block diagram of a 3-to-8 line decoder.
- 1(d)3 marksDetermine the decimal equivalent of the hexadecimal number 1A53, showing all working.
- 1(e)2 marksFind the 8-bit two's complement of -21, showing all working.
- 1(f)3 marksGiven a floating-point format of 1-bit sign, 3-bit exponent, and 5-bit mantissa, calculate the decimal representation of 001101011, showing all working.
- 2(a)6 marksDescribe TWO primary functions of the CPU, including a definition of the CPU in your description.
- 2(b)(i)1 markState the purpose of the 'fetch' operation.
- 2(b)(ii)2 marksState the purpose of the 'decode' and 'execute' operations.
- 2(b)(iii)1 markDefine the term 'instruction set'.
- 2(c)(i)4 marksExplain how ROM differs from RAM.
- 2(c)(ii)4 marksExplain ONE advantage and ONE disadvantage for each of the two purchasing options: Option 1 (large cache, small RAM) and Option 2 (large RAM, small cache).
- 2(d)(i)1 markState the collective purpose of CPU registers.
- 2(d)(ii)6 marksName THREE CPU registers and describe the function of each.
- 3(a)4 marksExplain what takes place during the 'implementation and review' stage of problem-solving.
- 3(b)(i)1 markIdentify which of the two algorithms illustrates unbounded iteration.
- 3(b)(ii)1 markIdentify which of the two algorithms illustrates bounded iteration.
- 3(b)(iii)2 marksExplain how the loop in Algorithm 1 is expected to terminate.
- 3(b)(iv)2 marksExplain how the loop in Algorithm 2 is expected to terminate.
- 3(c)8 marksIdentify and correct FOUR errors in the algorithm by referencing their specific line numbers.
- 3(d)7 marksWrite an algorithm using iteration to calculate the sum of all multiples of 8 and all multiples of 11 between m (inclusive) and n (exclusive), where m and n are positive integers input by the user and n > m.
- 4(a)12 marksTrace the execution of the provided pseudocode algorithm and display the exact output generated.
- 4(b)13 marksConstruct a flowchart representing the given looping and branching algorithm.
- 5(a)(i)3 marksDescribe the purpose of the lexical analysis stage in translation.
- 5(a)(ii)1 markComment on whether error detection exists during the lexical analysis stage.
- 5(b)2 marksExplain what modular programming is and how it promotes good programming practices.
- 5(c)10 marksWrite a C program that reads 'testgrades.txt' to count and display the number of students receiving grades A (80-100), B (70-79), C (60-69), and F (<=59), along with the highest overall mark.
- 5(d)9 marksWrite a C program that takes a lowercase string from the user and checks whether it is a palindrome.
- 6(a)(i)2 marksBriefly describe the declarative programming paradigm.
- 6(a)(ii)2 marksBriefly describe the imperative (procedural) programming paradigm.
- 6(a)(iii)2 marksBriefly describe scripting languages.
- 6(b)9 marksDetermine the exact output produced by the given C program.
- 6(c)(i)2 marksWrite a declaration for a C struct fruitRec to store a fruit's ID (int), cost price (float), selling price (float), and quantity in stock (int).
- 6(c)(ii)1 markDeclare two variables, apple and pear, of type struct fruitRec.
- 6(c)(iii)2 marksWrite C code to populate the apple struct variable with sample data.
- 6(c)(iv)2 marksAssuming two fruitRec variables pine and mango are populated, write C code to swap their cost price and selling price values.
- 6(c)(v)3 marksAssuming two fruitRec variables a and b are populated, write C code to compute and display the total expected profit from selling both fruits.