IGCSE · Computer Science 0478 · Topic

Databases & Logic: IGCSE Computer Science questions and answers

7 free IGCSE Computer Science Databases & Logic questions written in the style of Cambridge Computer Science papers, each with its answer and mark scheme.

This topic covers Databases & SQL, Logic gates & circuits. Work through the questions below, then generate a full Databases & Logic paper with a fresh set every time.

Generate a full Databases & Logic paper →

Databases & logic sub-topics

Databases & logic practice questions

Question 1Structured · 6 marks
(a)

Complete the truth table for the logic expression
X = (NOT A XOR B) AND C

ABCX
000
001
010
011
100
101
110
111
Table 1.1
[4]
(b)

State how many logic gates are needed to draw this circuit, and name them.

[2]
Show answers and mark scheme
PartAnswer and marking pointsMarks
(a)X column: 01000001
8 correct outputs B4
B3 for 6–7 correct, B2 for 4–5, B1 for 2–3
4
(b)3: NOT, XOR, AND
3 gates B1
NOT, XOR and AND B1
2
Question 2Structured · 7 marks

A shop stores data in a database table called PRODUCTS.

ProductIDNameCategoryPriceStock
P101PuzzleToy22.2533
P102AtlasBook27.9334
P103ChessGame16.885
P104RobotToy33.4035
P105NovelBook20.1755
P106CardsGame18.820
P107KiteToy10.9437
Table 2.1
(a)

State the field that is the most suitable primary key.

[1]
(b)

Write an SQL query to display the Name and Price of products in the category Game with a price greater than 13, in descending order of Price.

[4]
(c)

State the output of: SELECT Name FROM PRODUCTS WHERE Stock < 10;

[2]
Show answers and mark scheme
PartAnswer and marking pointsMarks
(a)ProductID
ProductID B1
1
(b)SELECT Name, Price FROM PRODUCTS WHERE Category = 'Game' AND Price > 13 ORDER BY Price DESC;
SELECT Name, Price B1
FROM PRODUCTS B1
WHERE Category = 'Game' AND Price > 13 B1
ORDER BY Price DESC B1
4
(c)Chess, Cards
All correct names B2
B1 for one error/omission
2
Question 3Structured · 6 marks

Fig. 3.1 shows a logic circuit.

ABCX
Fig. 3.1
(a)

Complete the truth table for this logic circuit.

ABCX
000
001
010
011
100
101
110
111
Table 3.1
[4]
(b)

Write a logic expression for this circuit.

[2]
Show answers and mark scheme
PartAnswer and marking pointsMarks
(a)X column: 11111101
8 correct outputs B4
B3 for 6–7 correct, B2 for 4–5, B1 for 2–3
4
(b)X = (A AND B) NAND (NOT C)
(A AND B) B1
NAND NOT C B1
2
Question 4Structured · 6 marks

A sports centre stores data about its trainers in a table called TRAINERS.

TrainerIDNameSiteHoursYearJoined
T201AshaEast32019
T202BenNorth102018
T203ChenSouth72017
T204DinaSouth92018
T205EliEast32020
T206FarahSouth92016
T207GitaSouth32022
Table 4.1
(a)

State the number of records and the number of fields in the table.

[2]
(b)

State the output of: SELECT COUNT(*) FROM TRAINERS WHERE Site = 'South';

[1]
(c)

Write an SQL query to output the total Hours worked by trainers who joined after 2018.

[3]
Show answers and mark scheme
PartAnswer and marking pointsMarks
(a)7 records, 5 fields
7 records B1
5 fields B1
2
(b)4
4 B1
1
(c)SELECT SUM(Hours) FROM TRAINERS WHERE YearJoined > 2018; (gives 9)
SELECT SUM(Hours) B1
FROM TRAINERS B1
WHERE YearJoined > 2018 (accept >= 2019) B1
3
Question 5Structured · 6 marks

A school stores data in several database tables. The table shows some of the fields.

(a)

Identify the most suitable data type for each field.

FieldData type
a parent’s phone number such as 0044 7700 900123
whether a member has paid
the date a book is due back
the height of a plant in metres
Table 5.1
[4]
(b)

Explain why a phone number is not stored as an integer.

[2]
Show answers and mark scheme
PartAnswer and marking pointsMarks
(a)a parent’s phone number such as 0044 7700 900123: text / string; whether a member has paid: Boolean; the date a book is due back: date / time; the height of a plant in metres: real
a parent’s phone number such as 0044 7700 900123: text / string B1
whether a member has paid: Boolean B1
the date a book is due back: date / time B1
the height of a plant in metres: real B1
4
(b)It may start with 0 / contain spaces or + signs, which would be lost; no calculations are done on it
Leading zeros / spaces / symbols would be lost B1
It is never used in calculations B1
2
Question 6Structured · 2 marks
(a)

State what is meant by the term primary key.

[1]
(b)

State what is meant by the term record.

[1]
Show answers and mark scheme
PartAnswer and marking pointsMarks
(a)A field that uniquely identifies each record
A field that uniquely identifies each record B1
1
(b)A collection of related fields about one item
A collection of related fields about one item B1
1
Question 7Structured · 1 mark

State what is meant by the term NAND gate.

[1]
Show answers and mark scheme
PartAnswer and marking pointsMarks
A gate whose output is 0 only when both inputs are 1
A gate whose output is 0 only when both inputs are 1 B1
1

Other IGCSE Computer Science topics

Frequently asked questions

What is in IGCSE Computer Science Databases & Logic?

In the 0478 syllabus, Databases & Logic covers Databases & SQL, Logic gates & circuits.

Where can I get Databases & Logic questions with mark schemes?

This page has 7 Databases & Logic questions with answers. For more, the free generator on mentorriyaz.in builds a new Databases & Logic paper with a full mark scheme each time you click.

Want a mentor, not just a paper?

Riyaz Shaikh has mentored IGCSE, IB and A Level students for 15+ years, one-on-one, online and in Mumbai. The hardest questions on this site are the ones he uses to find a student's weak points.

Meet Riyaz →

Original Cambridge-style practice questions written for mentorriyaz.in. These are not Cambridge past paper questions, and this site is not affiliated with or endorsed by Cambridge University Press & Assessment. Updated 2026-11-04. Paper generator · mentorriyaz.in