Skip to content

Computing Systems

The Internet and Computing Systems (CED Unit 4)

Hardware Components

ComponentFunction
CPUExecutes instructions, performs calculations
RAMVolatile memory for currently running programs
Hard drive / SSDNon-volatile storage for persistent data
GPUProcesses graphics and parallel computations
MotherboardConnects all components
Power supplyProvides electrical power
Input devicesKeyboard, mouse, microphone, camera
Output devicesMonitor, speakers, printer

The Fetch-Decode-Execute Cycle

The CPU continuously:

  1. Fetch: Read the next instruction from memory (address in the program counter).
  2. Decode: Interpret the instruction.
  3. Execute: Perform the operation.
  4. Store: Write the result back to memory or a register.

Detailed step-by-step:

  1. The address in the Program Counter (PC) is copied to the Memory Address Register (MAR).
  2. The instruction at that address is fetched from memory into the Memory Data Register (MDR).
  3. The PC is incremented to point to the next instruction.
  4. The instruction in the MDR is copied to the Current Instruction Register (CIR).
  5. The Control Unit (CU) decodes the instruction in the CIR.
  6. The instruction is executed (ALU performs calculations, data is moved between registers).

Worked Example. Trace the FDE cycle when PC = 200 and memory[200] contains “ADD R1, R2” (add Register R2 to register R1).

  1. Fetch: MAR \leftarrow 200, MDR \leftarrow “ADD R1, R2”, PC \leftarrow 201, CIR \leftarrow “ADD R1, R2”.
  2. Decode: CU identifies this as an addition instruction. Source: R2, destination: R1.
  3. Execute: ALU computes R1 + R2, result stored in R1.

Binary and Data Representation

Computers represent all data in binary (0s and 1s).

Data TypeRepresentation
IntegerTwo’s complement (signed integers)
CharacterASCII (7-bit) or Unicode (16+ bit)
ColorRGB values (24 bits, 8 per channel)
ImageGrid of pixels, each with RGB values
AudioSampled amplitude values

Two’s Complement

For an nn-bit number:

  • Range: 2n1-2^{n-1} to 2n112^{n-1} - 1
  • 8-bit: 128-128 to 127127
  • 16-bit: 32768-32768 to 3276732767
  • 32-bit: 2147483648-2147483648 to 21474836472147483647

Negation: Flip all bits and add 1.

Example

Represent 42-42 in 8-bit two’s complement.

4242 in binary: 0010101000101010.

Flip bits: 1101010111010101.

Add 1: 1101011011010110.

Verification: 11010110=128+64+0+16+0+4+2+0=128+86=4211010110 = -128 + 64 + 0 + 16 + 0 + 4 + 2 + 0 = -128 + 86 = -42. Correct.

Worked Example. Represent 100-100 in 8-bit two’s complement.

100=01100100100 = 01100100.

Flip: 1001101110011011.

Add 1: 1001110010011100.

Verify: 128+16+8+4=100-128 + 16 + 8 + 4 = -100. Correct.

Why two’s complement is preferred. Two’s complement has the useful property that addition and Subtraction use the same circuitry. To subtract aba - bYou add aa to the two’s complement Of bb. There is no separate subtraction circuit needed.

Proof of two’s complement negation. For nn-bit xx where 0<x2n10 \lt x \le 2^{n-1}Let xˉ\bar{x} Be the bitwise complement. Then xˉ=(2n1)x\bar{x} = (2^n - 1) - x. Adding 1: xˉ+1=2nx\bar{x} + 1 = 2^n - x. In nn-bit arithmetic, 2n02^n \equiv 0So x+(xˉ+1)=0x + (\bar{x} + 1) = 0Confirming xˉ+1=x\bar{x} + 1 = -x. \blacksquare

Overflow detection. If adding two positive numbers produces a negative result (or vice versa), Overflow has occurred. The sign bit flips unexpectedly. Java does not throw an exception for integer Overflow — the result wraps around.

Worked Example. Compute 100+50100 + 50 in 8-bit two’s complement.

