Suggest suitable basic data types

IGCSE Computer Science – Full Syllabus Notes (0478)

This document covers every topic required for the Cambridge IGCSE Computer Science (0478) examination. It is written to the assessment objectives (AO1‑AO3) and includes concise definitions, tables for quick reference, worked examples and exam‑style questions.


1. Data Representation (Topic 1)

1.1 Number systems

  • Binary (base‑2) – digits 0 and 1. 1 byte = 8 bits.
  • Octal (base‑8) – digits 0‑7. 3 binary bits = 1 octal digit.
  • Hexadecimal (base‑16) – digits 0‑9 and A‑F. 4 binary bits = 1 hex digit.
BinaryOctalHexadecimalDecimal
0000 0001001011
0000 10100120A10
1111 1111377FF255

1.2 Conversions (AO1)

  1. Binary → Decimal: multiply each bit by 2ⁿ and sum.
  2. Decimal → Binary: repeatedly divide by 2, record remainders.
  3. Binary ↔ Hex: group bits in fours.
  4. Binary ↔ Octal: group bits in threes.

1.3 Two’s‑complement (AO2)

  • Used for signed integers.
  • Positive numbers = ordinary binary.
  • Negative number = invert bits + 1.

Example: Represent –18 in 8‑bit two’s‑complement.

18  = 0001 0010
invert = 1110 1101
+1    = 1110 1110  → –18

1.4 Overflow & logical shifts (AO2)

  • Overflow occurs when the result needs more bits than the storage size.
  • Logical shift left (LSL) – inserts 0 on the right, multiplies by 2.
  • Logical shift right (LSR) – discards right‑most bit, divides by 2 (unsigned).

1.5 Practice questions

  1. Convert 101101₂ to hexadecimal.
  2. What is the decimal value of 1111 1110₂ in two’s‑complement (8‑bit)?
  3. Shift 0010 1101₂ left by two positions. What is the new binary value and its decimal equivalent?

2. Text, Sound & Images (Topic 2)

2.1 Text representation

  • ASCII – 7‑bit code, 128 characters (e.g., ‘A’ = 65₁₀ = 0100 0001₂).
  • Unicode (UTF‑8) – variable‑length, can represent > 1 million characters.

2.2 Sound representation

ParameterTypical valueEffect on file size
Sample rate44 kHz (CD quality)Higher rate → more samples per second → larger file.
Bit depth16 bits (CD) or 24 bits (studio)More bits per sample → greater dynamic range, larger file.
ChannelsMono (1) or Stereo (2)Stereo doubles the data.

File‑size formula (uncompressed):

Size (bits) = SampleRate × BitDepth × Channels × Duration (seconds)

2.3 Image representation

AttributeTypical values
Resolutione.g., 1920 × 1080 pixels (Full HD)
Colour depth24‑bit (True colour = 16 777 216 colours)
Pixel sizeColour depth ÷ 8 bytes per pixel (e.g., 24‑bit = 3 bytes)

Uncompressed bitmap size:

Size (bytes) = Width × Height × (ColourDepth ÷ 8)

2.4 Mini‑quiz

  1. Calculate the size of a 5‑second mono audio clip recorded at 44 kHz, 16‑bit depth.
  2. How many bytes are required for a 800 × 600 pixel image with 24‑bit colour?
  3. What decimal value does the ASCII code 0x41 represent?

3. Data Storage & Compression (Topic 3)

3.1 Storage units (AO1)

UnitSymbolBytes
bitb1/8 byte
byteB1
kilobyteKB10³ B
kibibyteKiB2¹⁰ B
megabyteMB10⁶ B
mebibyteMiB2²⁰ B
gigabyteGB10⁹ B
gibibyteGiB2³⁰ B
exbibyteEiB2⁶⁰ B

3.2 Lossless vs. lossy compression (AO2)

  • Lossless – original data can be perfectly reconstructed (e.g., ZIP, PNG, FLAC).
  • Lossy – some data is discarded to achieve higher compression (e.g., MP3, JPEG, MPEG‑4).

3.3 Simple Run‑Length Encoding (RLE) example

Original bitmap row: 1111111100000011
RLE (value, count): (1,8)(0,6)(1,2)
Compressed size = 2 bytes per pair → 6 bytes vs. 16 bytes original.

