0% found this document useful (0 votes)
19 views44 pages

CH 9&10

Uploaded by

demianaattallaa
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)
19 views44 pages

CH 9&10

Uploaded by

demianaattallaa
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/ 44

www.dynamicpapers.

com

Cambridge IGCSE™
* 2 8 3 1 0 1 3 0 1 6 *

COMPUTER SCIENCE 0478/22


Paper 2 Algorithms, Programming and Logic February/March 2023

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 (LK/SG) 334324/4
© UCLES 2023 [Turn over
www.dynamicpapers.com
6

7 Consider this logic expression.

X = (A OR NOT B) AND (B AND NOT C)

(a) Draw a logic circuit for this logic expression. Each logic gate must have a maximum of two
inputs. Do not simplify this logic expression.

B X

[5]

(b) Complete the truth table from the given logic expression.

Working space
A B C X

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]

© UCLES 2023 0478/22/F/M/23


www.dynamicpapers.com
10

9 A shop that sells books has set up a new database table called BookList to store book details.
Part of this table is given.

CatNo Title Fiction Author PaperBack Price StockLevel


BK01 The Princes’ Story Yes B Penn Yes 4.50 500
BK02 The Princesses’ Story Yes B Penn Yes 4.50 350
BK03 Computer Science No Way Yu Yes 19.99 20
BK04 The Modern World No P Patel No 25.00 5
BK05 The Ancient World Yes P Patel No 25.00 5
BK06 Computer Science No R Dale Yes 27.35 8
BK07 The Princes’ Story Yes B Penn No 12.50 3
BK08 The Princesses’ Story Yes B Penn No 12.50 0
BK12 Famous Five Yes E Bly Yes 2.75 45
BK15 Secret Seven Yes E Bly Yes 2.75 25
BK16 The Last Knight Yes P Mann Yes 5.99 7
BK17 The Dark Tower Yes P Mann Yes 5.99 5
BK19 The Final Chase Yes P Mann Yes 5.99 5
BK21 Maths Today Part 1 No B Ward Yes 6.75 25
BK22 Maths Today Part 2 No B Ward Yes 6.75 15
BK23 Maths Today Part 3 No B Ward Yes 6.75 10
BK26 Maths Today Workbook No B Ward Yes 6.75 30
BK27 Knitting for Beginners No A Smith Yes 6.99 3
BK30 Woodwork for Beginners No A Smith Yes 6.99 4
BK31 Networking for Beginners No A Smith Yes 6.99 0

(a) State the number of records in this part of the database table.

............................................................................................................................................. [1]

(b) (i) Give the name of the field that would be used for the primary key.

..................................................................................................................................... [1]

(ii) State the reason for choosing this field for the primary key.

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

..................................................................................................................................... [1]

© UCLES 2023 0478/22/F/M/23


www.dynamicpapers.com
11

(c) Complete the table to identify the most appropriate data type for each field based on the data
shown in the table BookList

Field Data type

CatNo

Title

Fiction

Price

[2]

(d) Write the output from this structured query language (SQL) statement.

SELECT CatNo, Title, Author

FROM BookList

WHERE StockLevel = 0;

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

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

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

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

(e) Complete this SQL statement to display all the titles by the author B Penn.

SELECT .....................................................................................................................................

FROM .........................................................................................................................................

WHERE .....................................................................................................................................;
[2]

