LC Computer Science study materials
LC Computer Science study resources

LC Computer Science: Core concepts

LC Computer Science · Work through your exam, one topic at a time.

All guide sections

Core concepts

Domain 2 - Core concepts

This domain tests the machinery beneath the code: how data is represented, how algorithms behave as input grows, how a processor executes instructions, and how machines exchange messages.

Data representation

Binary is base 2; one byte is 8 bits, giving 256 unsigned values (0–255). Two’s complement encodes negatives with the most significant bit as the sign, so the 8-bit range is −128 to 127. One hex digit is exactly four bits, so a byte is always two hex digits. Text uses ASCII or Unicode code points, images use pixels × colour depth, sound uses sample rate × bit depth × duration. File-size questions are arithmetic: work in bits, then divide.

Algorithms

Linear search scans any list in O(n). Binary search requires sorted data, halves the space each step, and is O(log n) - 1,024 items take at most 10 comparisons. Bubble, insertion and selection sort are O(n²); merge sort is O(n log n) but needs extra memory. Every recursion needs a base case and a recursive case that moves toward it.

Computer systems

Fetch–decode–execute: the program counter holds the next address, the instruction is fetched, decoded by the control unit, executed by the ALU, and the result written back. RAM is volatile and fast; secondary storage is persistent and slower; registers are fastest and smallest.

Networks

Application layer (HTTP, DNS, SMTP), transport (TCP - reliable and ordered; UDP - fast, no guarantee), internet (IP addressing and routing), link (Ethernet, Wi-Fi, MAC addresses). DNS maps names to IPs, DHCP hands out addresses, and HTTP is stateless, so cookies carry session state.

Worked example

Represent −5 in 8-bit two’s complement. Write +5 as 00000101, invert every bit to 11111010, then add 1: 11111011. Check it: the sign bit contributes −128 and the remaining bits add 123, giving −5. The add-1 step is what lets ordinary binary addition work without a separate subtraction circuit.

Traps

Reading the sign bit as magnitude; claiming binary search works on unsorted data; mixing bits and bytes; calling TCP the “faster” protocol; treating Unicode as fixed 8-bit characters; forgetting IP addresses are logical while MAC addresses are physical.