3.4 Impact on bandwidth (AO3)

Compressed data travels faster because fewer bits are transmitted. Example: a 5 MB video compressed to 500 KB reduces transmission time by a factor of 10 on a 1 Mbps link.

3.5 Exercise

Compress the binary string 0001111000 using RLE and state the compression ratio.


4. Data Transmission (Topic 4)

4.1 Packet structure

  • Header – source/destination addresses, protocol, length.
  • Payload – the actual data being sent.
  • Trailer – error‑checking information (e.g., CRC).

4.2 Error detection (AO2)

MethodHow it worksTypical use
Parity bit (even/odd)Count 1‑bits; add a bit to make total even (or odd).Simple serial links, early Ethernet.
ChecksumSum of all bytes modulo 2⁸ (or 2¹⁶); receiver recomputes and compares.IP, TCP/UDP.
CRC (Cyclic Redundancy Check)Polynomial division; highly reliable.Ethernet, USB.

4.3 Automatic Repeat Request (ARQ) (AO2)

  • Sender transmits a packet and waits for an ACK (acknowledgement).
  • If NACK or timeout occurs, the packet is retransmitted.

4.4 Common transmission media (AO1)

MediumTypical speedKey characteristic
Twisted‑pair (UTP)10 Mbps – 1 GbpsWidely used for LANs.
Fiber‑optic10 Gbps – 100 GbpsLow attenuation, immune to EMI.
Wi‑Fi (IEEE 802.11)11 Mbps – 600 MbpsWireless LAN, uses radio frequencies.
Bluetooth1 Mbps – 3 MbpsShort‑range, low power.

4.5 Encryption (concept only – no maths) (AO3)

  • Symmetric key – same secret key for encryption and decryption (e.g., AES).
  • Asymmetric (public‑key) – pair of keys; public key encrypts, private key decrypts (e.g., RSA). Used for secure email and HTTPS.

4.6 Sample question

Explain why a parity bit can detect an odd number of bit errors but not an even number.


5. Computer Hardware (Topic 5)

5.1 CPU components & the Fetch‑Decode‑Execute (FDE) cycle (AO1‑AO2)

  1. Fetch – instruction is read from memory into the Instruction Register (IR).
  2. Decode – Control Unit interprets the opcode and determines required operands.
  3. Execute – ALU performs the operation; result may be stored in a register or memory.

5.2 Cores and cache (AO2)

  • Multi‑core CPUs can execute several instruction streams simultaneously, improving performance.
  • Cache (L1, L2, L3) stores frequently accessed data close to the CPU, reducing memory‑access time.

5.3 Instruction set (AO1)

  • Set of binary codes that the CPU can execute (e.g., ADD, SUB, LOAD, STORE, JUMP).
  • RISC vs. CISC – not examined in depth, but know that “RISC = Reduced Instruction Set Computer”.

5.4 Embedded systems (AO3)

DeviceTypical CPUPurpose
Digital thermostat8‑bit microcontrollerControl heating/cooling.
SmartphoneARM multi‑coreGeneral‑purpose computing, sensors.
Microwave oven16‑bit microcontrollerTimer and power control.

5.5 Quick check

  1. Name the three stages of the FDE cycle.
  2. Why does a larger cache improve performance?
  3. Give one example of an embedded system and the problem it solves.

6. Input/Output Devices & Storage (Topic 6)

6.1 Primary vs. secondary storage (AO1)

  • Primary (volatile) – RAM, registers. Data lost when power is removed.
  • Secondary (non‑volatile) – Hard‑disk, SSD, optical disc, magnetic tape. Retains data without power.

6.2 Types of secondary storage (AO2)

TechnologyTypical speedTypical capacityKey advantage
Magnetic HDD80‑200 MB/s500 GB‑4 TBLow cost per GB.
Solid‑State Drive (SSD)300‑3500 MB/s256 GB‑2 TBNo moving parts → faster, more reliable.
Optical (CD/DVD/Blu‑ray)1‑10 MB/s700 MB‑50 GBPortable, cheap for distribution.
Magnetic tape100‑300 MB/s (sequential)10 TB‑100 TBExcellent for backup archives.

6.3 Virtual memory (AO2)

  • Allows programs to use more memory than physically available by swapping pages to secondary storage.
  • Page‑fault occurs when required data is not in RAM; OS loads it from disk.

6.4 Cloud storage (AO3)

  • Data stored on remote servers accessed via the Internet.
  • Pros: accessibility, automatic backup, scalability.
  • Cons: dependence on network, possible security/privacy issues.

6.5 Sample question

Compare a magnetic hard‑disk and an SSD in terms of speed, durability and cost.


7. Network Hardware (Topic 7)

7.1 Key devices (AO1)

DeviceFunctionTypical address type
Network Interface Card (NIC)Connects a computer to a network.MAC address (48‑bit)
RouterForwards packets between different networks; performs IP routing.IP address (IPv4/IPv6)
SwitchConnects multiple devices within the same LAN; forwards frames based on MAC.MAC address
HubSimple repeat‑and‑broadcast device; no address filtering.None (broadcast only)
Wireless Access Point (WAP)Provides Wi‑Fi connectivity to wired LAN.MAC address

7.2 Addressing basics (AO2)

  • MAC address – 48‑bit hardware identifier, written as six hex pairs (e.g., 00:1A:2B:3C:4D:5E).
  • IP address (IPv4) – 32‑bit dotted decimal (e.g., 192.168.1.10). Subnet mask determines network vs. host portion.

7.3 Example scenario (AO3)

A school network uses a router (192.168.0.1) to connect to the Internet, a switch to link 20 computers, and a WAP for tablets. Explain how a tablet obtains an IP address and reaches a website.


8. Databases – Choosing Suitable Basic Data Types (Topic 9)

8.1 Formal definitions of the most common SQL data types

SQL data type Definition (syllabus wording) Typical range / size SQL example (field definition)
INTEGER Whole numbers without a decimal part. ‑2 147 483 648 to 2 147 483 647 (32‑bit signed) StudentID INTEGER PRIMARY KEY AUTOINCREMENT
SMALLINT Whole numbers that need a smaller range. ‑32 768 to 32 767 (16‑bit signed) Age SMALLINT
REAL / FLOAT Numbers that may contain a fractional part. ≈ ±3.4 × 10³⁸ with ~7 decimal digits of precision Weight REAL
DECIMAL(p,s) Exact numeric values with p total digits, s after the decimal point (used for money). Range depends on p; two‑decimal‑place precision when DECIMAL(10,2) EnrolmentFee DECIMAL(10,2)
CHAR(n) Fixed‑length character string of exactly n characters. n ≤ 255 (each character 1 byte) Gender CHAR(1)
VARCHAR(n) Variable‑length character string up to n characters. n ≤ 65535 (stores only the characters entered + 1 byte length) FirstName VARCHAR(30)
BOOLEAN Two possible values – TRUE / FALSE (or 1/0). 1 byte (implementation dependent) IsFullTime BOOLEAN
DATE Calendar date (year‑month‑day). ‘YYYY‑MM‑DD’ – stored in 3 bytes on most systems. DateOfBirth DATE
TIME Clock time (hour‑minute‑second). ‘HH:MM:SS’ – stored in 3 bytes. StartTime TIME
TIMESTAMP Combined date and time (e.g., ‘2025‑12‑30 14:23:05’). Usually 8 bytes. RegistrationDate TIMESTAMP

8.2 Guidelines for selecting the most suitable data type (AO2)

  1. Use the smallest type that can hold every possible value – saves storage and speeds up searching.
  2. Choose numeric types for fields that will be used in calculations (e.g., totals, averages).
  3. Prefer CHAR(n) only when every entry is exactly n characters (e.g., country codes). Otherwise use VARCHAR(n).
  4. Store dates and times with the dedicated DATE, TIME or TIMESTAMP types – this enables date arithmetic and proper sorting.
  5. Use BOOLEAN for binary choices; avoid “yes/no” as text.
  6. Anticipate future growth – give a slightly larger VARCHAR limit if the field may need more characters later.
  7. Primary keys should be unique, non‑null, never change – an auto‑increment INTEGER is ideal.
  8. Foreign‑key fields must have the same data type as the primary key they reference.