© UCLES 2023 0478/22/F/M/23 [Turn over


www.dynamicpapers.com

Cambridge IGCSE™
* 4 8 1 6 0 2 0 7 0 1 *

COMPUTER SCIENCE 0478/21


Paper 2 Algorithms, Programming and Logic May/June 2023

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 (CJ/CT) 313987/4
© UCLES 2023 [Turn over
www.dynamicpapers.com
11

9 Consider this logic expression.

Z = (NOT A OR B) AND (B XOR C)

(a) Draw a logic circuit for this logic expression.

Each logic gate must have a maximum of two inputs.

Do not simplify this logic expression.

B Z

[4]

(b) Complete the truth table from the given logic expression.

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]

© UCLES 2023 0478/21/M/J/23 [Turn over


www.dynamicpapers.com
12

10 A database table called TVRange shows the main features and prices of a range of televisions.

TVCode ScreenSize Satellite SmartTV SoundBar Price$


TV90SaSmSd 90 YES YES YES 9750.00
TV75SaSmSd 75 YES YES YES 8500.00
TV75SaSd 75 YES NO YES 8000.00
TV65SaSmSd 65 YES YES YES 6000.00
TV65SmSd 65 NO YES YES 5000.00
TV65SaSd 65 YES NO YES 5000.00
TV55SaSmSd 55 YES YES YES 4000.00
TV55SaSd 55 YES NO YES 3500.00
TV55SmSd 55 NO YES YES 3500.00
TV50SaSmSd 50 YES YES YES 2500.00
TV50Sa 50 YES NO NO 1750.00
TV50Sm 50 NO YES NO 1750.00
TV40Sa 40 YES NO NO 1200.00
TV40 40 NO NO NO 950.00
TV32 32 NO NO NO 650.00

(a) Give the name of the field that is most suitable to be the primary key.

State the reason for this choice.

Field ..........................................................................................................................................

Reason .....................................................................................................................................

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

© UCLES 2023 0478/21/M/J/23


www.dynamicpapers.com
13

(b) The database uses the data types:


• text
• character
• Boolean
• integer
• real
• date/time.

Complete the table to show the most appropriate data type for each field.
Each data type must be different.

Field Data type


TVCode
ScreenSize
SmartTV
Price$
[2]

(c) Complete the structured query language (SQL) query to return the television (TV) code,
screen size and price of all Smart TVs in the database table.

SELECT TVCode, ......................................................., .......................................................

....................................................... TVRange

WHERE SmartTV = .......................................................;


[4]

© UCLES 2023 0478/21/M/J/23 [Turn over


www.dynamicpapers.com

Cambridge IGCSE™
* 4 7 9 7 8 7 7 8 2 9 *

COMPUTER SCIENCE 0478/22


Paper 2 Algorithms, Programming and Logic May/June 2023

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 (RW/SW) 313988/5
© UCLES 2023 [Turn over
www.dynamicpapers.com
7

8 Consider this logic expression.

X = (A OR B) AND (NOT B AND C)

Complete the truth table for this logic expression.

Working space
A B C X

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]

© UCLES 2023 0478/22/M/J/23 [Turn over


www.dynamicpapers.com
10

10 A music streaming service has a new database table named Songs to store details of songs
available for streaming. The table contains the fields:
• SongNumber – the catalogue number, for example AG123
• Title – the title of the song
• Author – the name of the song writer(s)
• Singer – the name of the singer(s)
• Genre – the type of music, for example rock
• Minutes – the length of the song in minutes, for example 3.75
• Recorded – the date the song was recorded.

(a) Identify the field that will be the most appropriate primary key for this table.

............................................................................................................................................. [1]

(b) Complete the table to identify the most appropriate data type for the fields in Songs

Field Data type

SongNumber

Title

Recorded

Minutes

[2]

(c) Explain the purpose of the structured query language (SQL) statements.

SUM (Minutes) FROM Songs WHERE Genre = "rock";

COUNT (Title) FROM Songs WHERE Genre = "rock";

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

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

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

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

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

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

© UCLES 2023 0478/22/M/J/23


www.dynamicpapers.com

Cambridge IGCSE™
* 5 0 9 3 7 8 1 8 6 5 *

COMPUTER SCIENCE 0478/23


Paper 2 Algorithms, Programming and Logic May/June 2023

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 (CJ/CGW) 313989/4
© UCLES 2023 [Turn over
www.dynamicpapers.com
8

8 Consider the logic expression:

Z is 1 if (A = 1 AND C = NOT 1) AND (B = 1 NOR C = 1)

(a) Draw a logic circuit for this logic expression.

Each logic gate must have a maximum of two inputs.

Do not simplify this logic expression.

B Z

[4]
(b) Complete the truth table from the given logic expression.

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]

© UCLES 2023 0478/23/M/J/23


www.dynamicpapers.com
10

10 A database table called Site1 stores details of some holiday homes at a holiday park. The
database shows the type of home, number of guests, whether it is privately owned and the weekly
rate to hire it.

Name Type Private Rate$ NumberGuest


Bay Lodge Lodge NO 1000 10
Bay View Cabin NO 400 4
Blue Skies Cabin NO 350 4
Cliff View Cabin NO 650 6
Coppice Lodge Lodge NO 1200 12
Green Lodge Lodge NO 1000 8
Henry Cabin YES 300 2
Hikers’ Rest Retreat NO 750 6
Poppy Cabin NO 300 2
Summer Joy Retreat YES 750 6
Valley View Cabin NO 600 6
West Lodge Lodge YES 1200 12

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

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

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

(b) Describe the purpose of a primary key.

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

............................................................................................................................................. [1]

© UCLES 2023 0478/23/M/J/23


www.dynamicpapers.com
11

(c) The database uses the data types:


• alphanumeric
• character
• Boolean
• integer
• real
• date/time.

Complete the table to show the most appropriate data type for each field.

Field Data type


Type
Private
Rate$
NumberGuest
[2]

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

SELECT Name, NumberGuest, Rate$


FROM Site1
WHERE NumberGuest >= 10;

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

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

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

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

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

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

© UCLES 2023 0478/23/M/J/23 [Turn over


www.dynamicpapers.com

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

COMPUTER SCIENCE 0478/21


Paper 2 Algorithms, Programming and Logic October/November 2023

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 (LK/SG) 314037/5
© UCLES 2023 [Turn over
www.dynamicpapers.com
6

7 Consider this logic circuit.

B X

(a) Write a logic expression for this logic circuit. Do not attempt to simplify this logic expression.

X = ............................................................................................................................................

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

(b) Complete the truth table from the given logic circuit.

Working space
A B C X

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]

© UCLES 2023 0478/21/O/N/23


www.dynamicpapers.com
10

9 A model shop wants to set up a database to help with stock control of the model figures available
for sale. The shop wants to store this information about the model figures:
Field 1 – catalogue number, for example MD1234
Field 2 – description, for example ‘small white dog’
Field 3 – number in stock, for example 5
Field 4 – the price of each model, for example 7.40
Field 5 – if the model has already been painted, yes or no.

(a) The shop needs five fields for each record.


Give a suitable name and data type for each field.

Field 1 name .............................................................................................................................

Data type ..................................................................................................................................

Field 2 name ..............................................................................................................................

Data type ..................................................................................................................................

Field 3 name .............................................................................................................................

Data type ..................................................................................................................................

Field 4 name .............................................................................................................................

Data type ..................................................................................................................................

Field 5 name .............................................................................................................................

Data type ..................................................................................................................................


[5]

(b) (i) Give the name of the field that should be used for the primary key.

..................................................................................................................................... [1]

(ii) State why this field is used as the primary key.

..................................................................................................................................... [1]

(c) Structured query language (SQL) is used to query data stored in this database.
State what these SQL commands are used for.

SELECT .....................................................................................................................................

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

FROM .........................................................................................................................................

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

WHERE .......................................................................................................................................

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

© UCLES 2023 0478/21/O/N/23


www.dynamicpapers.com

Cambridge IGCSE™
* 3 4 3 5 3 7 0 0 4 3 *

COMPUTER SCIENCE 0478/22


Paper 2 Algorithms, Programming and Logic October/November 2023

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 (RW/SG) 314039/4
© UCLES 2023 [Turn over
www.dynamicpapers.com
9

9 Consider the logic expression:

Z = (A NAND B) OR NOT (B XOR C)

(a) Draw a logic circuit for this logic expression.

Each logic gate must have a maximum of two inputs.

Do not simplify this logic expression.

B Z

[4]

(b) Complete the truth table from the given logic expression.

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]

© UCLES 2023 0478/22/O/N/23 [Turn over


www.dynamicpapers.com
10

10 A database table called Horses stores details about the horses kept at a horse sanctuary.

Code Breed BreedOrigin Gender Age Arrived


H002 Arabian Saudi Arabia M 5 28/09/2022
H004 Percheron France M 5 30/10/2022
H010 Friesian Netherlands M 6 15/11/2022
H011 Fjord Norway F 4 17/11/2022
H012 Clydesdale Scotland M 10 18/11/2022
H015 Arabian Saudi Arabia F 5 15/12/2022
H016 Arabian Saudi Arabia F 5 15/12/2022
H017 Clydesdale Scotland F 4 16/01/2023
H019 Percheron France M 3 16/01/2023
H025 Percheron France M 7 16/01/2023
H026 Clydesdale Scotland F 9 20/01/2023
H030 Clydesdale Scotland M 12 20/01/2023
H032 Fjord Norway M 3 24/03/2023
H033 Arabian Saudi Arabia F 15 27/04/2023
H034 Clydesdale Scotland F 4 14/06/2023
H035 Fjord Norway M 7 15/06/2023
H036 Friesian Netherlands F 15 20/07/2023
H037 Friesian Netherlands M 12 20/07/2023

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

............................................................................................................................................. [1]

(b) Give the name of the field that is most suitable to be the primary key.

State the reason for this choice.

Field ..........................................................................................................................................

Reason .....................................................................................................................................

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

© UCLES 2023 0478/22/O/N/23


www.dynamicpapers.com
11

(c) The database only allows the data types:


• Boolean
• character
• date/time
• integer
• real
• text.

Complete the table to show the most appropriate data type for each field.
Each data type must be different.

Field Data type


Breed

Gender

Age

Arrived
[2]

(d) Complete the structured query language (SQL) to return the code and breed of all the horses
whose breed originated in Scotland.

......................................... Code, Breed,

FROM .........................................

WHERE ......................................... = "Scotland";


[3]

© UCLES 2023 0478/22/O/N/23 [Turn over


www.dynamicpapers.com

Cambridge IGCSE™
* 2 5 0 4 8 4 8 1 1 1 *

COMPUTER SCIENCE 0478/23


Paper 2 Algorithms, Programming and Logic October/November 2023

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 (CJ/CT) 313523/5
© UCLES 2023 [Turn over
www.dynamicpapers.com
8

6 There are three descriptions of logic gates. Each logic gate has two inputs A and B with one
output X.
Identify each logic gate.
Complete a truth table for each logic gate.

(a) The only time the output is 1 is when both inputs are 1.
A B X
Logic gate ...............................................
0 0
Complete the truth table for this description.
0 1

1 0

1 1

[2]

(b) The output is 1 when both inputs are different.


A B X
Logic gate ...............................................
0 0
Complete the truth table for this description.
0 1

1 0

1 1

[2]

(c) The only time the output is 1 is when both inputs are 0.
A B X
Logic gate ...............................................
0 0
Complete the truth table for this description.
0 1

1 0

1 1

[2]

© UCLES 2023 0478/23/O/N/23


www.dynamicpapers.com
9

(d) Consider this logic expression:

X = (NOT A OR NOT B) OR NOT C

Draw a logic circuit for this logic expression. Each logic gate must have a maximum of two
inputs. Do not attempt to simplify this logic expression.

B X

[5]

7 A program uses both local variables and global variables.

Describe two differences between local variables and global variables.

Difference 1 ......................................................................................................................................

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

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

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

Difference 2 ......................................................................................................................................

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

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

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

© UCLES 2023 0478/23/O/N/23 [Turn over


www.dynamicpapers.com
12

9 A sanctuary for pheasants has set up a new database table called PheasantList to store details
of the different species of bird at the sanctuary. Part of this table is given, showing: species,
description, number of birds at the sanctuary, if the birds are breeding or not, and number of
young born this year.

Species Description NumberBirds Breeding Young


Edwards blue-black with white tail 5 Yes 0
Japanese green dark green with pale grey tail 2 Yes 2
Reeves golden, white and red scaled plumage 4 Yes 1
Crawfords Kalij glossy blue-black plumage 4 No 0
Crested fireback blue-black with black tail 3 No 0
True silver white laced top half and black lower half 7 Yes 1
Siamese fireback grey plumage with crimson legs and feet 5 No 0
Mikado iridescent plumage with white striped wings 3 Yes 4
Red junglefowl many colours 2 Yes 0
Himalayan monal many colours with metallic green crest 3 Yes 2
White eared white with ear tufts 5 Yes 3
Brown eared brown with ear tufts 9 Yes 1
Ring necked long tail with white ring neck 2 Yes 2
Golden rainbow coloured 3 Yes 4

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

Records .....................................................................................................................................

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

(b) (i) Give the name of a field that could be used for the primary key.

..................................................................................................................................... [1]

(ii) Explain why the sanctuary might decide not to use the field in (b)(i) as the primary key.

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

..................................................................................................................................... [1]

(iii) A new field SpeciesID is added to the database table.


This field contains a six-character code, for example Ph0001.

Give a reason why this field would be a better primary key.

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

..................................................................................................................................... [1]

© UCLES 2023 0478/23/O/N/23


www.dynamicpapers.com
13

(c) Write the output that would be given by this structured query language (SQL) statement:

SELECT Species, Description

FROM PheasantList

WHERE NumberBirds > 6;

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

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

(d) Complete this SQL statement to display all the species of pheasant where the birds are
breeding and there were no young born this year:

SELECT ....................................................................................................................................

FROM ........................................................................................................................................

WHERE ......................................................................................................................................

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

© UCLES 2023 0478/23/O/N/23 [Turn over


www.dynamicpapers.com

Cambridge IGCSE™
* 8 4 7 2 5 2 9 9 3 1 *

COMPUTER SCIENCE 0478/22


Paper 2 Algorithms, Programming and Logic February/March 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 (DE/JG) 327910/4
© UCLES 2024 [Turn over
www.dynamicpapers.com
9

7 Consider the logic expression:

X = (A XOR B) AND (NOT B AND C)

(a) Draw a logic circuit for this logic expression. Each logic gate must have a maximum of two
inputs. Do not simplify this logic expression.

B X

[4]

(b) Complete the truth table from the given logic expression.

Working space
A B C X

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]

© UCLES 2024 0478/22/F/M/24 [Turn over


www.dynamicpapers.com
11

9 A storage unit rental company wants to set up a new database table for the storage units that can
be rented.

The table is called StorageUnits and needs to store these details:

• SizeMetres – size in square metres


• Position – first, second or third floor
• Hoist – whether there is a hoist available for the transfer of items
• PriceMonth – the price in dollars for a month’s rental
• StorageID – the code to identify each storage unit, for example S123

(a) (i) Give the name of the field that would be used for the primary key.

..................................................................................................................................... [1]

(ii) State the reason for choosing this field for the primary key.

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

..................................................................................................................................... [1]

(b) Complete the table to identify the most appropriate data type for these fields in the table
StorageUnits

Field Data type


SizeMetres
Position
Hoist
StorageID
[2]

(c) Complete this structured query language (SQL) statement to display only the storage code,
price and size in square metres of all the storage units where there is a hoist available.

SELECT ....................................................................................................................................

FROM ........................................................................................................................................

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

© UCLES 2024 0478/22/F/M/24 [Turn over


www.dynamicpapers.com

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

COMPUTER SCIENCE 0478/21


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 (PQ/CT) 329143/3
© UCLES 2024 [Turn over
www.dynamicpapers.com
9

8 Consider the logic expression:

Z = (R OR NOT T) XOR (NOT S AND T)

(a) Draw a logic circuit for this logic expression.

Each logic gate must have a maximum of two inputs.

Do not simplify this logic expression.

S Z

[5]

(b) Complete the truth table from the given logic expression.

Working space
R S T 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]

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


www.dynamicpapers.com
10

9 A database table called SoftDrinks stores details of the soft drinks sold by a small shop.

Field Example data

Name Cola

Supplier Cambridge Beverages

Container Can

SizeCl 330

NumberInStock 30

ReorderLevel 15

Reordered Yes

(a) State whether any of the given fields would be suitable as a primary key and give a reason for
your answer.

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

............................................................................................................................................. [1]

(b) Complete the structured query language (SQL) statement to return the number of cans the
shop has in stock.

SELECT ....................................................... (.......................................................)

FROM .......................................................

WHERE ....................................................... = ....................................................... ;


[5]

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


* 0019655533401 * www.dynamicpapers.com

, ,

Cambridge IGCSE™

¬OŠ. 3mKo[‘U¢8¦6W
¬—™`I£0£]v†§¦Lb:V‚
¥U •5•¥5U•5¥ Eu5U
* 4 5 6 7 6 0 4 2 2 6 *

COMPUTER SCIENCE 0478/22


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 (LK/CB) 329121/3
© UCLES 2024 [Turn over
* 0019655533407 * www.dynamicpapers.com
DO NOT WRITE IN THIS MARGIN

7
, ,

8 A logic circuit is to be built to control the opening of a safe used to store money. There are two
keys, A and B, and a time switch C. The safe can only open if both keys are used and the time
switch is off.

not used 0
key A
used 1

not used 0
key B
DO NOT WRITE IN THIS MARGIN

used 1

switch off 0
time switch C
switch on 1

safe cannot open 0


safe X
safe can open 1

(a) Write the logic expression for this problem.

............................................................................................................................................. [3]
DO NOT WRITE IN THIS MARGIN

(b) Complete the truth table for this problem.

Working space
A B C X

0 0 0

0 0 1
DO NOT WRITE IN THIS MARGIN

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0
DO NOT WRITE IN THIS MARGIN

1 1 1

[4]

ĬÓĊ®Ġ³íËïÛđÕ̶ĨµĎ×
© UCLES 2024 ĬėěÝ¿ġÞúÐø÷¯ÌĎąºæĂ
ĥĥĕÕõµÅµÕĥĥåąåŵÅÕ
0478/22/M/J/24 [Turn over
* 0019655533510 * www.dynamicpapers.com

DO NOT WRITE IN THIS MARGIN


10
, ,

10 A television subscription service has a new database table named Contract to store details of
their subscribers’ contracts. The table contains these fields:

• ContractNumber – the contract number, for example CT567


• Months – the length of the contract in months, for example 6
• EndDate – the date the contract finishes, for example 30 November 2024
• News – the news service, yes or no
• Movie – the movie service, yes or no
• Sport – the sports service, yes or no
• Junior – the children’s service, yes or no.

DO NOT WRITE IN THIS MARGIN


(a) Identify the field that will be the most appropriate primary key for this table.

............................................................................................................................................. [1]

(b) Complete the table to identify the most appropriate data type for these fields in Contract

Field Data type

ContractNumber

Months

DO NOT WRITE IN THIS MARGIN


EndDate

Sport

[2]

(c) Explain the purpose of these structured query language (SQL) statements.

Statement 1: SELECT SUM (Months) FROM Contract;

Statement 2: SELECT COUNT (News) FROM Contract WHERE News;

DO NOT WRITE IN THIS MARGIN


Statement 1 ..............................................................................................................................

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

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

Statement 2 ..............................................................................................................................

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

...................................................................................................................................................
[3]
DO NOT WRITE IN THIS MARGIN

ĬÑĉ¯Ġ³íËïÛđÕ̶Ĩ·Ď×
© UCLES 2024 ĬėęÝÁĤëïãĆöĠĩČėâÞĂ
ĥµõĕõõåĕĥąĥĥąåąµÅÕ
0478/22/M/J/24
* 0019655533511 * www.dynamicpapers.com
DO NOT WRITE IN THIS MARGIN

11
, ,

(d) Complete this SQL statement to find the contract numbers of the subscribers that take both
the news and sports services.

SELECT .....................................................................................................................................

FROM Contract

WHERE .......................................................... AND ................................................................. ;


[2]
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN

ĬÓĉ¯Ġ³íËïÛđÕ̶Ħ·Ď×
© UCLES 2024 ĬėĚÞÉĦçÿÖôċé­ôÃâÎĂ
ĥµąÕµĕÅõõõµĥąÅĥõÕÕ
0478/22/M/J/24 [Turn over
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
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
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

You might also like