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.
Complete the truth table for the logic expression X = (NOT A XOR B) AND C
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
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
Part
Answer and marking points
Marks
(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.
ProductID
Name
Category
Price
Stock
P101
Puzzle
Toy
22.25
33
P102
Atlas
Book
27.93
34
P103
Chess
Game
16.88
5
P104
Robot
Toy
33.40
35
P105
Novel
Book
20.17
55
P106
Cards
Game
18.82
0
P107
Kite
Toy
10.94
37
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
Part
Answer and marking points
Marks
(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.
Fig. 3.1
(a)
Complete the truth table for this logic circuit.
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
Table 3.1
[4]
(b)
Write a logic expression for this circuit.
[2]
Show answers and mark scheme
Part
Answer and marking points
Marks
(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.
TrainerID
Name
Site
Hours
YearJoined
T201
Asha
East
3
2019
T202
Ben
North
10
2018
T203
Chen
South
7
2017
T204
Dina
South
9
2018
T205
Eli
East
3
2020
T206
Farah
South
9
2016
T207
Gita
South
3
2022
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
Part
Answer and marking points
Marks
(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.
Field
Data 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
Part
Answer and marking points
Marks
(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
Part
Answer and marking points
Marks
(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
Part
Answer and marking points
Marks
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
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.
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