0% found this document useful (0 votes)
23 views16 pages

Cambridge IGCSE: Computer Science 0478/23

This document is the Cambridge IGCSE Computer Science Paper 2 for May/June 2024, focusing on algorithms, programming, and logic. It includes instructions for candidates, a total of 75 marks, and various questions covering topics such as logic gates, pseudocode, data types, and SQL queries. The paper consists of multiple sections requiring candidates to complete flowcharts, truth tables, and pseudocode algorithms.

Uploaded by

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

Cambridge IGCSE: Computer Science 0478/23

This document is the Cambridge IGCSE Computer Science Paper 2 for May/June 2024, focusing on algorithms, programming, and logic. It includes instructions for candidates, a total of 75 marks, and various questions covering topics such as logic gates, pseudocode, data types, and SQL queries. The paper consists of multiple sections requiring candidates to complete flowcharts, truth tables, and pseudocode algorithms.

Uploaded by

hitg6704
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

www.dynamicpapers.

com

Cambridge IGCSE™
* 5 2 9 6 2 2 3 7 5 6 *

COMPUTER SCIENCE 0478/23


Paper 2 Algorithms, Programming and Logic May/June 2024

1 hour 45 minutes

You must answer on the question paper.

No additional materials are needed.

INSTRUCTIONS
● Answer all questions.
● Use a black or dark blue pen. You may use an HB pencil for any diagrams or graphs.
● Write your name, centre number and candidate number in the boxes at the top of the page.
● Write your answer to each question in the space provided.
● Do not use an erasable pen or correction fluid.
● Do not write on any bar codes.
● Calculators must not be used in this paper.

INFORMATION
● The total mark for this paper is 75.
● The number of marks for each question or part question is shown in brackets [ ].
● No marks will be awarded for using brand names of software packages or hardware.

This document has 16 pages. Any blank pages are indicated.

