Programming – IGCSE Computer Science (0478)

270 questions · page 15 of 18 · Clear filters

0 / 0Answer a question to start your score.
Quick quiz (10)Saved 0
Advertisement
211
0478/22/M/J/19 · Question 2May/June 2019Paper 228 marks
Loading question…
Question text

2
(a) An algorithm has been written in pseudocode to input 100 numbers, select and print the
largest number and smallest number.
1
Count
INPUT Number
Number
High
Count
Low
REPEAT
INPUT Number
IF Number > High
THEN
Number
High
ENDIF
IF Number > Low
THEN
Number
Low
ENDIF
Count + 1
Count
UNTIL Count > 99
PRINT "Largest Number is ", Number
PRINT "Smallest Number is ", Low
Find the four errors in the pseudocode and suggest a correction for each error.
Error 1 …
Correction …
…
Error 2 …
Correction …
…
Error 3 …
Correction …
…
Error 4 …
Correction …
…
[4]
(b) Show how you would change the corrected algorithm to total the numbers and print the total.
Use a variable Total.
…
…
…
…
…
…
…
… [4]

212
0478/22/M/J/19 · Question 4May/June 2019Paper 224 marks
Loading question…
Question text

4
For each of the four groups of statements in the table, place a tick in the correct column to show
whether it is an example of Selection or Repetition.
Statements
Selection
Repetition
FOR A
1 TO 100
B + 1
B
NEXT A
CASE A OF
100: B
A
A
200: C
ENDCASE
IF A > 100
THEN
A
B
ENDIF
REPEAT
A
B * 10
UNTIL A > 100
[4]

213
0478/23/M/J/19 · Question 1May/June 2019Paper 2320 marks
Loading question…
Question text

1
(a) All variables, constants and other identifiers must have meaningful names.
Describe the data structures you have used in Task 1 to record the items available that day.
Include some sample data for each data structure you have described.
…
…
…
…
…
…
…
…
…
… [5]
(b) Explain how your program for Task 1 ensures all the item codes are different.
…
…
…
… [2]
(c) Explain how your program for Task 2 highlights items where the stock level is low.
…
…
…
…
…
… [3]
(d) Write an algorithm for Task 2 using either pseudocode, programming statements or a
flowchart. Assume that Task 1 has been completed and the list of items currently available
has already been displayed.
…
…
…

Advertisement
214
0478/23/M/J/19 · Question 2May/June 2019Paper 238 marks
Loading question…
Question text

2
(a) An algorithm has been written in pseudocode to input the weight of 500 items and reject any
that are over-weight or under-weight, then print the percentage rejected.
1
Count
0
Reject
62
Over
58
Under
REPEAT
INPUT ItemWeight
IF ItemWeight > Over AND ItemWeight < Under
THEN
Reject - 1
Reject
ENDIF
Count + 1
Count
UNTIL Count > = 500
Reject / 100
Reject
PRINT "Percentage rejected is ", Reject
Find the four errors in the pseudocode and suggest a correction for each error.
Error 1 …
…
Correction …
…
Error 2 …
…
Correction …
…
Error 3 …
…
Correction …
…
Error 4 …
…
Correction …
…
[4]
(b) Describe how you would change the corrected algorithm to calculate the number accepted
instead of rejected, using a variable Accept, and print a warning if fewer than 50% are
accepted.
…
…
…
…
…
…
…

215
0478/22/F/M/19 · Question 1Feb/March 2019Paper 2220 marks
Loading question…
Question text

1
(a) All variables, constants and other identifiers should have meaningful names.
State one constant and one variable that you could have used for Task 1. Give the value that
would be assigned to the constant. Give the data type for the variable. Explain what each one
could be used for.
Constant name …
Value …
Use …
…
Variable name …
Data type …
Use …
…
[6]
(b) Explain how you would need to change your program for Task 1 if there were three bases to
choose from (thick, thin and extra crispy).
…
…
…
… [2]
(c) (i)
Write an algorithm for choosing the additional toppings in Task 1, using either
pseudocode, programming statements or a flowchart. Your algorithm must only include
this part of Task 1.
…
…
…
…
…
…
…
…
…
…
…
…

216
0478/22/F/M/19 · Question 2Feb/March 2019Paper 226 marks
Loading question…
Question text

2
(a) An algorithm has been written in pseudocode to input 50 numbers and total only the positive
numbers.
←
1
Count
←
Count
Total
REPEAT
INPUT Number
IF Number <> 0
THEN
←
Total + Count
Total
ENDIF
←
Count + 1
Count
UNTIL Count < 50
PRINT Total
Find the four errors in the pseudocode and suggest a correction for each error.
Error 1 …
Correction …
…
Error 2 …
Correction …
…
Error 3 …
Correction …
…
Error 4 …
Correction …
…
[4]
(b) Show how you would change the corrected algorithm to only total numbers greater than 0
and less than 20.
…
…
… [2]
Question 3 starts on page 10.

217
0478/22/F/M/19 · Question 4Feb/March 2019Paper 224 marks
Loading question…
Question text

