Documente Academic
Documente Profesional
Documente Cultură
Paper 01
1 hour 30 minutes
1. This test consists of 45 items. You will have 1 hour and 30 minutes to answer them.
3. Do not be concerned that the answer sheet provides spaces for more answers than there are items
in this test.
4. Each item in this test has four suggested answers lettered (A), (B), (C), (D). Read each item
you are about to answer and decide which choice is best.
5. On your answer sheet, find the number which corresponds to your item and shade the space
having the same letter as the answer you have chosen. Look at the sample item below.
Sample Item
(A) 1
(B) 2
(C) 3
(D) 8
The best answer to this item is "3", so answer (C) has been shaded.
6. If you want to change your answer, erase it completely before you fill in your new choice.
7. When you are told to begin, turn the page and work as quickly and as carefully as you can. If
you cannot answer an item, go on to the next one. You may return to this item later. Your score
will be the total number of correct answers.
--
iiiiiii
9. Figures are not necessarily drawn to scale.
1. What is the longest integer that can be 5. What is the purpose of the fetch part of the
represented in 4-bit sign magnitude? fetch-decode-execute cycle in a computer?
(A) Greater response time 7. The range of instructions that a computer can
(B) Larger storage capacity execute is known as the
(C) Less volatility
(D) Ability to remove the storage (A) instruction set
medium from the machine for (B) instruction size
archival purposes (C) executable instructions
(D) word size
9. Which of the following about Read Only Items 12-13 refer to the following component.
Memory (ROM) is/are correct?
(A) ALU
I. It is volatile. (B) cu'
II. It is mounted on the mother board. (C) Registers
III. It may hold instructions for booting (D) RAM
up a computer.
Match EACH item below with ONE of the
(A) I only components above. Each option may be
(B) II only used once, more than once, or not at all.
(C) II and III only
(D) I, II and III 12. Which of the components handles statements
like "If x < 0"?
Item 15 refers to the following program Item 18 refers to the following flowchart
segment written in low-level instructions. symbol.
21. Which of the following represent(s) the Items 24-25 are based on the algorithm
properties of a well-designed algorithm? below.
22. for (i = 0; i < n; ++ i) 25. What is the output when the algorithm is
executed with the following input values?
23. arr[j] = arr[j] + 3
45,56, 79, 84,-1, 76,31
(A) 4, 266, 64
(B) 5, 371, 92
(C) 4,264,66
(D) 5, 370, 93
Item 26 refers to the following algorithms. Item 29 refers to the following algorithm
written in pseudocode.
ALGORITHM ALGORITHM ALGORITHM
I II III set number to 1
X=2 X=2 X=2 set counter to 20
FOR i = 1 to 500 REPEAT WHILEX>75 do
if number% 2 == 1
X=X+ 1 X=X+ 1 X =X+ 1 print number
END FOR UNTIL X= 75 END WHILE
end if
increment number by 2
26. If the algorithms were to be arranged such that while number <= counter
the values of X are in ascending order after
completion, then the order of the algorithms NB x % y is the remainder when x is
will be
divided by y.
(A) I, II, III 29. Which of the following will be printed by the
(B) I, III, II pseudocode above?
(C) III, I, II
(D) III, II, I (A) 3 5 7 9 11 13 15 17 19
(B) 3 5 7 9 11 13 15 17 19 21
(C) 1 3 5 7 9 11 13 15 17 19 21
Items 27-28 refer to the following algorithm. (D) 1 3 5 7 9 11 13 15 17 19
num= 1
30. Consider the following three algorithms
n=O
which will print a sequence of numbers.
WHILEn< 5 do
num=num+n l. X= 4
n=n+2 while (x < 5) do
PRINTnum print the value of x
END WHILE x=x+1
end while
27. What is the output produced by the algorithm?
II. X= 3
(A) 2 3 while (x < 4) do
(B) 1 2 4 x=x+l
(C) 1 3 7 print the value of x
(D) 1 3 5 end while
III. X= 4
28. What is the output produced by the algorithm repeat
if n is initialised to 1 and num is initialised print the value of x
to 5? x=x+l
31. Which of the following criteria should 34. Which of the following statements is/are
be considered when choosing a suitable TRUE about indentation?
programming language?
I. Indentation is a requirement of most
I. The nature of the application programming languages.
II. The availability of a suitable II. Every indent in a single program
compiler/interpreter must be of the same size.
III. The expertise of the programmers III. Indentation enhances the readability
of a program.
(A) I only IV. Poor indentation is a type of semantic
(B) I and II only error.
(C) II and III only
(D) I, II and III (A) III only
(B) II and III only
(C) II, III and IV only
32. A programming paradigm that models real (D) I, II, III and IV
world entities with attributes and behaviours
IS
Item 35 refers to the following lines of code.
(A) procedural
(B) functional int 1Osum, sum, i;
(C) object-oriented sum= 10;
(D) scripting lOsum = 0;
for (i = 9; i > 0; i - -)
{
33. To execute a computer program written in a sum= sum+ i;
high-level language it must be converted into lOsum = 10sum + 10;
}
(A) object code printf ("The sum is %d", i);
(B) source code
(C) assembly language 35. Which of the following identifies a syntax
(D) machine language error in the code?
36. Which of the following code segments reads 37. What is the correct order of the compilation
5 integers into an array? process for the stages listed below?
(B) int main ( ){ (A) I ----+ IV ----+ II ----+ III ----+ IV ----+ VI
int num, arr [5]; (B) I ----+ V ----+ III ----+ II ---+ IV ----+ VI
for (num = 4; num >= 0; num--) { (C) V ~ I ----+ III ----+ II ---+ IV ----+ VI
printf ("Please enter a #"); (D) V ---+ II ----+ III ---+ I ----+ IV ----+ VI
scanf ("%d", &arr [num]);
}
Item 38 refers to the following lines of code.
return 0;
}
inti, sum;
sum= 5;
(C) int main ( ) {
for (i = 4; i > 1; i--)
int num = 5, arr [5];
sum= sum+ i;
while (num <= 5) {
printf ("sum is %d", sum);
printf ("Please enter a#");
scanf ("%d", &arr [num]);
38. What is the output generated when the lines
num++;
of code are executed?
}
return 0;
(A) Sum is 5
}
(B) Sum is 14
(C) Sum is 15
(D) int main ( ) {
int num;
(D) Nothing is generated.
int arr;
for (num = 0; num < =5; num++) {
39. Typically, a variable that is declared in a
printf ("Please enter a #");
function is accessible
scanf ("%d", arr [num]);
}
(A) within the whole file
return 0;
}
(B) within the function and main ( )
only
(C) from the calling function
(D) within the function only
- 10-
Items 40-41 refer to the following array 42. The MAIN reason for the differences in the
and code segment where'%' is the modulus programming software for small mobile
operator. devices like mobile phones versus those for
desktop computers is that mobile devices
0 1 2 3 4 5 6
23 45 27 34 56 92 (A) are used more than desktop
computers.
inti; //Line 1 (B) have better programs than desktop
for(i=O;i<7;i=i+l) { //Line 2 computers.
int num = arr [i]; //Line 3 (C) have less memory and other
if(i% 2 = = 0) //Line 4 resources than desktop computers.
printf ( "%d", num); //Line 5 (D) have a larger screen for playing
games.
} //Line 6
40. What is printed by the code segment above 43. Which of the following translates the source
after it is executed?. code of a program, one line at a time?
41. What is printed by the code segment if 44. The name given to the variable x when
Line 4 is replaced with the line DEFINING the function, displayData (int x)
lS
if(number %2 != 0)
(A) formal parameter
(A) 34 56 92 (B) passed parameter
(B) 23 27 56 92 (C) actual parameter
(C) 23 45 27 1 (D) sent parameter
(D) 45 34 1
(A) Syntax
(B) Logic
(C) Run-time
(D) Omission error
ENDOFTEST
IF YOU FINISH BEFORE TIME IS CALLED, CHECK YOUR WORK ON THIS TEST.
02115010/CAPE 2013