You are on page 1of 11
ee. test cove 02115020 FORM TP 2015165 ‘a MAY/JUNE 2015 CARIBBEAN EXAMINATIONS COUNCIL CARIBBEAN ADVANCED PROFICIENCY EXAMINATION® COMPUTER SCIENCE FUNDAMENTALS OF COMPUTER SCIENCE UNIT 1 = Paper 02 2 hours 30 minutes 15 MAY 2015 (a.m.) READ THE FOLLOWING INSTRUCTIONS CAREFULLY. 1. This paper consists of THREE sections. 2. _ EACH section consists of TWO questions. 3. Answer ALL questions in the THREE sections. DO NOT TURN THIS PAGE UNTIL YOU ARE TOLD TO DO SO. Copyright © 2014 Caribbean Examinations Council Alll rights reserved. @) ) @) ee) @ SECTION A COMPUTER ARCHITECTURE AND ORGANIZATION Answer BOTH questions. Your friend Samuel Carter would like you to design a security alarm system for his house. The security alarm should sound if the alarm switch is enabled (turned on) and a window or door is opened. For example, if the alarm switch is enabled and a window is opened, the alarm should sound. (Write down the truth table (that is, list all possible input bit patterns and their corresponding outputs) for this scenario. [8 marks} (ii) Using only primary logic gates, design and draw the associated circuit. [4 marks} Explain what is meant by the term ‘demultiplexer’. [2 marks} Draw a clearly labelled block diagram of a 3-to-8 line decoder. [3 marks} Find the decimal equivalent of the hexadecimal number 1AS3. Show ALL working. B marks} Find the 8 bit two’s complement of -21. Show ALL working. [2 marks} Consider the following floating point representation: |-bit sign, 3-bit exponent, 5-bit mantissa Calculate the decimal representation of 001101011. Show ALL working, [3 marks] Total 25 marks GO ON TO THE NEXT PAGE 02115020/CAPE 2015 (b) (©) @ Describe TWO main functions of the CPU. Include in your description a definition of the cpu [6 marks] The following questions are related to the fetch-decode-execute cycle: (i) State the purpose of the ‘fetch’ operation. U1 mark] (ii) State the purpose of the ‘decode? and ‘execute? operations. (2 marks} i Define the term ‘instruction set’ [1 mark] ‘The following que: ns are related to memory. (i) How does ROM differ from RAM? [4 marks} (ii) Your friend is interested in purchasing a new computer. He is considering the following options: Option 1: Purchasing a large amount of cache and a small amount of RAM. Option 2: Purchasing a large amount of RAM and a small amount of eache. Advise your friend by explaining ONE advantage and ONE disadventage of EACH option. [4 marks} There are several registers found in the CPU. (i) What is the collective purpose of these registers? [1 mark] (i) Name THREE res rs found in the CPU and for EACH, describe its function. 16 marks] ‘Total 25 marks GO ON TO THE NEXT PAGE, 02115020/CAPE 2015 (b) SECTION B PROBLEM SOLVING WITH COMPUTERS Answer BOTH questions. Explain what happens during the ‘implementation and review’ phase of the problem-solving process. [4 marks] Examine the following algorithms labelled Algorithm 1 and Algorithm 2 and answer the questions that follow. Algorithm 1 FOR Y = 1 TO 20 DO PRINT ¥ END FOR Algorithm 2 READ Z SUML = 0 WRILE 2 > -1 DO SUM1 = SUM1 + 2 READ % END WHILE (Which of the algorithms above illustrates unbounded iteration? [1 mark] (ii) Which of the algorithms above illustrates bounded iteration? [1 mark] Explain how the loop in Algorithm 1 is expected to terminate. [2 marks} (iv) Explain how the loop in Algorithm 2 is expected to terminate, [2 marks] GO ON TO THE NEXT PAGE, 02115020/CAPE 2015 “5. (©The following algorithm is designed to print a table of cubes ofall the odd positive integers between 7 (inclusive) and 121 (inclusive). However, there are errors in the algorithm. 1. print (“odd Number Cube”! print “sews cube print j, cube; 7 geg- 8. end while By referring to the specific line number, identify and correct FOUR errors in the algorithm, 50 that it would achieve its objective [8 marks] (d) Write an algorithm that uses iteration to find the sum of all multiples of 8 and all multiples of 11 between m (inclusive) and n (exclusive) where m and m are two positive integers entered via the keyboard, Assume that n> m. {7 marks] ‘Total 25 marks GO ON TO THE NEXT PAGE, 0211S020/CAPE 2015 4, (@) Trace through the execution of the following algorithm and draw the output in your answer booklet exactly as it would be generated by the algorithm. You should carefully note the following: + writeSym(n) prints m ‘$’ from the current cursor position. Example: writeSym(2) would print 38 + write(1ist-1) continues output of List-1 on the current line, from the current cursor position, + writteln() terminates output on the current line. Subsequent output begins on a new line + writeln(1ist-1) continues output of List~1 on the current line from the current cursor position but any subsequent output begins on a new line. 021 1S020/CAPE 2015, SIZ = 12 j= sIze - 4 while 3 >=2 do writeSym(j + 2) writeln(‘#) g75-3 endwhile writeln(**') fork =1to +5) do write(‘'@’) writeln() [12 marks} GO ON TO THE NEXT PAGE 7+ (b) Construct a flowchart to represent the following algorithm, start print ‘enter ai! read a Set total to 1 while a > -1 do as2ta; if a < 20 then asa-i else asatl endif total = total +a print ‘Enter a:' read a enduhile print total stop 02115020/CAPE 2015 {13 marks} Total 25 marks GO ON TO THE NEXT PAGE, NOTHING HAS BEEN OMMITTED GO ON TO THE NEXT PAGE 021 15020/CAPE 2015 (b) (OF @) “9. SECTION C PROGRAMMING Answer BOTH questions. The translation process comprises several stages. (Describe the purpose of the lexical analysis stage of this translation process. [3 marks} Gi) Comment on the existence of error detection in this lexical analysis stage. [1 markq ‘What is modular programming and how does it encourage good programming practices? [2 marks] Every term Mr James creates a file containing student IDs and the final mark for each student in his Biology class. This term, Mr James would like to automatically determine the number of students gaining grades A, B, C and F, as well as the highest mark gained, He has asked you to write a C program to do this. ‘The file is formatted as follows, where 12238 represents a student ID and 50 represents the student mark, Input file: testgrades.tet Write aC program which would read in the contents of the file, tesigradles.txt, and output the number of students gaining the grades A, B, C and F and the highest mark gained. The grade categories are as follows: A=80 to 100 B=70t079 C= 60069 P<=59 [10 marks} A palindrome is a sequence of characters which give the same word when read in both directions. For example, madam. Write a C program which accepts a string from a user and determines whether the string is a palindrome or not. Assume that all letters are lower case. (9 marks} ‘Total 25 marks GO ON TO THE NEXT PAGE 02115020/CAPE 2015 = 10- 6. (@)_ Briefly describe EACH of the following types of programming languages: (Declarative [2 marks} (ii) Imperative (procedural) (2 marks} (iii) Scripting [2 marks} (b) What output ig produced by the following C program? #include int main () (int #, i = 2, 3 = while (i ieg-3 for (x = 47 x >= 0; x= x - 2) ( printf("x is &d j is td i is $d\n,x, 3, i)7 final = final + (4 - 1) * (3-2)7 } //for print£("New i = 8d”, i}; Lsi+3; }//ubile print£(°\nFinal Output: $d\n”, final); return 0; }//main 19 marks] GO ON TO THE NEXT PAGE 02115020/CAPE 2015

You might also like