100=01100100100 = 01100100, 50=0011001050 = 00110010.

Sum: 1001011010010110.

The MSB is 1, indicating a negative result. 10010110=128+16+4+2=10610010110 = -128 + 16 + 4 + 2 = -106. This is incorrect (100+50=150100 + 50 = 150Which exceeds the 8-bit range). Overflow has occurred.

Hexadecimal

Base-16 representation, using digits 0—9 and A—F.

BinaryHexDecimal
000000
000111
001022
001133
010044
010155
011066
011177
100088
100199
1010A10
1011B11
1100C12
1101D13
1110E14
1111F15

Conversion: group binary digits in groups of 4 from right to left.

10110110_2 = \mathrm{B6_{16}

Uses of hexadecimal: Colour codes (#RRGGBB in HTML/CSS), memory addresses, MAC addresses, error Codes, assembly language.

Worked Example. Convert FF from hexadecimal to binary and decimal.

Binary: 1111111111111111. Decimal: 15×16+15=25515 \times 16 + 15 = 255.

Worked Example. Convert 3A7 from hexadecimal to decimal.

3×256+10×16+7=768+160+7=9353 \times 256 + 10 \times 16 + 7 = 768 + 160 + 7 = 935.

Representing Images

An image is a grid of pixels. Each pixel’s colour is represented by binary values.

  • Colour depth: Number of bits per pixel (1 bit = 2 colours, 24 bits = 16,777,216 colours).
  • Resolution: Width ×\times height in pixels.

\mathrm{File size (bits) = \mathrm{width \times \mathrm{height \times \mathrm{colour depth

Worked example. A 1920×10801920 \times 1080 image with 24-bit colour:

1920 \times 1080 \times 24 = 49766400 \mathrm{ bits \approx 5.93 \mathrm{ MB

Representing Sound

Sound is digitised by sampling the amplitude of an analogue wave at regular intervals.

  • Sample rate: Samples per second (Hz). CD quality: 44,100 Hz.
  • Bit depth: Bits per sample. CD quality: 16-bit.
  • Channels: Mono (1) or stereo (2).

\mathrm{File size (bits) = \mathrm{sample rate \times \mathrm{bit depth \times \mathrm{duration \times \mathrm{channels

Worked Example. A 2-minute stereo recording at 48000 Hz with 16-bit depth.

48000×16×120×2=18432000048000 \times 16 \times 120 \times 2 = 184320000 bits 22\approx 22 MB.

Logic Gates and Boolean Logic (CED Unit 4)

Basic Gates

GateSymbolBoolean ExpressionTruth Table
ANDA AND BA \cdot B1 only if both inputs are 1
ORA OR BA + B0 only if both inputs are 0
NOTNOT AAˉ\bar{A}Inverts input
NANDA NAND BAB\overline{A \cdot B}NOT AND
NORA NOR BA+B\overline{A + B}NOT OR
XORA XOR BABA \oplus B1 if inputs differ

Truth Tables

AND gate:

ABA AND B
000
010
100
111

XOR gate:

ABA XOR B
000
011
101
110

De Morgan’s Laws

AB=Aˉ+Bˉ\overline{A \cdot B} = \bar{A} + \bar{B}

A+B=AˉBˉ\overline{A + B} = \bar{A} \cdot \bar{B}

Intuition. De Morgan’s Laws say that the negation of a conjunction is the disjunction of the Negations, and vice versa. “It is not true that both A and B are true” is equivalent to “A is false Or B is false.”

Application in circuit design. If you need a NOR gate but only have NAND gates available, De Morgan’s Laws let you convert between gate types.

Worked Example. Simplify ABˉ\overline{A \cdot \bar{B}} using De Morgan’s Laws.

ABˉ=Aˉ+Bˉ=Aˉ+B\overline{A \cdot \bar{B}} = \bar{A} + \overline{\bar{B}} = \bar{A} + B.

Proof of De Morgan’s first law by truth table:

ABABA \cdot BAB\overline{A \cdot B}Aˉ\bar{A}Bˉ\bar{B}Aˉ+Bˉ\bar{A} + \bar{B}
0001111
0101101
1001011
1110000

Columns 4 and 7 are identical. \blacksquare

Constructing Circuits

Any Boolean function can be implemented using only NAND gates or only NOR gates (functional Completeness).

Example

Implement XOR using AND, OR, and NOT gates.

AB=(ABˉ)+(AˉB)A \oplus B = (A \cdot \bar{B}) + (\bar{A} \cdot B)

This requires: 2 NOT gates, 2 AND gates, 1 OR gate.

Truth table verification:

ABAˉ\bar{A}Bˉ\bar{B}ABˉA \cdot \bar{B}AˉB\bar{A} \cdot BABA \oplus B
0011000
0110011
1001101
1100000

Half Adder and Full Adder

Half adder: Adds two single bits. Produces sum and carry.

\mathrm{Sum = A \oplus B

\mathrm{Carry = A \cdot B

Full adder: Adds two bits and a carry-in. Produces sum and carry-out.

\mathrm{Sum = A \oplus B \oplus C_{\mathrm{in}

C_{\mathrm{out} = (A \cdot B) + (C_{\mathrm{in} \cdot (A \oplus B))

Why full adders matter. A full adder can be chained to add multi-bit numbers. To add two 8-bit Numbers, chain 8 full adders: the carry-out of each stage becomes the carry-in of the next. The Final carry-out is the 9th bit of the result.

Worked Example. Add 0110 and 0011 using half adders and full adders.

Position3 (MSB)210 (LSB)
A0110
B0011
Carry in0010
Sum0101
Carry out0010

Result: 01001=901001 = 9. Check: 6+3=96 + 3 = 9. Correct.

Operating Systems (CED Unit 4)

An operating system (OS) manages hardware and provides services for applications.

Functions of an OS

  1. Process management: Schedules and manages running programs (processes).
  2. Memory management: Allocates memory to processes, virtual memory, paging.
  3. File system management: Organizes, stores, and retrieves files.
  4. Device management: Controls hardware devices through drivers.
  5. User interface: Provides a way for users to interact with the computer (GUI or CLI).
  6. Security: Authentication, authorization, access control.

Virtual memory. When RAM is full, the OS swaps inactive pages to disk. A page fault occurs When the CPU accesses data that has been swapped out. The OS loads the required page from disk into RAM, which is much slower than a RAM access.

Worked Example. A computer has 4 GB of RAM. Programs require 6 GB total. The OS uses 2 GB of Virtual memory on the SSD. What happens when a program accesses data in virtual memory?

A page fault occurs. The OS suspends the program, loads the required page from the SSD into RAM (swapping out a less recently used page if necessary), and resumes the program. This takes Milliseconds instead of nanoseconds, causing a noticeable delay.

Types of Operating Systems

TypeExamplesCharacteristics
DesktopWindows, macOS, LinuxPersonal use, multitasking
MobileiOS, AndroidTouch-optimized, app-based
ServerWindows Server, LinuxNetwork services, high uptime
EmbeddedRTOS, firmwareLimited resources, dedicated
Real-timeVxWorks, FreeRTOSGuaranteed response times

The Role of the Kernel

The kernel is the core part of the OS that runs with full hardware access. It manages memory, Processes, and devices. User applications run in user mode with restricted access; system calls Request the kernel to perform privileged operations on their behalf.

Software Development (CED Unit 5)

The Development Life Cycle

  1. Requirements analysis: Understand what the software should do.
  2. Design: Plan the architecture and algorithms.
  3. Implementation: Write the code.
  4. Testing: Verify correctness and fix bugs.
  5. Deployment: Release the software to users.
  6. Maintenance: Update and fix issues over time.

Software Testing

TypeDescription
Unit testingTesting individual components
Integration testingTesting interactions between components
System testingTesting the entire system
Acceptance testingTesting against user requirements
Black-box testingTesting based on inputs/outputs (no code access)
White-box testingTesting based on internal code structure

Black-box vs white-box. Black-box testing verifies that the system produces correct outputs for Given inputs, without examining the code. White-box testing examines the code structure to ensure Every path is tested (e.g., every branch of every if statement).

Worked Example. A function isValidAge(age) returns true if 0 \le age \le 120.

Black-box tests: age = -1 (invalid), 0 (boundary, valid), 60 (normal, valid), 120 (boundary, valid), 121 (invalid), 200 (invalid).

White-box tests: additionally verify each branch of the if statement is taken.

Version Control

  • Tracks changes to source code over time.
  • Enables collaboration (multiple developers).
  • Supports branching and merging.
  • Common tools: Git, Subversion.

Git concepts. A repository is a project folder tracked by Git. A commit is a snapshot of The project at a point in time. A branch is an independent line of development. A pull Request proposes merging one branch into another.

Additional Topics

Representing Negative Numbers in Programming

In Java, int is a 32-bit two’s complement integer. The range is 2147483648-2147483648 to 21474836472147483647.

Worked Example. What happens when you compute 2000000000 + 2000000000 in Java?

2000000000+2000000000=40000000002000000000 + 2000000000 = 4000000000. This exceeds 2311=21474836472^{31} - 1 = 2147483647. In 32-bit two’s Complement, the result wraps around to 4000000000232=2949672964000000000 - 2^{32} = -294967296.

Bitwise Operators in Java

OperatorNameDescription
&ANDBitwise AND
|ORBitwise OR
^XORBitwise XOR
~NOTBitwise complement (inverts all bits)
&lt;&lt;Left shiftShifts bits left, fills with zeros
&gt;&gt;Right shiftShifts bits right, fills with sign bit
int a = 12; // 00001100
int b = 10; // 00001010
int c = a & b; // 00001000 = 8
int d = a | b; // 00001110 = 14
int e = a ^ b; // 00000110 = 6

Character Encoding in Java

Java uses UTF-16 internally for char. ASCII characters (0—127) map directly to Unicode code Points.

char ch = 'A'; // Unicode code point 65
int codePoint = (int) ch; // 65
char upper = (char) ('a' - 32); // 'A'

Comparing Storage Devices

MetricHDDSSD
Read speed50-200 MB/s200-550 MB/s
Write speed50-150 MB/s200-500 MB/s
Latency5-10 ms0.05-0.1 ms
IOPS100-2005000-100000
Cost per GBLowHigher
DurabilityMechanical partsNo moving parts
Power usageHigherLower

IOPS (Input/Output Operations Per Second) measures how many read/write operations a drive can Perform per second. SSDs excel here due to having no moving parts.

BIOS vs UEFI

BIOS (Basic Input/Output System): Legacy firmware interface. 16-bit, limited to 2.2 TB drives.

UEFI (Unified Extensible Firmware Interface): Modern replacement. 32-bit/64-bit, supports drives Larger than 2.2 TB, secure boot, graphical interface.

Number Systems and Conversions

Decimal to Binary

Repeatedly divide by 2 and record remainders.

Worked Example. Convert 20010200_{10} to binary.

200/2=100200 / 2 = 100 r 0, 100/2=50100 / 2 = 50 r 0, 50/2=2550 / 2 = 25 r 0, 25/2=1225 / 2 = 12 r 1, 12/2=612 / 2 = 6 R 0, 6/2=36 / 2 = 3 r 0, 3/2=13 / 2 = 1 r 1, 1/2=01 / 2 = 0 r 1.

Reading bottom to top: 11001000211001000_2.

Binary to Decimal

Multiply each bit by its position value and sum.

Worked Example. Convert 11010110211010110_2 to decimal.

128+64+16+4+2=214128 + 64 + 16 + 4 + 2 = 214.

Hexadecimal Conversions

Worked Example. Convert 3A7 from hex to decimal.

3imes256+10imes16+7=768+160+7=9353 imes 256 + 10 imes 16 + 7 = 768 + 160 + 7 = 935.

Worked Example. Convert FF from hex to binary and decimal.

Binary: 1111111111111111. Decimal: 15imes16+15=25515 imes 16 + 15 = 255.

Binary Arithmetic

Addition rules:

0+00 + 00+10 + 11+01 + 01+11 + 1
01110 (0 carry 1)

Worked Example. Add 0110 and 0011.

0110+0011=1001=90110 + 0011 = 1001 = 9. Check: 6+3=96 + 3 = 9. Correct.

Worked Example. Add 1011 and 0110.

1011+0110=10001=171011 + 0110 = 10001 = 17. Check: 11+6=1711 + 6 = 17. Correct.

Operating Systems in Detail

Process States

A process can be in one of several states:

  1. New: Being created.
  2. Ready: Waiting for CPU time.
  3. Running: Currently executing on the CPU.
  4. Blocked/Waiting: Waiting for I/O or a resource.
  5. Terminated: Finished execution.

Memory Management Techniques

Paging: Memory is divided into fixed-size pages. The OS maps virtual pages to physical frames.

Segmentation: Memory is divided into variable-size segments based on logical divisions (code, Data, stack).

Worked Example. A process needs 12 KB but the OS uses 4 KB pages. How many pages are needed?

12/4=312 / 4 = 3 pages.

File Systems

File allocation methods:

  • Contiguous: Files stored in consecutive blocks. Fast access but causes fragmentation.
  • Linked: Each block points to the next. No fragmentation but slow random access.
  • Indexed: An index block contains pointers to all data blocks. Fast random access.

Directory structures:

  • Flat: All files in one directory.
  • Hierarchical: Tree structure with folders and subfolders (most common).

Utility Programs

UtilityPurpose
Disk defragmenterReorganises data on a HDD for faster access
Disk cleanerRemoves unnecessary files to free up space
AntivirusDetects and removes malware
Compression softwareCompresses and decompresses files
Backup softwareCreates copies of data for recovery
FirewallMonitors and filters network traffic

Disk defragmentation. On a HDD, files can become fragmented — stored in non-contiguous clusters Across the disk. This slows down reading because the read head must move to multiple locations. Defragmentation reorganises files into contiguous blocks. Note: SSDs do not need defragmentation and It can actually reduce their lifespan.

Practice Questions

  1. Convert the decimal number 200200 to 8-bit binary.

  2. Explain the difference between paging and segmentation in memory management.

  3. A computer has a 32-bit address bus and runs at 3.2 GHz. Calculate the maximum addressable memory and the maximum data transfer rate if the data bus is 64 bits wide.

  4. Explain three differences between BIOS and UEFI.

  5. Design a truth table for the Boolean expression (A \cdot B) + (ar{A} \cdot C).

  6. Explain the difference between contiguous and linked file allocation methods.

  7. A program needs 20 KB of memory but the OS uses 4 KB pages. How many page table entries are needed?

  8. Explain what a device driver is and why it is necessary. Give an example.

  9. Calculate the result of 11012+101121101_2 + 1011_2. Show all carries.

  10. Explain the principle of least privilege in the context of operating system security.

  11. A system has three processes: P1 (8 MB), P2 (16 MB), P3 (4 MB). The system has 32 MB of RAM. Explain how virtual memory allows all three processes to run simultaneously.

  12. Explain the role of the kernel in an operating system. What is the difference between user mode and kernel mode?

Additional Number System Practice

Worked Example. Convert 11010110211010110_2 to hexadecimal.

Group into 4s: 1101 0110=extD6161101\ 0110 = ext{D6}_{16}.

Worked Example. Convert extA3F_16 ext{A3F}\_{16} to binary.

A = 1010, 3 = 0011, F = 1111. Result: 1010001111112101000111111_2.

Worked Example. Convert ext2B_16 ext{2B}\_{16} to decimal.

2imes16+11=432 imes 16 + 11 = 43.

Logic Circuits in Practice

Constructing a Half Adder

A half adder adds two single bits:

extSum=AB ext{Sum} = A \oplus B extCarry=AB ext{Carry} = A \cdot B

Implementation using basic gates: 1 XOR gate (sum), 1 AND gate (carry).

Constructing a Full Adder

A full adder adds two bits and a carry-in:

extSum=ABC\*extin ext{Sum} = A \oplus B \oplus C\*{ ext{in}}

Cextout=(AB)+(C_extin(AB))C*{ ext{out}} = (A \cdot B) + (C\_{ ext{in}} \cdot (A \oplus B))

Implementation: 2 XOR gates, 2 AND gates, 1 OR gate.

Worked Example. Add 77 and 55 using full adders (4-bit).

Position3 (MSB)210 (LSB)
A0111
B0101
Carry in0100
Sum1100
Carry out0010

Result: 1100=121100 = 12. Check: 7+5=127 + 5 = 12. Correct.

Software Development in Detail

Version Control with Git

Git tracks changes to source code over time. Key concepts:

  • Repository: A project folder tracked by Git.
  • Commit: A snapshot of the project at a point in time.
  • Branch: An independent line of development.
  • Pull request: Proposes merging one branch into another.
  • Clone: Copy a remote repository to your local machine.

Common Git commands:

CommandPurpose
git initCreate a new repository
git add .Stage all changes
git commit -m "msg"Commit staged changes
git pushUpload commits to remote
git pullDownload and merge changes
git branch nameCreate a new branch
git checkout branchSwitch to a branch
git merge branchMerge a branch into current
git logView commit history

Integrated Development Environments (IDEs)

An IDE combines a code editor, compiler/interpreter, debugger, and other tools in one application.

Examples: Eclipse, IntelliJ IDEA, Visual Studio Code, PyCharm.

Features: Syntax highlighting, auto-completion, error detection, debugging tools, version Control integration.

Additional Practice Questions

  1. Draw a truth table for the expression AB+AC\overline{A \cdot B} + A \cdot C. Simplify using De Morgan’s Laws.

  2. Explain the difference between a full adder and a half adder. Why is a full adder needed for multi-bit addition?

  3. A computer uses 4 KB pages. A process requires 50 KB of memory. How many pages does it need? What happens if the system only has 10 free pages?

  4. Explain what a firewall does and give three examples of rules a firewall might enforce.

  5. Compare the three types of testing (unit, integration, system) with examples for each.

  6. Explain why an SSD has no moving parts and why this makes it more suitable for laptops than an HDD.

  7. A binary number has 12 bits. What is the maximum unsigned value it can represent? What is the range if it uses two’s complement?

  8. Explain the purpose of each DNS record type (A, AAAA, CNAME, MX, NS) with examples.

Common Pitfalls

  1. Confusing bits and bytes. 1 byte = 8 bits. Storage is measured in bytes; data rates in bits per second.
  2. Incorrect two’s complement conversion. Always flip all bits AND add 1.
  3. Confusing AND and OR in Boolean expressions. AND requires both true; OR requires at least one true.
  4. Forgetting De Morgan’s Laws.
  5. Confusing hexadecimal digits. A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.
  6. Thinking the OS is the hardware. The OS is software.
  7. Confusing process and thread. A process is an instance of a program; a thread is a lightweight unit of execution within a process.
  8. Forgetting that NAND and NOR are universal gates. Any Boolean function can be built using only NAND gates or only NOR gates.
  9. Not padding binary groups of 4 when converting to hex.

Practice Questions

  1. Convert the decimal number 75-75 to 8-bit two’s complement.

  2. Convert 11011101 from binary to hexadecimal.

  3. Draw a truth table and logic circuit for the expression AˉB+ABˉ\bar{A} \cdot B + A \cdot \bar{B}. What Boolean operation does this represent?

  4. Using De Morgan’s Laws, simplify A+BˉC\overline{A + \bar{B} \cdot C}.

  5. Explain the role of the operating system in managing memory. What is virtual memory?

  6. Design a full adder circuit using only NAND gates.

  7. Convert the hexadecimal number 3F7 to binary and decimal.

  8. Explain the difference between black-box testing and white-box testing. Give an example of each.

  9. Calculate the file size of a 1280×7201280 \times 720 image with 32-bit colour depth in megabytes.

  10. A 2-minute audio file is recorded at 48000 Hz with 16-bit resolution in stereo. Calculate the file size in megabytes.

  11. Explain what the kernel is and why it is necessary. What is the difference between user mode and kernel mode?

  12. Explain the concept of functional completeness in logic gates. Why are NAND gates called universal gates?

  13. Prove De Morgan’s second law (A+B=AˉBˉ\overline{A + B} = \bar{A} \cdot \bar{B}) using a truth table.

  14. A 4-bit two’s complement adder adds 77 and 55. Show the calculation and determine whether overflow occurs.

  15. Draw the truth table for a full adder. Show all eight rows for inputs A, B, and carry-in.

  16. Explain the difference between process management and memory management in an operating system.

  17. A computer has a 64-bit data bus and runs at 3.2 GHz. Calculate the maximum theoretical data transfer rate in GB/s.

  18. Explain three ways in which an operating system provides security. Give a concrete example for each.

Practice Problems

Question 1: Two's complement arithmetic

Perform the following 8-bit two’s complement addition: 50+30-50 + 30. Show the binary representation of each number, the addition, and determine whether overflow occurs.

Answer

-50 in 8-bit two’s complement: 50 = 00110010, invert = 11001101, add 1 = 11001110. 30 in 8-bit two’s complement: 00011110.

Addition: 11001110 + 00011110 = 11101100.

Convert result to decimal: 11101100 is negative (MSB = 1). Invert = 00010011, add 1 = 00010100 = 20. So the result is -20.

Check: -50 + 30 = -20. Correct.

No overflow occurred because a negative and a positive number were added (overflow can only occur when adding two numbers of the same sign).

Question 2: Logic circuit simplification

Simplify the Boolean expression AˉBˉC+AˉBC+ABˉC\bar{A}\cdot\bar{B}\cdot C + \bar{A}\cdot B\cdot C + A\cdot\bar{B}\cdot C using Boolean algebra identities.

Answer

AˉBˉC+AˉBC+ABˉC\bar{A}\cdot\bar{B}\cdot C + \bar{A}\cdot B\cdot C + A\cdot\bar{B}\cdot C

Factor out C from the first two terms: C(AˉBˉ+AˉB)+ABˉCC(\bar{A}\cdot\bar{B} + \bar{A}\cdot B) + A\cdot\bar{B}\cdot C

Factor out Aˉ\bar{A} from the parenthesised expression: CAˉ(Bˉ+B)+ABˉCC \cdot \bar{A}(\bar{B} + B) + A\cdot\bar{B}\cdot C

Since Bˉ+B=1\bar{B} + B = 1: CAˉ1+ABˉC=AˉC+ABˉCC \cdot \bar{A} \cdot 1 + A\cdot\bar{B}\cdot C = \bar{A}\cdot C + A\cdot\bar{B}\cdot C

Factor out C: C(Aˉ+ABˉ)C(\bar{A} + A\cdot\bar{B})

Using the distributive law: C(Aˉ+A)(Aˉ+Bˉ)C(\bar{A} + A)(\bar{A} + \bar{B})

Wait — that’s incorrect. Let me redo: C(Aˉ+ABˉ)C(\bar{A} + A \cdot \bar{B}). This doesn’t simplify further using basic identities .

Alternative approach — try consensus: AˉC+ABˉC\bar{A}C + A\bar{B}C. The consensus of Aˉ\bar{A} and Bˉ\bar{B} with respect to CC is AˉBˉ\bar{A}\bar{B}Which is not present, so no further simplification.

The simplified expression is: AˉC+ABˉC=C(Aˉ+ABˉ)\bar{A} \cdot C + A \cdot \bar{B} \cdot C = C(\bar{A} + A \cdot \bar{B}).

Question 3: Number conversion

Convert the decimal number 0.6875 to binary. Show the fractional conversion process.

Answer

Integer part: 0 = 0 in binary.

Fractional part: multiply by 2 repeatedly:

  • 0.6875 ×\times 2 = 1.375, digit = 1, remainder = 0.375
  • 0.375 ×\times 2 = 0.75, digit = 0, remainder = 0.75
  • 0.75 ×\times 2 = 1.5, digit = 1, remainder = 0.5
  • 0.5 ×\times 2 = 1.0, digit = 1, remainder = 0 (done)

Reading the digits top to bottom: 0.1011.

So 0.6875 in decimal = 0.1011 in binary.

Verification: 1×21+0×22+1×23+1×24=0.5+0+0.125+0.0625=0.68751 \times 2^{-1} + 0 \times 2^{-2} + 1 \times 2^{-3} + 1 \times 2^{-4} = 0.5 + 0 + 0.125 + 0.0625 = 0.6875. Correct.

Question 4: File size calculation

A 5-minute video is recorded at 30 frames per second with a resolution of 1920×10801920 \times 1080 pixels. Each pixel uses 24 bits for colour (RGB). Calculate the file size in gigabytes before compression. Express your answer to 2 significant figures.

Answer

Total frames: 30×5×60=9,00030 \times 5 \times 60 = 9,000 frames.

Pixels per frame: 1920×1080=2,073,6001920 \times 1080 = 2,073,600 pixels.

Bits per frame: 2,073,600×24=49,766,4002,073,600 \times 24 = 49,766,400 bits.

Total bits: 49,766,400×9,000=447,897,600,00049,766,400 \times 9,000 = 447,897,600,000 bits.

Convert to bytes: 447,897,600,000/8=55,987,200,000447,897,600,000 / 8 = 55,987,200,000 bytes.

Convert to GB: 55,987,200,000 / (1024^3) = 55,987,200,000 / 1,073,741,824 \approx 52.15 \mathrm{ GB.

Rounded to 2 significant figures: 52 GB. This demonstrates why video compression is essential.

Question 5: De Morgan's Laws application

Using De Morgan’s Laws, convert the expression AB+CD\overline{A \cdot B + C \cdot D} into an expression that uses only AND and NOT operations.

Answer

AB+CD\overline{A \cdot B + C \cdot D}

Applying De Morgan’s Law (distribute the NOT over the OR): =ABCD= \overline{A \cdot B} \cdot \overline{C \cdot D}

Applying De Morgan’s Law to each term: =(Aˉ+Bˉ)(Cˉ+Dˉ)= (\bar{A} + \bar{B}) \cdot (\bar{C} + \bar{D})

Wait — the question asks for only AND and NOT. Let me apply the other form:

AB+CD=ABCD\overline{A \cdot B + C \cdot D} = \overline{A \cdot B} \cdot \overline{C \cdot D}

To express using only AND and NOT, note that X+Y=XˉYˉ\overline{X + Y} = \bar{X} \cdot \bar{Y} (De Morgan’s). But the question says only AND and NOT. Since AB=A+B\overline{A \cdot B} = \overline{A} + \overline{B}This introduces OR.

Using only NAND (AND + NOT): \overline{A \cdot B} = \mathrm{NAND(A, B) and \overline{C \cdot D} = \mathrm{NAND(C, D).

So: \mathrm{NAND(A, B) \cdot \mathrm{NAND(C, D) — but this uses AND.

Actually, NAND(A, B) already uses AND and NOT: AB\overline{A \cdot B}. So the answer is: ABCD\overline{A \cdot B} \cdot \overline{C \cdot D}Which uses only AND (implicit in the NOT-AND) and NOT operations.

Summary

This topic covers the core concepts of computing systems, including underlying theory, practical implementation, and key applications.

Key concepts include:

  • variables, data types, and control flow
  • functions and procedures
  • object-oriented programming
  • error handling and debugging
  • modular design

Understanding these concepts thoroughly is essential for both examinations and practical programming, and requires both theoretical knowledge and hands-on practice.

Worked Examples

Worked examples demonstrating the application of key concepts are covered in the detailed sub-pages linked above.