DC (CE/CB) 329120/3
© UCLES 2024 [Turn over
www.dynamicpapers.com
2

1 Tick (3) one box to complete this sentence.

This flowchart symbol

A represents a subroutine.

B represents a decision.

C represents an input/output.

D represents a terminator.
[1]

2 (a) Four logic gate symbols and five logic functions are shown.

Draw one line to link each logic gate symbol to the appropriate logic function.

Not all logic functions will be used.

Logic gate symbol Logic function

AND

XOR

NOT

NAND

OR

[4]

© UCLES 2024 0478/23/M/J/24


www.dynamicpapers.com
3

(b) Complete the truth table for this logic circuit.

Working space
A B C Z

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

[4]

3 Describe the characteristics of the string and char data types and give an example of each.

String ................................................................................................................................................

..........................................................................................................................................................

Example ...........................................................................................................................................

Char .................................................................................................................................................

..........................................................................................................................................................

Example ...........................................................................................................................................
[4]

© UCLES 2024 0478/23/M/J/24 [Turn over


www.dynamicpapers.com
4

4 This pseudocode algorithm is intended to allow data for up to 50 people to be entered and stored
in a two-dimensional (2D) array. The data is their last name, first name and the city in which they
live.

01 DECLARE People : ARRAY[1:50, 1:3] OF REAL


02 DECLARE Count : INTEGER
03 DECLARE Response : CHAR
04 DECLARE Continue : BOOLEAN
05 FOR I 1 TO 50
06 FOR J 1 TO 3
07 People[I, J] ""
08 NEXT J
09 NEXT I
10 Count 100
11 Continue TRUE
12 CASE OF
13 OUTPUT "Enter the last name"
14 INPUT People[Count, 1]
15 OUTPUT "Enter the first name"
16 INPUT People[Count, 2]
17 OUTPUT "Enter the city"
18 INPUT People[Count, 3]
19 OUTPUT "Do you want to enter another name (Y or N)?"
20 INPUT Response
21 IF Response = 'N'
22 THEN
23 Continue FALSE
24 ELSE
25 Count Count + 1
26 ENDIF
27 UNTIL NOT Count

(a) Identify the line numbers of the four errors in the pseudocode and suggest corrections.

Error 1 line number ...................................................................................................................

Correction .................................................................................................................................

...................................................................................................................................................

Error 2 line number ...................................................................................................................

Correction .................................................................................................................................

...................................................................................................................................................

Error 3 line number ...................................................................................................................

Correction .................................................................................................................................

...................................................................................................................................................

Error 4 line number ...................................................................................................................

Correction .................................................................................................................................

...................................................................................................................................................
[4]
© UCLES 2024 0478/23/M/J/24
www.dynamicpapers.com
5

(b) Write the pseudocode that you could add to the end of this algorithm to output the contents of
the array. Make sure that the output ends when the data in the array ends.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

(c) Explain how you could alter the original corrected algorithm to make sure that the
number of elements being added to the array does not exceed the maximum size of the
array (50 elements).

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

© UCLES 2024 0478/23/M/J/24 [Turn over


www.dynamicpapers.com
6

5 The flowchart represents an algorithm.

START

L 0
S 10000
T 0
A 0

INPUT
Limit

Count 1

INPUT
Value

IS IS
No No
Value < S Value > L
? ?

Yes Yes

S Value L Value

T T + Value

IS
No
Count > Count Count + 1
Limit ?

Yes

A T / Limit

OUTPUT "L = ", L, " S = ",


S, " T = ", T, " A = ", A

STOP

© UCLES 2024 0478/23/M/J/24


www.dynamicpapers.com
7

(a) Complete the trace table for the input data:

10, 30, 18, 8, 25, 12, 17, 2, 50, 15, 5

L S T A Limit Count Value OUTPUT

[6]

(b) Outline the purpose of the algorithm.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

© UCLES 2024 0478/23/M/J/24 [Turn over


www.dynamicpapers.com
8

(c) Explain why the identifiers L, S, T and A may not be appropriate to use as identifiers and how
they could be improved.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

(d) State a more appropriate identifier for each of the variables L, S, T and A

Original identifier Improved identifier

A
[2]

6 A program is to be written that will accept integers that are between the values of 1 and 80
inclusive.

(a) Give examples of normal, abnormal and extreme test data that could be used to make sure
the program only accepts valid data.

Normal test data .......................................................................................................................

Abnormal test data ...................................................................................................................

Extreme test data .....................................................................................................................


[3]

(b) Describe what is meant by extreme test data.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

© UCLES 2024 0478/23/M/J/24


www.dynamicpapers.com
9

7 (a) The string operation SUBSTRING(FullText, X, Y) returns a string from FullText


beginning at position X that is Y characters long. The first character in FullText is in
position 1.

Write the pseudocode statements to:

• store the string “IGCSE Computer Science at Cambridge” in FullText


• extract and display the words “Computer Science” from the string and store it in a suitable
variable
• output the original string in upper case.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

(b) Write the pseudocode statements to:

• store the content of the variable you created in part (a) to a text file named
"Subjects.txt"
• close the text file at the end of the algorithm.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

© UCLES 2024 0478/23/M/J/24 [Turn over


www.dynamicpapers.com
10

8 A database table called Hangar1 stores details of a collection of historic aircraft at a museum.

ID Make Model Year Engines Airworthy


JM1 Hawker Siddeley Nimrod 1966 4 Y
JM2 Douglas DC-10 1970 3 Y
JM3 Aérospatiale-BAC Concorde 1973 4 N
PB1 De Havilland DH-9 1918 1 Y
PB2 Hawker Fury 1935 1 Y
PB3 Hawker Nimrod 1934 1 Y
PM1 Fieseler Storch 1942 1 N
PM2 Hawker Hurricane 1942 1 Y
PM3 Supermarine Spitfire 1942 1 N
PM4 Douglas C-47 Dakota 1942 2 N
PS1 Boeing 314 Clipper 1936 4 N

(a) State the number of fields and records in the database table.

Fields ........................................................................................................................................

Records ....................................................................................................................................
[2]

(b) Give the output that would be produced by the structured query language (SQL) statement:

SELECT Model, Year, Engines


FROM Hangar1
WHERE Engines > 1
ORDER BY Year;

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

© UCLES 2024 0478/23/M/J/24


www.dynamicpapers.com
11

(c) Complete the SQL statement to display only the ID and model of all the aircraft that are
airworthy.

SELECT ID, ............................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

................................................................................................................................................ ;
[4]

© UCLES 2024 0478/23/M/J/24 [Turn over


www.dynamicpapers.com
12

9 A one-dimensional (1D) array Teams[] contains the names of 10 football teams in a local league.
A two-dimensional (2D) array Results[] stores, for each team, the total number of:

• games won
• games drawn
• games lost
• points.

The position of any team’s data is the same in both arrays. For example the data in index 3 of
Results[] belongs to the team in index 3 of Teams[]

The array data will be used to find the current leader of the league.

The variable Played stores the number of games played by each team. Each team plays the
same number of games.

Write a program that meets the following requirements:

• allows the number of games played to be input and stored, with a maximum of 18 games
• allows the names of the teams to be input and stored
• allows the number of games won, drawn and lost to be input and stored for each team
• validates the number of games played and the number of games won, drawn or lost against
the number of games played
• calculates and stores the number of points for each team using three points for a win and one
point for a draw; there are no points for a loss
• sorts the array Results[] into descending order of number of points, ensuring the
corresponding parallel array Teams[] is kept in the same order
• determines how many teams have the highest number of points
• outputs the name(s) of the winning team(s) along with the number of points achieved.

You must use pseudocode or program code and add comments to explain how your code works.

You do not need to declare any arrays, variables or constants; you may assume that this has
already been done.

All inputs and outputs must contain suitable messages.

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................
© UCLES 2024 0478/23/M/J/24
www.dynamicpapers.com
13

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................
© UCLES 2024 0478/23/M/J/24 [Turn over
www.dynamicpapers.com
14

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

.................................................................................................................................................. [15]
© UCLES 2024 0478/23/M/J/24
www.dynamicpapers.com
15

BLANK PAGE

© UCLES 2024 0478/23/M/J/24


www.dynamicpapers.com
16

BLANK PAGE

Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
reasonable effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the
publisher will be pleased to make amends at the earliest possible opportunity.

To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge
Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download
at www.cambridgeinternational.org after the live examination series.

Cambridge Assessment International Education is part of Cambridge Assessment. Cambridge Assessment is the brand name of the University of Cambridge
Local Examinations Syndicate (UCLES), which is a department of the University of Cambridge.

© UCLES 2024 0478/23/M/J/24

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