You are on page 1of 7

TEST CODE 02115020

FORM TP 2011163 MAY/JUNE 2011

CARIBBEAN E XAM I NAT I O N S COUNCIL

ADVANCED PROFICIENCY EXAMINATION


COMPUTER SCIENCE
UNIT 1: FUNDAMENTALS OF COMPUTER SCIENCE

PAPER 02
2½ hours

13 MAY 2011 (a.m.)

This examination paper consists of THREE sections: Computer Architecture and Organisation,
Problem Solving with Computers and Programming.

Each section consists of 2 questions


The maximum mark for each section is 50.
The maximum mark for this examination is 150.
This examination consists of 7 printed pages.

INSTRUCTIONS TO CANDIDATES

1. Do NOT open this examination paper until instructed to do so.

2. Answer ALL questions from the THREE sections.

Copyright © 2009 Caribbean Examinations Council.


All rights reserved.
02115020/CAPE 2011
- 2-

SECTION A

COMPUTER ARCHITECTURE AND ORGANISATION

Answer BOTH questions.

1. (a) The following is the truth table of a certain circuit:

x y z
0 0 1
0 1 1
1 0 0
1 1 0

Using only primary logic gates, design and draw the circuit. [ 6 marks]

(b) Write down the truth table (i.e. list all possible input bit patterns and their corresponding
outputs) for the circuit in Figure 1.
p
q

Figure 1
[ 4 marks]

(c) Explain what is meant by the terms:

   L  )OLSÀRS [ 2 marks]

(ii) Multiplexor [ 2 marks]

GO ON TO THE NEXT PAGE


02115020/CAPE 2011
- 3-

(d) (i) Draw a clearly labelled block diagram of a 2-to-4 line decoder. [ 3 marks]

(ii) A circuit is required for a television game show. The circuit must control four
light bulbs, B1, B2, B3, and B4. Only ONE of the light bulbs can be on at any
time.

State how a 2-to-4 line decoder can be used in the circuit and explain how the
bulbs are switched on. [ 3 marks]

(e) Find the 4–bit two’s complement of – 6. [ 2 marks]

 I  &RQVLGHUWKHIROORZLQJÀRDWLQJSRLQWUHSUHVHQWDWLRQ
1–bit sign, 3–bit exponent, 5– mantissa.
Calculate the decimal representation of 0 0 1 0 0 0 1 0 1 .
(Show all working.) [ 3 marks]

Total 25 marks

2. (a) Name and state the function of THREE registers found in the Central Processing Unit
(CPU). [ 6 marks]

(b) Compare main memory and TWO storage devices in terms of capacity and access speed.
[ 6 marks]

(c) Besides registers, name TWO other components in the CPU and state the function of
EACH. [ 4 marks]

 G  'H¿QH WKH WHUP µFDFKH PHPRU\¶ DQG H[SODLQ KRZ LW LQFUHDVHV WKH HI¿FLHQF\ RI GDWD
retrieval. [ 4 marks]

 H   L  6WDWHZKDWLVDQµLQVWUXFWLRQIRUPDW¶ [ 1 mark ]

(ii) Name and describe TWO addressing modes. [ 4 marks]

Total 25 marks

GO ON TO THE NEXT PAGE


02115020/CAPE 2011
- 4-

SECTION B

PROBLEM SOLVING WITH COMPUTERS


Answer BOTH questions.

3. (a) Describe any THREE stages in the problem solving process. [ 6 marks]
 E  7KHDOJRULWKPEHORZ¿QGVWKHDYHUDJHDJHRIDVHWRIVWXGHQWV&RQVWUXFWDÀRZFKDUW
to represent the algorithm.

Algorithm

AverageAge
Sum = 0
Counter = 0
Read Age
While Age ! = 0
Sum = Sum + Age
Counter = Counter + 1
Read Age
End while
Average = Sum/Counter
Print Average
End

[11 marks]

(c) The algorithm below is designed to print a table of squares of all the even numbers
between 1 and 100 (inclusive). However, there are errors in the algorithm.

1. j=1
2. while j < 100
3. print “Even Number Square”
4. print “========== =====”
5. j * j = square
6. print j, square
7. end while

  %\UHIHUULQJWRWKHVSHFL¿FOLQHQXPEHUidentify and correct the errors in the algorithm


so that it will achieve its objective. [ 8 marks]

Total 25 marks

