0% found this document useful (0 votes)
58 views26 pages

CompSci U1 P2 2019

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
58 views26 pages

CompSci U1 P2 2019

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 26
fe 6 rest cope 02115020 | FORM TP 2019182 MAY/UNE 2019 CARIBBEAN EXAMINATIONS COUNCIL CARIBBEAN ADVANCED PROFICIENCY EXAMINATION® COMPUTER SCIENCE FUNDAMENTALS OF COMPUTER SCIENCE, | UNIT 1 —Paper 02 2 hours 30 minutes READ THE FOLLOWING INSTRUCTIONS CAREFULLY. 1. This paper consists of SIX questions. Answer ALL questions. 2. — Write your answers in the spaces provided in this booklet. 3. Do NOT write in the margins. 4, If you need to rewrite any answer and there is not enough space to do so on the original page, you must use the extra lined page(s) provided at the back of this booklet. Remember to draw a line through your original answer, 5. Ifyou use the extra page(s) you MUST write the question number clearly in the box provided at the top of the extra page(s) and, where relevant, include the question part beside the answer. DO NOT TURN THIS PAGE UNTIL YOU ARE TOLD TO DO SO, Copyright © 2018 Caribbean Examinations Council All rights reserved. SECTION A COMPUTER ARCHITECTURE AND ORGANIZATION Answer BOTH questions. 1. @)_~—@_ Construct the truth table for the cireuit in Figure 1. List ALL possible input bit patterns and corresponding outputs, annals i Output peel Figure 1. Cireuit [5 marks] GO ON TO THE NEXT PAGE, 02115020/MJ/CAPE 2019 SAE MBURARAGUERRAS PRU PARSER SER | iz fae “| (ii) Write the logic expression that represents the operation of the circuit in Figure 1. (2 marks] Gili) Draw a diagram of a circuit that can accept two binary inputs referred to as X and Y. The circuit should represent the propositional logie for (NOT X) OR (NOT Y). _DONOT WRITE IN THIS AREA DONOT WRITE IN THIS AREA [5 marks] DO NOE WRITE IN THES AREA GO ON TO THE NEXT PAGE, 02115020/MJ/CAPE 2019 5 (>) Describe the funetion of the following components, giving an example of the use of EACH in modern computer systems. ()— Multiplexor (i) Decoder [2 marks] | shah Aah sa moos GO ON TO THE NEXT PAGE, (02115020/MJ/CAPE 2019 pe | DO NOT WRITE IN THIS AREA, DO.NOT WRITE IN THIS AREA DONOT WRITE IN THIS AREA r 7 7 (©) Describe, with the aid of a block diagram, how a 2-4 line decoder can be applied within a centralized gate opener system that manages four gates of an apartment complex. The system should allow each’of the four tenants to open his/her own gate, [5 marks} GO ON TO THE NEXT PAGE, 02115020/MINCAPE 2019 lai a (@)__ Describe how the program counter register is useful while a computer program is exec! a series of steps. [4 marks} Total 25 marks GO ON TO THE NEXT PAGE, 02115020/MJ/CAPE 2019 DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA * 1 2. (@)_~—()_State ONE reason why two’s complement representation is considered more suitable to represent integers in modern computers than sign and magnitude and ‘one’s complement. {1 mark] Gi) State the range of numbers that can be represented by using two’s complement format with 16 bits. [2 marks} Gii)__Detive the two's complement representation of the decimal value -75. Show all working at each stage in the conversion [3 marks] GO ON TO THE NEXT PAGE, 02115020/MJ/CAPE 2019 Cs -10- aa (b) The sequence 01010101 represents a simplified floating point number format with a 1-bit sign, 3-bit exponent and 4-bit mantissa, In the simplified format, the smallest value in the ‘mantissa is 0, and the Binary point is situated immediately to the left of the mantissa. Write the decimal value that 01010101 represents. Show all working. [5 marks} a aT GO ON TO THE NEXT PAGE 02115020/MVCAPE 2019 DO NOT WRITE IN THISAREA ‘DO NOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA T ek © microprocessors: | + Memory Address Register (MAR) 5 State the function of EACH of the following registers that are commonly found in + Memory Data Register (MDR) + Instruction Register (IR) [1 mark] [1 mark] 02115020/MJ/CAPE 2019 [6 marks] GO ON TO THE NEXT PAGE r “es 1 @_ @__ Explain how cache memory can increase the speed of a computer system. [3 marks] (i) Briefly outline ONE situation where cache memory does not help to speed up a computer. TE ea [2 marks} Total 25 marks GO ON TO THE NEXT PAGE 02115020/MJ/CAPE 2019 DO NOT WRITE IN THIS AREA DO NOT WRITE IN THISAREA DO NOT WRITE IN THIS AREA 3. (a) (b) -B- “| SECTION B PROBLEM-SOLVING WITH COMPUTERS Answer BOTH questions, List THREE properties of a well-designed algorithm, [3 marks} ‘Write an algorithm that accepts an integer and then prints all multiples of 7 that are less than the accepted integer. You may assume the existence of a function named mod, which accepts two arguments, and returns the remainder when the first argument is divided by the second. [6 marks} GO ON TO THE NEXT PAGE (02115020/MJ/CAPE 2019 r “m 7 (© Consider the following algorithm where b, x and Result are integers. Read b Read x If (<0) or (x <0) Result else Result = While (x> 0) begin Result = Result * b; xex-1 end Print Result GO ON TO THE NEXT PAGE, 02115020/MI/CAPE 2019 DONOT WRITE IN THIS AREA DONOT WRITE IN THIS AREA DO NOT WRITE IN THIS AREA | fee = 15+ @_—__Drawa flowchart that shows the algorithm, 02115020/MI/CAPE 2019 [10 marks} GO ON TO THE NEXT PAGE 7 “6 1 Gi) Write the value that is printed if =3.and x=3 at the start of the algorithm, [1 mark] Write the value that is printed if b= 3 and x = 0 at the start of the algorithm. ‘lL mark] (d)___Aconstruction company sells equipment and wishes to aequire software to track purchases, customer information and the quantity of construction equipment in stock. ‘The company has contracted the services of a software company that writes software applications. Briefly describe any TWO stages that the software company should follow when ereating the software for the construction company. “ld marks] ‘Total 25 marks | : | GO ON TO THE NEXT PAGE, 02115020/MJ/CAPE 2019 ‘DO NOT WRITE IN THIS AREA DO NOT WRITEIN THis AREA DO NOT WRITE INTHISAREA | i “m 7 (@) Define EACH of the following terms: (i) Selection structure Tt mark] eration structure [1 mark] Gil) Funetion [1 mark] (b) [B marks] GO ON TO THE NEXT PAGE (02115020/MJ/CAPE 2019 i -18- 7 (©) Consider the function print which has been written using C, void print (int numstars) { int row, i iH0; row=; while (row <= numstars) { i-0; while (i <(numstars —row)/2) t printt#"); it; 3 while (i < row) { printg(“*"); ies < (oumstars — rowy/2) print); rowst; printi(in"); 3 } GO ON TO THE NEXT PAGE, 02115020/M/CAPE 2019 rs DONOTWRITEIN THIS AREA DO NOT WRITE IN THIS AREA DO NOL WRTEIN THIS REL fF “ 7 (Draw the output expected when print(S) is executed. [5 marks] GO ON TO THE NEXT PAGE 02115020/MJ/CAPE 2019 =20- 5 Gi) Rewrite the function print using for statements instead of while statements, 02115020/MNCAPE 2019 GO ON TO THE NEXT PAGE. (| DONOT WRITE IN THIS AREA ape DONOT WRITE IN THIS AREA SiR) BO NOT WRITE INT E a . ()___ The factorial ofa positive integer is defined as the product of all integers between itself and 1, and the factorial of | is,1. Write a function named faet that accepts an integer argument 1 and returns the factorial. As examples, . fact(1) should return 1, . fact(3) should evaluate 3x 2 * 1 and return 6, and . fact(5) should evaluate 5x 4 x3 x 2x | and return 120 18 marks] Total 25 marks GO ON TO THE NEXT PAGE, 02115020/MJ/CAPE 2019 5. @ a, Gi) =22- at SECTION C PROGRAMMING ‘Answer BOTH questions. Define the term ‘debugging’ [1 mark} State how EACH of the following can be used to create maintainable code: Indentation Comments Descriptive variable names [B marks} GO ON TO THE NEXT PAGE. 02115020/MJ/CAPE 2019 r 2. a (©) Write a set of € program statements that allow a user to enter timings for a traifie light Until all entered values are valid. Timing values to be entered for the number of seconds the light is red, green and orange are referred to as redTime, greenTime and orangeTime respectively. Validity rules for entered timings are as follows: : 5 : 5 3 + redTime must not be less than the sum of the greenTime and orangeTime. + orangeTime must not be less than five seconds reenTime must be greater than 4 multiplied by the orangeTime If timings are valid, the program should output “Timings are valid”, and exit. I timings are not valid, the program should output “Invalid timings : Please re-enter”, and accept a new set.of values. ag “DO NOT WRITE IN THIS (REA THISAREA iN NOT WRITE I [12 marks} GO ON TO THE NEXT PAGE, 02115020/MI/CAPE 2019 r a 1 (©) Consider the following code segment. » 1%” 5 printf(\n); (i) Identify the THREE syntax errors in the segment. Deseribe the error and rewrite the line correctly. “To marks} (ii) Write the expected output ofthe program after the syntax errors have been corrected. {3 marks] Total 25 marks GO ON TO THE NEXT PAGE, 02115020/MJ/CAPE 2019 DONOT WRITE IN THIS 4REA DO NOT WRITE IN THISAREA | a 6. (@) Briefly describe the characteristics of EACH of the following programming paradigms: (Declarative [2 marks] Gi) Procedural Gil) Scripting [2 marks} (b) State TWO reasons why using modular code is considered good programming practice, GO ON TO THE NEXT PAGE, 02115020/MI/CAPE 2019 (©) @_ Whatis a function prototype in C? [1 mark} \Wrtea function named ealeTotal that accepts two integer arguments, and returns the sum of the first argument added to a 20% increase of the second, In other words, ealeTotal accepts first and second, and returns first + 1.2 * second. GO ON TO THE NEXT PAGE, 02115020/MNCAPE 2019 r 2 a Gil) A local court system is implementing a file access program for civil cases. ‘The to allow the recording of specific information for objective of the, system reporting on a summary of recorded information. Four items of information per case are to be recorded, namely the name of the complainant, the loss suffered, the name of the accused and the court fees. Court fees attract a 20% tax. All / names consist of a first name and a last name. The final line of the file contains a hashtag for the complainant's name. A sample of the file is shown below. Note that if the ease is thrown out of court, the loss and fees are both set to zero. DO NOT WRITE IN THIS AREA John Publie 200 Jill Yardly 20 Alice Wonderland 50 Bob Sky 10 Trouble Maker 0 Innocent One 0 ¥ Use C code to write a function that loops through the file and reads the loss suffered and court fees for each record, then prints the total cost payable by EACH of the accused persons. Use the function ealeTotal in your solu ‘DONOT Weare IN THIS AREA | GO ON TO THE NEXT PAGE, z 02115020/MI/CAPE 2019 -28- 7 t Total 25 marks marks} END OF TEST IF YOU FINISH BEFORE TIME IS CALLED, CHECK YOUR WORK ON THIS TEST. 02115020/MI/CAPE 2019

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy