IGCSE Computer Science Notes

Data Representation

Binary Number System

  • A number system based on the number 2.
  • Uses only two values: 0 and 1.
  • Typical headings for an eight-digit binary number:
    1286432168421128 \quad 64 \quad 32 \quad 16 \quad 8 \quad 4 \quad 2 \quad 1
  • Uses:
    • Processing data in logic gates.
    • Storing data in registers.
    • Processing data on computers.

Hexadecimal Number System

  • A number system based on the number 16.
  • Uses sixteen values: denary digits 0 to 9 and letters A to F.
    • A = 10, B = 11, C = 12, D = 13, E = 14, F = 15
  • Typical headings for a five-digit hexadecimal number:
    65536409625616165536 \quad 4096 \quad 256 \quad 16 \quad 1
  • Uses:
    • Error Codes:
      • Error messages generated by the computer.
      • Hexadecimal values indicate the memory location of the error.
    • HTML (HyperText Markup Language) Colour Codes:
      • Used in web page development to represent text colors.
      • Colors are combinations of red, green, and blue.
      • Intensity is determined by hexadecimal values.
    • MAC (Media Access Control) Address:
      • Uniquely identifies a device on a network.
      • Refers to the NIC (Network Interface Card).
      • Rarely changed; can be 48/64 bits.
      • Shown as 6 groups of two hexa digits: NN-NN-NN-DD-DD-DD.
      • Types:
        • Universally Administered MAC address:
          • Set by the manufacturer.
          • Rarely changed by user.
        • Locally Administered MAC address:
          • Easy to change.
    • Internet Protocol (IP) Address:
      • Unique address for each device on a network.
      • Assigned by the Internet Service Protocol (ISP).
      • Versions:
        • IPv4:
          • 32 bits.
          • Denary or hexadecimal.
          • Uses a decimal point (e.g., 139.103.20.92).
        • IPv6:
          • 128 bits.
          • Broken into 16 chunks.
          • Hexadecimal (e.g., 2202:f000:e:1f24:190e:323a:9377:d87b).
          • Advantages over IPv4:
            • Removes IP address collisions.
            • Built-in authentication checks.
            • More efficient packet routes.
      • Types:
        • Static:
          • Remains the same.
          • Used by remote servers, online databases, and FTP servers.
        • Dynamic:
          • Changes each time a device logs onto the internet.
          • Assigned by the ISP using Dynamic Host Configuration Protocol (DHCP).
FeatureDynamicStatic
PrivacyGreater PrivacyAllows devices to be fully traceable
AddressingLess reliable addressing typeAllow for faster upload and download speeds
VoIPVoIP connection fails due to IP address change
Maintenance CostsMore expensive to maintain as the device has to be running constantly for information

Why programmers use hexadecimal to represent binary data:

  • Easier to debug.
  • Easier to understand.
  • Takes up less screen space.
  • Less likely to make a mistake.

Denary Number System

  • A number system based on the number 10.
  • Uses values 0 - 10.
  • Typical headings for a denary number with five digits:
    10000100010010110000 \quad 1000 \quad 100 \quad 10 \quad 1

Converting Between Number Systems

  • Converting Binary to Denary:
  • Converting Denary to Binary:
    • Method 1:
    • Method 2:
      • Divide the number by 2, write the result of the division, including the remainder, and keep dividing until the result is 0.
      • Write down all the numbers in reverse.
  • Converting Binary to Hexadecimal:
  • Converting Hexadecimal to Binary:
  • Converting Hexadecimal to Denary:
    • Multiply each hex digit by its heading value.
    • Add all the totals together.
  • Converting Denary to Hexadecimal:
    • Divide the number by 16, write the result of the division, including the remainder, and keep dividing until the result is 0.
    • Write down all the numbers in reverse.

Addition of Binary Numbers

  • Addition of two binary digits:
Binary AdditionCarrySum
0 + 000
0 + 101
1 + 001
1 + 110
  • Addition of three binary digits:
Binary AdditionCarrySum
0 + 0 + 000
0 + 0 + 101
0 + 1 + 001
1 + 0 + 001
0 + 1 + 110
1 + 0 + 110
1 + 1 + 010
1 + 1 + 111
  • Example of binary addition:

Overflow

  • The result of a calculation that produces a value that is too large for the computer’s allocated word size.
  • Example of overflow (8-bit addition).
  • The formation of a 9-bit value indicates that the sum has exceeded this value.

Logical Shifts

  • Moving the bits to the left or right in a register.
  • Any bits shifted out of a register are replaced with zeros.
  • Left shift example:
    • Each left shift is equivalent to multiplying the binary number by 2.
  • Right shift example:
    • Each right shift is equivalent to dividing the binary number by 2.

Two’s Complement

  • A method of representing negative numbers in binary.
  • Example of Two’s Complement with -24:
    • Write the positive value in binary form (24).
    • Flip the number.
    • Add the number by 1.
    • Add up all the 1 values.
  • Converting a negative Two’s Complement number to positive:
    • Write the binary number of the negative number.
    • Flip the number and add it by 1.
    • Add up all the 1 values.

Character Sets

  • American Standard Code for Information Interchange (ASCII):
    • Set up in 1963.
    • Extended version released in 1986.
FeatureStandard ASCIIExtended ASCII
Character Set7-bit codes (0-127 values)8-bit codes (0-255 values)
Language SupportOnly supports EnglishSupports Latin languages
OtherIncludes graphical characters
  • Unicode:
    • Set up in 1991.
    • Represents all languages.
    • Character set consists of 16-bit codes and approximately 65000 characters.

Sound

  • Sound waves are analogue.
  • Converted to digital using an Analogue to Digital Convertor (ADC).
  • Sound waves are sampled at regular time intervals.
  • How sampling is used to record a sound clip:
    • Determine amplitude at set time interval.
    • Each sample is encoded as binary digits.
FeatureBenefitsDrawbacks
Sampling ResolutionLarger dynamic range, better sound quality, less distortionProduces larger file size, takes longer to download, requires greater processing power

Images

  • Features of high-resolution images:
    • Consists of many pixels, lots of detail.
    • File size increases.
    • Download time increases.

Measurement of Data Storage

  • Bit: Smallest unit of data.
  • Byte: 8 bits.
  • Nibble: 4 bits.
  • IEC memory size system:
Name of memory sizeNumber of bytesEquivalent denary value (bytes)
1 kibibyte (1 KiB)1 0241 024
1 mebibyte (1 MiB)1 048 5761 048 576
1 gibibyte (1 GiB)1 073 741 8241 073 741 824
1 tebibyte (1 TiB)1 099 511 627 7761 099 511 627 776
1 pebibyte (1 PiB)1 125 899 906 842 6241 125 899 906 842 624
1 exbibyte (1 EiB)1 152 921 504 606 846 9761 152 921 504 606 846 976

Data Compression

  • Necessary to save storage, reduce transfer time, reduce bandwidth, reduce costs.
  • Methods:
    • Lossy:
      • Permanently removes data.
      • Common algorithms:
        • MPEG-3: Used for music, reduces 90% of the audio file size. isn’t as sharp as the ones found in CDs/DVDs
        • MPEG-4: Used for videos, retains acceptable quality.
        • JPEG: Used for bitmap images, separates pixel colour from brightness.
    • Lossless:
      • Temporarily alters the data.
      • Common algorithms:
        • Run-Length Encoding: Groups repeating patterns and indexes them. Reduces the size of a string of adjacent, identical data

Data Transmission

Packet Structure

  • Header:
    • IP address of sender and receiver.
    • Sequence number of the packet.
    • Size of the packet.
  • Payload:
    • Actual data (around 64KiB).
  • Trailer:
    • Packet identification method.
    • Error-checking method (CRC).
      • Cyclic Redundancy Check:
        • Sender adds up all the 1-bits in the payload and stores this as a hex value in the trailer.
        • Receiver recalculates the number of 1-bits in the payload.
        • Compares values; if they match, no error; otherwise, re-send packet.

Packet Switching

  • Each packet follows its path.
  • Routers determine the path of each packet.
  • Routing selection depends on the number of packets waiting to be processed at each node.
  • Shortest possible path is chosen.
  • Packets can arrive in a different order than they were sent.

Methods of Data Transmission

  • Serial:
    • Data sent one bit at a time down a single wire.
AdvantagesDisadvantages
Less chance of data being skewedSlower rate of data transmission
Less chance of error in the dataAdditional data may need to be sent to indicate to the receiving device when the data transmission has started and stopped.
Cheaper to manufacture; only one wire is needed for serial data transmission
  • Parallel:
    • Data sent multiple bits at a time down multiple wires.
AdvantagesDisadvantages
Faster rate of data transmissionHigher chance of data being skewed
Common method of data transmission among devicesHigher chance of error in the data
More costly; multiple wires are used
  • Simplex:
    • Data transmitted in a single direction only.
  • Half-Duplex:
    • Data transmitted in both directions, but only one direction at a time.
  • Full-Duplex:
    • Data transmitted in both directions simultaneously.

Universal Serial Bus (USB)

  • Industry standard for data transmission.
  • Includes:
    • Port: Socket for inserting a USB cable.
    • Cable: Transmission media using the USB method.
    • Connection: Using a USB cable plugged into a USB port to transfer data.
    • Device: Device that plugs into a USB port.
  • Uses serial data transmission at high speeds.
AdvantagesDisadvantages
High rate of transmissionThe length of a USB cable is limited (up to 5 metres)
It is a simple interface; the cable to device can only fit into the USB one wayRate of transmission isn’t as high as compared to other types of connection like Ethernet
A USB port is included in many devices as it’s an industry standard
When inserted into a USB cable, it is automatically detected by the device
No need for another power source as it can be used to power a device

Methods of Error Detection

  • Errors can occur during data transmission due to interference, leading to data loss, gain, or change.
  • Methods:
    • Parity Check:
      • Adds an additional bit to each byte to create an odd or even sum.
      • Before transmission:
        • the parity check is set to be either odd or even parity.
        • If an odd parity check is used - then a 1 is added as a parity bit. This is because all the ls in the byte now add up to an odd number
        • If an even parity check is used - then a 0 is added as a parity bit. This is because all the ls in the byte now add up to an even number
      • After transmission:
        • the receiving device will check each byte of data for errors.
        • if an odd parity check has been used and the device finds a byte that has an even number of 1s, then it knows that an error has occurred with this byte of data.
        • the same can be said if an even parity check has been used and the device finds a byte that has an odd number of 1s.
    • Checksum:
      • A calculation is performed on the data to create a checksum value.
      • A checksum is calculated and added to the data before transmission.
      • After receiving the data, the receiving device calculates its own checksum.
      • If the two checksums match, the data is error-free; if they don't, an error is detected.
    • Echocheck:
      • A copy of the transmitted data is sent back to the sender to be compared with the original data sent.
      • The sending device compares the data it sent to the data it has received back from the receiving device to see if they match.
      • If they do, then no error has occurred.
      • If they don't match, then the sending device knows the data was received with error
    • Automatic Repeat Request (ARQ):
      • Uses acknowledgement and timeout to see if data has arrived correctly after transmission.
      • Positive acknowledgement method:
        • The sending device transmits the first data packet.
        • The receiving device receives the data and checks it for errors.
        • Once the receiving device knows it has received the data error free, it sends a positive acknowledgement back to the sending device.
        • When the sending device receives this positive acknowledgement, it knows the receiving device has received the data packet error free and it sends the next data packet.
        • If the sending device does not receive a positive acknowledgement within a set timeframe, a timeout occurs.
        • When a timeout occurs, the sending device will resend the data packet. It will keep doing this when a timeout occurs, until it receives a positive acknowledgement
        • Sometimes a limit (such as 20 times) is set and when this limit is reached it will stop resending the data.
      • Negative acknowledgement method:
        • The sending device transmits the first data packet.
        • The receiving device receives the data packet and checks it for errors .
        • If the receiving device detects no errors, no further action is taken .
        • If the receiving device does detect errors, it will send a negative acknowledgement back to the sender.
        • If the sender receives a negative acknowledgement, it knows this means the data was received incorrectly, so it can resend the data packet.
        • A timeout is set by the sending device when it sends the data. This is just so that the sending device knows that if it doesn't receive a negative acknowledgement back within that set time period, it doesn't need to be still waiting for it and can send the next data packet.
    • Check Digit:
      • Used for data entry.
      • A calculation is performed on the data entered to create a value.
      • Check digit values are compared to see if the data entered is correct.
      • How it operates:
        • A check digit is pre-calculated and stored with the data (e.g., barcode or ISBN).
        • When the data is entered or scanned, the check digit is recalculated.
        • If the recalculated check digit matches the stored one, the data is correct.
        • If the recalculated check digit does not match the stored one, the data is incorrect.

Encryption

  • A method of securing data for storage or transmission that scrambles it and makes it meaningless.
  • Methods:
    • Symmetric Encryption:
      • Uses the same key to encrypt and decrypt data.
      • Process:
        • Plain text is encrypted into cipher text using an encryption key.
        • The cipher text and the encryption key are sent separately to the receiving device.
        • The same key is then used to decrypt the ciphertext back into its plain text form.
    • Asymmetric Encryption:
      • Uses two different keys (public and private keys) to encrypt and decrypt data.
      • Process:
        • Plain text is encrypted into cipher text using a public key. (This is also a type of encryption algorithm.)
        • The cipher text is transmitted to the receiving device.
        • The cipher text cannot be decrypted using the public key, it is decrypted using a private key.

Hardware

The CPU: Central Processing Unit

  • CPUs are used for processing and executing instructions and data that are input into the computer so that the result can be output.
  • A microprocessor is a type of integrated circuit on a single chip that usually performs less functions as compared to a regular CPU.
  • Components of a CPU
    • Units:
      • Arithmetic Logic Unit (ALU):
        • Deals with arithmetic operations (addition, subtraction, etc.).
        • Handles logical operations (AND, OR, NOT, etc.).
      • Control Unit (CU):
        • Manages and synchronizes data and instruction transfer in the CPU.
        • Sends control signals to other components.
        • Decodes instructions.
    • Registers:
      • High-speed memory components in the CPU that temporarily store important information.
      • Types:
        • Program Counter (PC): Stores the memory address of the next instruction to be processed.
        • Memory Address Register (MAR): Stores the memory address of the instruction/data that is about to be fetched from the RAM
        • Memory Data Register (MDR): Stores data or instructions that have just been fetched from the RAM
        • Current Instruction Register (CIR): Stores the instruction that is currently being processed or decoded by the CPU
        • Accumulator (ACC): Stores any interim values or final values created during arithmetic or logical operations done by the ALU
    • Buses:
      • Communication systems within the computer that transfer data and instructions between components
      • Types:
        • Address bus: Carries the memory address of data/instructions.
        • Data bus: Carries actual data/instructions.
        • Control bus: Carries control signals to and from the CU.

The Fetch-Decode-Execute Cycle

  • Fetch:
    • Fetching data or instructions from memory to the CPU.
    • Steps:
      1. The Program Counter stores the address of the next instruction to be processed. This is copied to the Memory Address Register via the address bus.
      2. The Memory Address Register copies this address to the RAM via the address bus.
      3. The RAM uses the address sent to it to locate the data or instruction that must be processed.
      4. The RAM copies the data/instruction to the Memory Data Register via the data bus.
      5. The Memory Data Register copies the data/instruction to the Current Instruction Register, via the data bus, where it will be processed.
      6. The Program Counter is incremented so that the address of the next instruction is contained in it.
  • Decode:
    • Decoding the data/instruction, carried out by the Control Unit using an instruction set.
    • An instruction set is a set of instructions written in low-level machine code that tells the computer how to carry out specific functions. They are the only instructions understood by the CPU.
  • Execute:
    • Carrying out any final arithmetic or logical operations and then finish executing the instruction.
    • The Arithmetic and Logical Unit is responsible for carrying out any such operations. It used the Accumulator to store any interim values created during execution.
    • After all calculations are finished, the command is executed.
    • The entire process repeats for each piece of data or instruction that needs to be carried out by the CPU.

Increasing the CPU’s Performance

  • Cache:
    • Internal, temporary storage space inside the CPU.
    • Stores data and instructions used regularly by the CPU.
    • More cache means more data/instructions can be stored nearby, reducing retrieval time.
    • However, an extremely large cache would take more time to look through while fetching information, causing significant delays which would render the cache useless. So, there must be a limit for the cache size.
  • Clock:
    • The System Clock is located inside the CPU. Its job is to control the processing speed and time taken to execute instructions, as well as control the time intervals between each task and synchronise the entire FDE cycle. Short, it controls the number of FDE cycles completed each second.
    • Clock speed is measured in Hertz (instructions / second).
    • Higher clock speed means that more instructions are processed each second, increasing performance.
    • However, increasing clock speed too much can cause overheating.
  • Cores:
    • Are the components in the computer that run the FDE cycle. Each core can run one cycle, i.e process one instruction, at a time.
    • A higher number of cores in a computer means that more instructions can be processed at once.
    • This allows a computer to multitask, which increases the computer’s performance.

Embedded Systems

  • A combination of software and hardware built into a device, running on firmware, and performing a dedicated function.
  • Differ from general-purpose computers by performing only a specific task.
  • Used in:
    • Domestic appliances
    • Cars
    • Security systems
    • Lighting systems
    • Vending machines
AdvantagesDisadvantages
They are smallThey are difficult to update
They are cheapThey are susceptible to hacking
They can be remote-controlledSpecialists are needed for repairs
No operating system is neededThere are environmental concerns regarding their disposal
They use very less powerThey may have a confusing interface

Input Devices

  • Allow data to be entered into the system.
  • Examples:
    • Barcode scanner
    • Digital camera
    • Keyboard
    • Microphone
    • Optical mouse
    • QR code scanner
    • Touch screen
      • Resistive
      • Capacitive
      • Infra-red
    • Two-dimensional (2D) and three-dimensional (3D) scanners

Output Devices

  • Used to tell user information.
  • Examples:
    • Actuator
    • Digital light processing (DLP) projector
    • Inkjet printer
    • Laser printer
    • Light emitting diode (LED) screen
    • Liquid crystal display (LCD) screen
    • Liquid crystal display (LCD) projector
    • Speaker
    • 3D printer

Sensors

  • Input devices that capture analogue data from their immediate environment at set time intervals.
SensorData RecordedUses
AcousticSound levels of an environmentSecurity systems - to detect intruders
AccelerometerAny forces of acceleration acting on the environmentEarthquake warnings
FlowThe amount of liquid/gas/steam flowing/moving through an environmentPipes or plumbing
GasThe amount and concentration of a gasCarbon monoxide detectors in houses
HumidityThe humidity levels in an environmentGreenhouses - to ensure the internal humidity is not too much or too less
Infra-redAny infra-red rays presentSecurity systems
LevelThe level or volume a liquid/gas substance is atAmount of fuel in vehicles
LightThe light levels of an environmentAutomatic lighting
Magnetic fieldAny magnetic fields present in the environmentDetecting cars in parking lots or bridges
MoistureThe moisture present in the environment/any substancesDetecting moisture levels in soil (agriculture-related)
pHThe pH level of a substanceWater bodies to check level of pollution, or detecting soil pH levels to ensure plant health
PressureThe pressure which is being exerted on the sensorSecurity systems to detect intruders
ProximityHow close an object is to the sensorUsed in robots or automatic doors
TemperatureThe temperature of the environmentAutomatic cooling systems

Data Storage

  • Primary Storage:
    • Data directly accessible by the CPU.
    • Examples: RAM and ROM.
  • Secondary Storage:
    • Data not directly accessible by the CPU and not currently required by the CPU.
    • Non-volatile (data is not lost if power is switched off).
    • Stores data permanently until deleted by the user.
    • Stores data that can be transferred to other computers.
    • Examples: Pen drives and CDs.
Primary Storage: RAM and ROM
  • RAM:
    • Stores data temporarily (volatile).
    • Stores data and instructions currently in use by the CPU.
    • Example: Program files for an open application.
  • ROM:
    • Stores data permanently (non-volatile).
    • Stores programs required for the computer to boot initially.
    • Example: BIOS (Basic input/output system)
FeatureRAMROM
VolatilityTemporary storage (volatile)Permanent storage (non-volatile)
DataStores data currently in use by CPUStores programs that initially boot the computer
ContentsContents are constantly changingContents are fixed and not typically changed
Size IncreaseIt is easy to increase the RAM’s sizeIt’s difficult to increase or decrease the size of the ROM
Secondary Storage: Magnetic, Optical and Solid-State
  • Secondary storage needs to be fetched into the primary memory first, to be accessed by the CPU.
  • It can be of two types: internal, such as solid-state drives or hard-disk drives, or external, such as CDs or DVDs.
  • Magnetic Storage:
    • Uses magnetised and demagnetised dots to store data.
    • A circle disk, known as a platter, spins very fast, with a read-write head over it. The read/write head magnetises and demagnetises dots on the platter as required.
    • The platter is divided into tracks and sectors.
    • The current state of a dot (i.e. whether magnetised or not) decides its stored value. For example, all magnetised dots store the value “1”, and all demagnetised dots store the value “0”.
    • Example: Hard disk drive.
  • Optical Storage:
    • Uses circular discs and lasers to store data.
    • The disc is rotated or spun with a read/write head over it, which uses a laser beam.
    • The laser beam makes indentations on the surface of the disc by burning data onto it. An indentation is known as a pit while the space between indentations are known as lands
    • The pits and lands represent binary values, for example, a pit represents a “1” while a land represents a “0”.
    • The data is written in a spiral or circular pattern around the disc.
    • Examples: CDs, DVDs, and Blu-Rays.
  • Solid-State Storage:
    • Also known as flash storage.
    • Uses transistors and cells to store data, onto which the data is ‘flashed’. These transistors and cells are arranged on a semiconductor chip.
    • Transistors are laid out to form a grid. They are used to form a control gate, which is above a floating gate, at each intersection in the grid.
    • The transistors control the flow of electrons in the semiconductor chip. They flow through the control gate to the floating gate, where they are stored.
    • After storing the electrons, the binary value of the transistor changes – i.e, from “1” to “0”.
    • Typically, a NAND or NOR structure is used for solid-state storage,
    • Examples: Pen-drives and solid-state drives (SSDs)

Virtual Memory

  • A sectioned-off segment of the hard disk drive, which acts as an extension to the primary memory (RAM).
  • Required for when the RAM is full but more data transfer needs to take place.
  • How it operates:
    1. Data in the RAM is split into pages
    2. The pages which are not currently being used by the CPU or which are not immediately required are sent to the virtual memory. This clears up space in the RAM.
    3. Any new data that the RAM now requires is imported from the secondary storage.
    4. Once the data in the RAM is no longer needed, it is sent back to secondary storage. The pages the RAM initially sent to the virtual memory are fetched back.
  • Virtual memory is important as the RAM is at risk of overloading from excess data and crashing. The virtual memory helps ensure that this does not happen.

Cloud Storage

  • Data stored by a third-party remote server instead of in local storage.
  • Accessible via the internet.
FeatureCloud StorageLocal Storage
AccessibilityAccessible everywhere, but only if you have an internet connectionOnly accessible as long as you have your storage with you, but doesn’t require the internet
CostsThere is no hardware cost, and you do not have to manage your own hardwareYou have to pay for your own hardware, as well as keep it secure
SecurityTrusting a third party with personal data may be unsafe, as they could use it for malicious reasonsThere is no need to rely on a third-party – you are fully in control of your own data, which means there are less privacy issues
Back UpBack-up of your data is easily availableNot available
Storage SizeIt is easy to increase and decrease the amount of storage space you haveChanging the storage size may be difficult.

Network Interface Card

  • The Network Interface Card (NIC) is a hardware component that is required by the computer to access any networks by connecting to routers.
  • It also contains the MAC address.

Media Access Control Address

  • A Media Access Control (MAC) address uniquely identifies each computer on a network, which is provided by the manufacturer when the computer is created.
  • It is located on the NIC.
  • Structure:
    • Written in hexadecimal.
    • NN – NN – NN – DD – DD – DD; the first six digits comprise the manufacturer’s code, while the last six digits