Programming – IGCSE Computer Science (0478)

282 questions · page 19 of 19

0 / 0Answer a question to start your score.
Quick quiz (10)Saved 0
Advertisement
271
0478/22/O/N/16 · Question 3Oct/Nov 2016Paper 224 marks
Loading question…
Question text

The flowchart below inputs an integer. The predefined function DIV gives the value of the division,
3
for example Z ← 11 DIV 3 gives the value Z = 3. The predefined function MOD gives the value
of the remainder, for example Z ← 11 MOD 3 gives the value Z = 2.
67$57
,1387 ;
1R
Is X >
"
<HV
$
; ',9
287387 ;
%
; 02'
(1'
287387 %
;
$
Complete a trace table for each of the two input values 33 and 75.
Trace table for input value 33
X
A
B
OUTPUT
Trace table for input value 75
X
A
B
OUTPUT
[4]

272
0478/22/O/N/16 · Question 4Oct/Nov 2016Paper 226 marks
Loading question…
Question text

IF ... THEN ... ELSE ... ENDIF and CASE ... OF ... OTHERWISE ... ENDCASE
4
are two different conditional statements that you can use when writing pseudocode.
Explain, using examples, why you would choose to use each conditional statement.
Example 1 …
…
…
…
…
…
Reason for choice …
…
…
Example 2 …
…
…
…
…
…
Reason for choice …
…
… [6]
Question 5 begins on page 10.

273
0478/11/M/J/16 · Question 8May/June 2016Paper 115 marks
Loading question…
Question text

8
A bank offers an online service to its customers. The bank has developed a “SafeToUse” system
that asks each customer to enter four randomly chosen characters from their password each time
they log in.
The customer selects these four characters from drop-down boxes. For example:
2 nd character
Please select the
5 th character
6 th character
8 th character
(a) (i)
Explain why it is more secure to use drop-down boxes rather than entering characters
using a keyboard.
…
…
…
… [2]
(ii)
Give a reason why the system asks for four characters chosen at random.
…
… [1]
(b) Biometrics is an additional form of security.
Give two examples of biometrics.
1 …
2 …
[2]

Advertisement
274
0478/21/M/J/16 · Question 1May/June 2016Paper 2120 marks
Loading question…
Question text

1
(a) All variables, constants and other identifiers should have meaningful names.
(i)
For each of the variables that you have used to record dimensions of the parcels in Task 1,
state the name, type and its use.
Variable 1 name …
Type …
Use …
Variable 2 name …
Type …
Use …
Variable 3 name …
Type …
Use … [3]
(ii)
State two constants that you could have used for Task 1. Give the value that would be
assigned to each one.
Constant 1 name …
Value 1 …
Constant 2 name …
Value 2 … [2]
(b) Write an algorithm to complete Task 1, using either pseudocode, programming statements
or a flowchart.
…
…
…
…
…
…
…
…
…
…
…
…
…

275
0478/21/M/J/16 · Question 2May/June 2016Paper 216 marks
Loading question…
Question text

2
Read this section of program code that inputs 10 positive numbers and then outputs the smallest
number input.
1
Small = 1000
2
Counter = 0
3
REPEAT
4
INPUT Num
5
IF Num < Small THEN Small = Num
6
Counter = Counter + 1
7
UNTIL Counter = 10
8
PRINT Small
(i)
Identify three changes you would need to make to find the largest number input instead
of the smallest number.
1 …
…
2 …
…
3 …
… [3]
(ii)
Rewrite the program code with your changes.
…
…
…
…
…
…
…
… [3]

276
0478/21/M/J/16 · Question 3May/June 2016Paper 217 marks
Loading question…
Question text

3
A program will be written to store information about members of a swimming club.
The following membership details will be recorded:
•
Name
•
Gender
•
Status:
•
Senior
•
Junior
•
Fee
•
Team member (Yes or No)
(i)
Choose a suitable data type for each of the membership details to be recorded.
Membership details
Data type
Name
Gender
Status
Fee
Team member
[5]
(ii)
The swimming club has 50 members.
State the data structure that would be most suitable to use and give a reason for your
choice.
Data structure …
Reason …
… [2]

277
0478/21/M/J/16 · Question 5May/June 2016Paper 214 marks
Loading question…
Question text

REPEAT ... UNTIL is one type of loop structure.
5
Identify and describe two other types of loop structure that you could use when writing
pseudocode.
Loop structure 1 …
Description …
…
Loop structure 2 …
Description …
… [4]

278
0478/22/M/J/16 · Question 1May/June 2016Paper 2220 marks
Loading question…
Question text

1
(a) All variables, constants and other identifiers should have meaningful names.
(i)
For three of the variables that you have used in Task 2, state the name, type and its use.
Variable 1 name …
Type …
Use …
Variable 2 name …
Type …
Use …
Variable 3 name …
Type …
Use … [3]
(ii)
State three constants that you could have used for Task 1. Give the value that would be
assigned to each one.
Constant 1 name …
Value 1 …
Constant 2 name …
Value 2 …
Constant 3 name …
Value 3 … [3]
(b) Write an algorithm to complete Task 2, using either pseudocode, programming statements
or a flowchart. You can assume that the weight and contents have already been checked and
accepted in Task 1. You do not need to output the number of sacks rejected.
…
…
…
…
…
…
…
…
…
…

Advertisement
279
0478/22/M/J/16 · Question 2May/June 2016Paper 226 marks
Loading question…
Question text

2
Read this section of program code that inputs 10 positive numbers and then outputs the total.
1
Total = 0
2
Counter = 0
3
REPEAT
4
INPUT Num
5
Total = Total + Num
6
PRINT Total
7
Counter = Counter + 1
8
UNTIL Counter = 10
This code works, but it is inefficient.
(i)
Suggest three improvements that could be made.
1 …
…
2 …
…
3 …
… [3]
(ii) Rewrite the program code with your improvements.
…
…
…
…
…
…
…
…
…
… [3]

280
0478/22/M/J/16 · Question 4May/June 2016Paper 223 marks
Loading question…
Question text

4
Four statement types and four examples are shown below.
Draw a line to connect each statement type to the correct example.
Statement type
Example
1 TO 10
FOR X
Assignment
READ X
Iteration
PRINT X
Input
X
Y + Z
Output
[3]

281
0478/22/M/J/16 · Question 5May/June 2016Paper 222 marks
Loading question…
Question text

5
A programmer writes a program to store a patient’s temperature every hour for a day.
State the data structure that would be most suitable to use and give the reason for your choice.
Data structure …
Reason …
… [2]

282
0478/22/M/J/16 · Question 6May/June 2016Paper 222 marks
Loading question…
Question text

6
Identify two different selection statements that you can use when writing pseudocode.
1 …
…
2 …
… [2]
Question 7 begins on page 10.

Advertisement