8.3 Primary key, foreign key and field validation (AO3)

  • Primary key (PK) – uniquely identifies each record. Declared with PRIMARY KEY in the CREATE TABLE statement.
  • Foreign key (FK) – creates a link to another table’s PK. Declared with REFERENCES other_table(other_field) and must match the PK’s data type.
  • Field validation – enforce sensible data at entry:
    • CHECK constraints (e.g., CHECK (Age >= 0)).
    • NOT NULL for mandatory fields.
    • Length limits via CHAR/VARCHAR.

8.4 Worked example – Student table (AO1‑AO3)

CREATE TABLE Student (
    StudentID      INTEGER PRIMARY KEY AUTOINCREMENT,
    FirstName      VARCHAR(30) NOT NULL,
    LastName       VARCHAR(30) NOT NULL,
    DateOfBirth    DATE NOT NULL,
    Gender         CHAR(1) CHECK (Gender IN ('M','F','O')),
    Age            SMALLINT CHECK (Age >= 0),
    EnrolmentFee   DECIMAL(10,2) NOT NULL,
    IsFullTime     BOOLEAN NOT NULL,
    RegistrationDate TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
FieldSuggested data typeReasoning (syllabus points)
StudentIDINTEGER (auto‑increment, PK)Unique whole‑number identifier; smallest suitable integer type.
FirstName / LastNameVARCHAR(30)Variable‑length text; 30 characters is enough for typical names.
DateOfBirthDATEAllows age calculations and proper sorting.
GenderCHAR(1)Only one character needed; fixed length saves space.
AgeSMALLINTStudent ages never exceed 150 – SMALLINT is sufficient.
EnrolmentFeeDECIMAL(10,2)Exact monetary value; two decimal places avoid rounding errors.
IsFullTimeBOOLEANBinary choice – true if full‑time, false otherwise.
RegistrationDateTIMESTAMPRecords both date and time of registration automatically.

8.5 Common SQL statements (AO1)

  • SELECT – retrieve data
    SELECT FirstName, LastName FROM Student WHERE IsFullTime = TRUE;
  • INSERT – add a record
    INSERT INTO Student (FirstName, LastName, DateOfBirth, Gender, Age, EnrolmentFee, IsFullTime) VALUES ('Ada', 'Lovelace', '2000-12-10', 'F', 23, 1500.00, TRUE);
  • UPDATE – modify data
    UPDATE Student SET EnrolmentFee = EnrolmentFee * 1.05 WHERE Age >= 18;
  • DELETE – remove records
    DELETE FROM Student WHERE IsFullTime = FALSE AND Age < 18;
  • ORDER BY – sort results
    SELECT FirstName, EnrolmentFee FROM Student ORDER BY EnrolmentFee DESC LIMIT 5;
  • Aggregates – COUNT, SUM, AVG, MIN, MAX
    SELECT AVG(EnrolmentFee) FROM Student WHERE IsFullTime = TRUE;
  • GROUP BY – group rows for aggregation
    SELECT Gender, COUNT(*) FROM Student GROUP BY Gender;

8.6 Exam‑style practice (AO3)

  1. Identify the most appropriate data type for each field and write the full CREATE TABLE line:
    FieldTypical content
    PhoneNumbere.g. 07123456789
    Score0 – 100 (integer)
    CommentFree‑text up to 200 characters
    Joineddate and time of first login
  2. Write an SQL query that lists the three students with the highest EnrolmentFee, showing their full name (concatenated) and fee, ordered from highest to lowest.
  3. Explain why DECIMAL(10,2) is preferred to REAL for storing monetary values.
  4. A table Course has primary key CourseID INTEGER. Write the field definition for a foreign key CourseID in the StudentCourse table.
  5. Calculate the storage required (in bytes) for a table that contains 1 000 records with the fields: StudentID INTEGER, Age SMALLINT, IsFullTime BOOLEAN. (Assume 4 bytes for INTEGER, 2 bytes for SMALLINT, 1 byte for BOOLEAN.)

9. Quick Reference Sheet (exam cheat‑sheet)

Data typeTypical useSize (bytes)
INTEGERIDs, counts4
SMALLINTSmall whole numbers (age)2
REAL / FLOATMeasurements, scientific data4‑8 (implementation)
DECIMAL(p,s)Money, exact fixed‑pointVaries

Create an account or Login to take a Quiz

41 views
0 improvement suggestions

Log in to suggest improvements to this note.