Punjab PSEB SS Computer Science cheat sheet
Punjab PSEB SS Computer Science · Keep the key ideas within reach.
PSEB SS Computer Science - Core Reference
Number systems: binary (base 2), octal (8), decimal (10), hexadecimal (16). Each hex digit maps to exactly 4 bits; each octal digit to 3 bits.
Conversion by division: repeatedly divide the decimal number by the target base, collecting remainders from last to first. Binary to decimal: sum bit × 2^position, starting position 0 at the right.
1 KB = 1024 bytes = 2^10 bytes; 1 MB = 1024 KB; 1 GB = 1024 MB; 1 TB = 1024 GB. A nibble is 4 bits; a byte is 8 bits.
Signed numbers: in 8-bit two's complement the range is −128 to +127. To negate, invert all bits and add 1. Sign bit 1 means negative.
Logic gates: AND outputs 1 only if all inputs are 1; OR outputs 1 if any input is 1; NOT inverts; NAND and NOR are the universal gates; XOR outputs 1 when inputs differ.
De Morgan's laws: (A·B)' = A' + B' and (A + B)' = A'·B'. These allow any circuit to be built from NAND gates alone.
Truth tables: n input variables give 2^n rows. A half adder produces Sum = A XOR B and Carry = A AND B; a full adder also accepts a carry-in.
Memory hierarchy by speed and cost: registers > cache > RAM > secondary storage (SSD/HDD) > optical/tape. RAM is volatile; ROM is non-volatile.
Operating system functions: process management, memory management, file system management, device (I/O) management, and providing a user interface. Examples: Windows, Linux, Android.
PSEB SS Computer Science - Programming, Data and Networks
Program structure: sequence, selection (if/else, switch), and iteration (for, while, do-while). A for loop suits a known count; while tests the condition before the body; do-while runs the body at least once.
Variable scope: a local variable is declared inside a function/block and is invisible outside it; a global variable is declared outside and is accessible throughout the program.
Array indexing typically starts at 0, so an array of n elements has valid indices 0 to n−1. Accessing index n is an out-of-bounds error.
Searching and sorting: linear search is O(n) and needs no ordering; binary search is O(log n) but requires a sorted array; bubble sort repeatedly swaps adjacent out-of-order pairs, O(n²).
SQL basics: SELECT columns FROM table WHERE condition; DISTINCT removes duplicate rows; primary key is unique and not null; foreign key references a primary key in another table.
Network types by span: PAN (personal, ~10 m), LAN (building/campus), MAN (city), WAN (country/global). The Internet is the largest WAN.
IP addressing: IPv4 is 32-bit dotted decimal (e.g. 192.168.1.1); IPv6 is 128-bit hexadecimal. 127.0.0.1 is the loopback address; 192.168.x.x is private.
Protocols: HTTP/HTTPS for web, FTP for file transfer, SMTP for sending mail, POP3/IMAP for receiving, DNS maps domain names to IP addresses, TCP is connection-oriented while UDP is connectionless.
Cyber safety rules: a strong password mixes upper/lower case, digits and symbols and is never shared; phishing is a fraudulent message that tricks users into revealing credentials; antivirus scans for malware.