4
For each of the four groups of statements in the table, place a tick in the correct column to show
whether it is an example of Selection or Repetition.
Statements
Selection
Repetition
← 1 TO 10
FOR X
← SUM + 1
SUM
NEXT X
WHILE X > 10 DO
←
SUM
SUM + 1
←
X - 1
X
ENDWHILE
IF X > 10
THEN
←
SUM + 1
SUM
←
X - 1
X
ENDIF
REPEAT
←
SUM
SUM + 1
←
X - 1
X
UNTIL X > 10
[4]

218
0478/21/O/N/18 · Question 1Oct/Nov 2018Paper 2120 marks
Loading question…
Question text

1
(a) All arrays, variables, constants and other identifiers should have meaningful names.
(i)
State the name, data type and use of two arrays you created for Task 1.
Array 1 name …
Data type …
Use …
…
Array 2 name …
Data type …
Use …
…
[4]
(ii)
State the name, data type and use of two variables you have created for Task 2.
Variable 1 name …
Data type …
Use …
…
Variable 2 name …
Data type …
Use …
…
[4]
(b) Write an algorithm to enter each item code and quantity. Then when the order is completely
entered, generate a unique order code (part of Task 2), using either pseudocode,
programming statements or a flowchart. You should assume that Task 1 has already been
completed.
…
…
…
…
…
…
…
…
…

Advertisement
219
0478/21/O/N/18 · Question 2Oct/Nov 2018Paper 215 marks
Loading question…
Question text

2
Six terms associated with programming and six descriptions are listed.
Draw a line to link each term with its most appropriate description.
Term
Description
Pre-written code to include in
Top-down design
your own program to carry out
a common task.
Shows the steps representing
an algorithm using various
Structure diagram
shapes of boxes.
Shows the hierarchy of the
different components which
Flowchart
make up a system.
Shows the values of variables
as you manually test your
Pseudocode
program.
Breaks down a system into
Library routine
successively smaller pieces.
Describes a program using a
Trace table
simplified high-level notation.
[5]

220
0478/21/O/N/18 · Question 5Oct/Nov 2018Paper 215 marks
Loading question…
Question text

5
The flowchart performs a mathematical process on a number input called TestNum
DIV is used to represent integer division e.g. 7 DIV 3 = 2
START
Flag
True
INPUT
TestNum
Num
TestNum – 1
Yes
No
Is Num =
1 ?
Num
Num – 1
Is TestNum /
Yes
No
Flag
False
Num = TestNum
DIV Num ?
Yes
Is Flag =
True ?
No
OUTPUT
TestNum
END
(a) Complete the trace table for the input data: 7
Flag
TestNum
Num
OUTPUT
[2]
(b) Complete the trace table for the input data: 6
Flag
TestNum
Num
OUTPUT
[2]
(c) State the purpose of the algorithm in the flowchart.
…
… [1]

221
0478/22/O/N/18 · Question 1Oct/Nov 2018Paper 2220 marks
Loading question…
Question text

1
(a) All variables, arrays, constants and other identifiers should have meaningful names.
(i)
State the name of one variable you have used for Task 3.
Give the data type for the variable. State what it is used for.
Variable name …
Data type …
Use …
[3]
(ii)
Describe the arrays that you have used to store the data for the children in Task 1.
Include the name, data type and its use for each array.
…
…
…
…
…
…
…
…
…
… [5]
(b) Explain how you ensured that each identification number entered in Task 1 was unique and
included a correct check digit.
…
…
…
…
…
…
…
… [4]
(c) Write an algorithm for Task 2, using either pseudocode, programming statements or a
flowchart. You should assume that Task 1 has already been completed.
…
…
…

222
0478/22/O/N/18 · Question 3Oct/Nov 2018Paper 223 marks
Loading question…
Question text

3
Four programming concepts and four descriptions are shown.
Draw a line to connect each programming concept to the most appropriate description.
Programming concept
Description
A subroutine that does not
Library routine
have to return a value.
Structure
A standard subroutine that is
diagram
available for immediate use.
A subroutine that always
Procedure
returns a value.
An overview of a program or
Function
subroutine.
[3]

223
0478/22/O/N/18 · Question 4Oct/Nov 2018Paper 224 marks
Loading question…
Question text

4
A programmer wants to test that the readings from 2000 electricity meters are greater than 400
units and less than 900 units. The programmer uses selection and repetition statements as part of
the program.
Explain, using programming statements, how selection and repetition could be used in this
program.
Selection …
…
…
…
…
Repetition …
…
…
…
…
…
…
…
[4]

Advertisement
224
0478/23/O/N/18 · Question 1Oct/Nov 2018Paper 2320 marks
Loading question…
Question text

1
(a) All arrays, variables, constants and other identifiers should have meaningful names.
(i)
State the name, data type and use of three arrays you have created for Task 1.
Array 1 name …
Data type …
Use …
…
Array 2 name …
Data type …
Use …
…
Array 3 name …
Data type …
Use …
…
[6]
(ii)
State the name, data type and use for one variable you used in Task 2.
Variable name …
Data type …
Use …
…
[2]
(b) Write an algorithm to show how your program finds and displays the weeks available for
each log cabin and its capacity (part of Task 2), using either pseudocode, programming
statements or a flowchart.
…
…
…
…
…
…
…
…
…
…

225
0478/23/O/N/18 · Question 2Oct/Nov 2018Paper 234 marks
Loading question…
Question text

2
Describe, giving an example for each, the following data types used in programming.
Integer
Description …
…
Example …
String
Description …
…
Example …
[4]

Advertisement