BSEB Inter Computer Science cheat sheet
BSEB Inter Computer Science · Keep the key ideas within reach.
Computer Fundamentals
IPO cycle: input devices accept data, the CPU processes it, and output devices present results; storage holds data and programs for later use.
CPU has an ALU for arithmetic and logical operations, a control unit for sequencing, and registers for temporary data; clock speed is measured in hertz.
Memory units: 8 bits = 1 byte; 1 KB = 1024 bytes; 1 MB = 1024 KB; 1 GB = 1024 MB; 1 TB = 1024 GB.
Hardware is the physical equipment; software is the set of instructions. System software runs the machine; application software performs user tasks.
Computer generations: first vacuum tubes, second transistors, third integrated circuits, fourth microprocessors, fifth AI and ULSI-based systems.
Analog computers process continuous signals; digital computers process discrete binary data; hybrid computers combine both.
Data is raw facts; information is processed data; the value of information depends on accuracy, relevance, and timeliness.
Mainframe handles bulk transaction processing; minicomputer serves departments; microcomputer is a personal computer; supercomputer performs high-speed scientific computation.
Number Systems and Boolean Logic
A number in base b uses digits 0 to b-1 and place values b^0, b^1, b^2...; binary b=2, octal b=8, decimal b=10, hexadecimal b=16.
Decimal to binary: repeatedly divide by 2 and record remainders; read remainders upward. Decimal fraction: multiply by 2 and record integer parts.
Binary to octal: group bits in threes from the radix point; binary to hexadecimal: group in fours; pad with leading or trailing zeros as needed.
1's complement inverts bits; 2's complement = 1's complement + 1; n-bit 2's complement range is -2^(n-1) to 2^(n-1)-1.
AND yields 1 only when both inputs are 1; OR yields 1 when at least one input is 1; XOR yields 1 when inputs differ; NOT inverts.
NAND and NOR are universal gates; any Boolean expression can be implemented using only NAND gates or only NOR gates.
De Morgan: (A·B)' = A' + B'; (A+B)' = A'·B'. Boolean identities: A+A=A, A·A=A, A+0=A, A·1=A, A+A'=1, A·A'=0.
SOP is sum of minterms (AND terms ORed); POS is product of maxterms (OR terms ANDed); Karnaugh maps group 1s in powers of two to simplify.
Computer Organisation: Hardware, Software and Memory
Von Neumann machine: CPU, memory, input/output; instructions and data share memory; the fetch-decode-execute cycle repeats.
Registers: PC holds next instruction address; IR holds current instruction; MAR holds memory address; MBR/MDR holds data; ACC holds ALU result.
System bus carries address, data, and control signals; address bus width limits addressable memory; data bus width affects transfer rate.
Memory hierarchy from fast, small, costly to slow, large, cheap: registers, cache, main memory, secondary storage, tertiary storage.
SRAM uses flip-flops and is fast cache; DRAM uses capacitors and needs refresh for main memory; ROM is non-volatile; PROM, EPROM, EEPROM are programmable variants.
Magnetic disk stores data on tracks and sectors; SSD uses flash memory; optical disk uses laser; access time = seek time + rotational latency + transfer time.
Software types: system software (OS, drivers, utilities), application software (word processors, browsers), and programming software (compilers, interpreters).
Input devices: keyboard, mouse, scanner, microphone; output devices: monitor, printer, speaker; both convert between human and machine forms.
Operating Systems and Windows Environment
OS functions: process management, memory management, file management, device management, security, and user interface.
Process states: new, ready, running, waiting or blocked, terminated; the scheduler selects a ready process for the CPU.
Deadlock four conditions: mutual exclusion, hold and wait, no preemption, circular wait; preventing deadlock means breaking at least one condition.
Paging divides memory into fixed-size pages and frames; segmentation uses variable-size logical segments; virtual memory uses disk to extend RAM.
File allocation methods: contiguous, linked, indexed; directories organize files; FAT and NTFS are Windows file systems.
Windows shortcuts: Ctrl+C copy, Ctrl+X cut, Ctrl+V paste, Ctrl+Z undo, Ctrl+Y redo, Alt+Tab switch apps, Ctrl+Shift+Esc Task Manager.
Windows Run commands: cmd opens Command Prompt, notepad opens Notepad, mspaint opens Paint, control opens Control Panel, explorer opens File Explorer.
GUI uses windows, icons, menus, and pointers; CLI accepts typed commands; Windows Explorer manages files and folders.
Programming in C: Syntax, Control Structures, Functions and File Handling
C program structure: preprocessor directives, global declarations, main function, and user-defined functions; execution begins at main().
Common data sizes on 16-bit Turbo C: char 1 byte, int 2 bytes, long 4 bytes, float 4 bytes, double 8 bytes; sizeof verifies sizes.
Format specifiers: %d int, %u unsigned, %f float or double, %lf double in scanf, %c char, %s string, %x hexadecimal, %p pointer.
Operator precedence: postfix, unary, multiplicative, additive, relational, equality, logical AND, logical OR, assignment; parentheses override.
Selection: if, if-else, else-if ladder, switch-case; iteration: for, while, do-while; jump: break, continue, goto, return.
Function parts: return type, name, parameter list, body; call by value copies arguments; call by reference passes addresses via pointers.
Array index starts at 0; an n-element array has valid indices 0 to n-1; a string is a char array ending with '\0'.
File handling: fopen returns FILE*; modes r, w, a, r+, w+, a+, rb, wb, ab; fclose closes; fscanf and fprintf or fread and fwrite perform I/O.
Data Structures: Arrays, Stacks, Queues, Linked Lists and Pointers
Array: contiguous homogeneous elements accessed by index in O(1); insertion or deletion in the middle costs O(n).
Linear search checks each element in O(n); binary search requires sorted data and runs in O(log n).
Stack is LIFO; operations push insert at top and pop delete from top; applications include expression evaluation, recursion, and undo.
Queue is FIFO; enqueue at rear, dequeue at front; a circular queue reuses empty slots; applications include scheduling and buffers.
Linked list node stores data and a next pointer; singly linked traversal is forward only; doubly linked also stores a previous pointer.
Pointer stores an address; * dereferences, & gives address; NULL pointer points to nothing; dangling pointer references freed memory.
Bubble sort compares adjacent pairs and swaps, O(n^2); selection sort selects the minimum repeatedly; insertion sort inserts into the sorted part.
Stack overflow occurs when push exceeds capacity; underflow when pop is applied to an empty stack; queue underflow when dequeue is applied to an empty queue.
Database Management Systems and SQL
DBMS advantages: controlled redundancy, data consistency, sharing, security, backup and recovery, and data independence.
Keys: super key uniquely identifies rows; candidate key is a minimal super key; primary key is the chosen candidate key; foreign key references another table's primary key.
SQL categories: DDL (CREATE, ALTER, DROP), DML (SELECT, INSERT, UPDATE, DELETE), DCL (GRANT, REVOKE), TCL (COMMIT, ROLLBACK).
SELECT syntax: SELECT columns FROM table WHERE condition GROUP BY columns HAVING condition ORDER BY columns ASC or DESC.
Joins: INNER returns matching rows; LEFT returns all left rows plus matches; RIGHT returns all right rows; FULL returns all rows from both tables.
Aggregate functions: COUNT, SUM, AVG, MIN, MAX; WHERE filters rows before grouping; HAVING filters groups after grouping.
Constraints: NOT NULL, UNIQUE, PRIMARY KEY, FOREIGN KEY, CHECK, DEFAULT; they enforce data integrity.
Normalization: 1NF removes repeating groups; 2NF removes partial dependency; 3NF removes transitive dependency; BCNF handles remaining anomalies.
Computer Communication, Networking and the Internet
OSI layers: Physical, Data Link, Network, Transport, Session, Presentation, Application; TCP/IP model: Network Access, Internet, Transport, Application.
IPv4 address is 32 bits in four octets; classes A 1-126, B 128-191, C 192-223, D multicast 224-239, E experimental 240-255.
Private IPv4 ranges: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16; loopback is 127.0.0.1.
Protocols: HTTP and HTTPS web, FTP file transfer, SMTP send mail, POP3 and IMAP receive mail, DNS name resolution, DHCP dynamic IP, TCP reliable, UDP unreliable.
Topologies: bus shares one backbone; star uses a central switch; ring passes data around; mesh provides redundant paths; hybrid combines types.
Transmission media: twisted pair, coaxial cable, fiber optic; guided media use cables; unguided media use radio, microwave, and infrared.
Bandwidth is capacity in bits per second; latency is delay; throughput is actual data rate; a switch forwards by MAC address, a router by IP address.
Internet services: WWW, email, FTP, DNS, chat, VoIP; a URL identifies a resource; DNS converts a domain name to an IP address.
Web Technology: HTML, Web Design and Cyber Safety
HTML document structure: , , for metadata and title, for visible content.
Common tags:
to headings,Form controls:
, <input type text, password, email, radio, checkbox, submit>,CSS can be inline style attribute, internal
HTML attributes provide extra information: id unique, class reusable, src and alt for images, href for links, action and method for forms.
Strong unique passwords and two-factor authentication reduce account compromise; software updates patch known vulnerabilities.
Phishing messages commonly use urgent language, mismatched sender addresses, and deceptive links to steal credentials.
A firewall filters network traffic; antivirus detects malware; HTTPS encrypts traffic with TLS; cookies store small client-side state.