GO ON TO THE NEXT PAGE


02115020/CAPE 2011
- 5-

4. (a) State THREE properties of a well-designed algorithm. [ 3 marks]

(b) 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:

  ‡ printSpaces(n) prints nVSDFHVIURPWKHFXUUHQWFXUVRUSRVLWLRQXVHDGDVKµ¶WR


indicate a space in your answer booklet.

  ‡ print() continues output on the current line from the current cursor position.

  ‡ println() continues output on the current line from the current cursor position
but any subsequent output begins on a new line

SIZE = 10
begin

i = SIZE - 1
while (i > 0) {
printSpaces (i)
print ("*")
y = (SIZE - i - 1) * 2
printSpaces (y)
println ("*")
i=i-1
}

for (i=1; i<=2*SIZE; i=i+1)


print ("*")

println()

end
[11 marks]

(c) (i) Write an algorithm that uses iteration to print the sum of ALL multiples of 11
(integers) between 0 and 5 000, inclusive. [ 8 marks]

  LL  ,QGLFDWHZKHWKHUµERXQGHG¶RUµXQERXQGHG¶LWHUDWLRQZDVXVHGLQ\RXUUHVSRQVH
for 4 (c) (i) and state ONE reason for its use. [ 3 marks]

Total 25 marks

GO ON TO THE NEXT PAGE


02115020/CAPE 2011
- 6-

SECTION C

PROGRAMMING

Answer BOTH questions.

5. (a) Apart from intermediate code generation, list TWO other stages of the translation
process. [ 2 marks]

(b) Give TWO advantages of using a modular approach in programming. [ 2 marks]

(c) Write a C function which accepts an integer array and an integer variable indicating the
size of the array. The function should return the sum of all the numbers in the array that
are NOT greater than 100. [ 6 marks]

(d) A gym is having a contest. Members are asked to guess the number of jellybeans in
a jar. The winner is the member who accurately guesses the number of jellybeans or
whose guess is closest to this value without going over.

  $OOWKHLQIRUPDWLRQUHODWHGWRWKHFRQWHVWLVVWRUHGLQD¿OHµFRQWHVWW[W¶7KH¿UVWOLQHRI
WKH¿OHJLYHVWKDWDFWXDOQXPEHURIMHOO\EHDQVLQWKHMDU(DFKOLQHWKHUHDIWHUFRQWDLQV
WKHJXHVVRIDPHPEHUIROORZHGE\KLVKHUPHPEHULGHQWL¿FDWLRQFRGH ZKLFKLVDIRXU
digit integer). Data is terminated by – 1 (which appears on a line by itself).

  :ULWHD&SURJUDPWKDWGHWHUPLQHVDQGRXWSXWVWRD¿OH³ZLQQHUW[W´WKHZLQQLQJJXHVV
DQGWKHZLQQHU¶VLGHQWL¿FDWLRQFRGH

You may assume all guesses are unique and a winner exists. You may not use arrays in
your solution. [15 marks]

Total 25 marks

GO ON TO THE NEXT PAGE


02115020/CAPE 2011
-7-

6. D  ([SODLQWKHWHUPµZKLWHVSDFH¶ [ 2 marks]

 E  'H¿QHWKHWHUPµGHEXJJLQJ¶ [ 2 marks]

(c) Explain why programmers should practise proper indentation. [ 2 marks]

(d) For any THREE integer values the following rules apply:

– The values cannot be the sides of a triangle if any value is 0 or negative and, if
any value is greater than the sum of the other two.

– The values can represent the sides of an equilateral triangle if all the values are
equal.

– The values can represent the sides of an isosceles triangle if two values are equal.

– The values can represent the sides of a scalene triangle if all the values are
different.

Write a C program that prompts the user for THREE integers and prints to the standard
output what triangle is represented. If no triangle is represented print “No triangle is
represented.” [11 marks]

(e) (i) In your answer booklet show the output generated by the following segment of
code.

int i, j;

for (i = 1 ; i < 5; i++)


{
for (j = 1 ; j < = 5 ; j++)
{
print (“%d”, i);
}
print (“\n”);
} [ 4 marks]

(ii) Modify the code in e (i) so that the following output is generated.

1 2 3 4 5
2 3 4 5
3 4 5
4 5

5 [ 4 marks]

Total 25 marks

END OF TEST

02115010/CAPE 2011

You might also like