NEB 12 Computer Science study materials
NEB 12 Computer Science study resources

NEB 12 Computer Science cheat sheet

NEB 12 Computer Science · Keep the key ideas within reach.

Quick reference

NEB Grade 12 Computer Science - Core Reference

  • Number systems: binary base 2, octal base 8, decimal base 10, hexadecimal base 16; each hex digit maps to exactly 4 bits, each octal digit to 3 bits.

  • Conversion rules: decimal to base r by repeated division by r collecting remainders bottom-up; base r to decimal by summing digit × r^position from the right starting at position 0.

  • Signed integers: sign-magnitude and 1's complement both have two zeros (+0 and −0); 2's complement has one zero and represents −2^(n−1) to 2^(n−1)−1 in n bits.

  • Boolean algebra: A + A' = 1, A·A' = 0, A + AB = A, A + A'B = A + B (absorption); De Morgan: (A+B)' = A'·B' and (A·B)' = A' + B'.

  • Logic gates: NAND and NOR are universal; XOR output is 1 only when inputs differ, so A⊕A = 0 and A⊕0 = A.

  • Half adder outputs Sum = A⊕B and Carry = A·B; full adder adds a carry-in and its Carry = A·B + Cin·(A⊕B).

  • CPU cycle: fetch the instruction at PC, decode in the control unit, execute in the ALU, store results; registers include PC, IR, MAR, MBR and accumulator.

  • Memory hierarchy by speed and cost: registers > cache > main memory (RAM/ROM) > secondary storage (magnetic/optical/solid-state); RAM is volatile, ROM is non-volatile.

  • OS functions: process scheduling, memory allocation, file-system management, device I/O control and security; multiprogramming keeps several jobs in memory, multitasking time-slices the CPU.

Quick reference

NEB Grade 12 Computer Science - Programming, Data and Networks

  • C control flow: if/else and switch select branches; for, while and do-while repeat - do-while always executes its body at least once because the test follows the body.

  • C function call by value copies the argument; call by reference passes an address and the pointer dereference operator * reads or writes the caller's variable.

  • Arrays in C are zero-indexed and stored contiguously; a one-dimensional array of n elements is traversed with indices 0 to n−1.

  • Pointers: & yields an address, * accesses the value stored there; pointer arithmetic advances by the size of the pointed-to type in bytes.

  • Data structures: stack is LIFO with push/pop; queue is FIFO with enqueue at the rear and dequeue at the front; a linear queue suffers from the false-overflow problem that a circular queue removes.

  • Linked list nodes hold data plus a next pointer; insertion and deletion are O(1) at a known position but access is O(n) because traversal is sequential.

  • DBMS: primary key uniquely identifies a row and cannot be null; foreign key references a primary key in another table and enforces referential integrity.

  • SQL: SELECT columns FROM table WHERE condition GROUP BY columns HAVING condition ORDER BY columns; DDL covers CREATE, ALTER and DROP, DML covers INSERT, UPDATE and DELETE.

  • Networking: OSI has 7 layers (physical, data link, network, transport, session, presentation, application); TCP is connection-oriented and reliable, UDP is connectionless and faster.

  • IP addressing: an IPv4 address is 32 bits in four octets; a class C network uses a /24 default mask 255.255.255.0 giving 254 usable host addresses.

  • Topologies: star depends on a central hub or switch, bus shares one backbone with collisions, ring passes data node to node, mesh gives redundant paths at high cabling cost.

Quick reference

NEB Grade 12 Computer Science - Web, Security and Society

  • HTML defines structure with tags and attributes; CSS controls presentation; JavaScript adds client-side behaviour - the three are separated by purpose, not interchangeable.

  • HTML forms submit name/value pairs; GET appends data to the URL and is visible and length-limited, POST sends data in the request body.

  • Static web pages are fixed files served as stored; dynamic pages are generated per request by server-side code such as PHP, ASP or JSP querying a database.

  • Client–server model: the browser sends an HTTP request, the server returns a status code and body; 200 means OK, 404 not found, 500 server error.

  • Cybercrime categories include hacking, phishing, identity theft, software piracy and cyberbullying; a computer virus attaches to a host file while a worm self-replicates across networks.

  • Security controls: authentication verifies identity, authorization sets permissions, encryption converts plaintext to ciphertext with a key, and a firewall filters traffic by rule.

  • Digital divide means unequal access to computing and the internet across regions, income groups and genders; it affects education and employment opportunity.

  • Ethics and law: respect intellectual property and software licences, protect personal data, and note that Nepal's Electronic Transactions Act 2063 (2008) addresses electronic records and computer-related offences.

  • E-commerce models: B2B between businesses, B2C from business to consumer, C2C between consumers via a marketplace; e-governance delivers public services electronically.

Quick reference

NEB Grade 12 Computer Science - Algorithms and Exam Technique

  • Algorithm properties: finiteness, definiteness, input, output and effectiveness; a flowchart uses oval for start/stop, parallelogram for input/output, diamond for decision, rectangle for process.

  • Searching: linear search inspects each element in turn, best case O(1) and worst case O(n); binary search needs a sorted array and halves the range each step, O(log n).

  • Sorting: bubble sort repeatedly swaps adjacent out-of-order pairs, worst case O(n²); selection sort finds the minimum of the remaining part each pass.

  • Recursion solves a problem by calling itself with a smaller input and needs a base case; a factorial n! = n × (n−1)! with 0! = 1 is the standard example.

  • Trace questions: draw a table with one column per variable and one row per iteration, then read the final values - this catches off-by-one errors in loops.

  • Big-O compares growth rates: O(1) < O(log n) < O(n) < O(n log n) < O(n²) < O(2^n); constants and lower-order terms are dropped.

  • Marks are usually split between theory and practical; numerical conversion, truth tables and short C programs are the highest-yield revision items.

  • Show working for conversions and truth tables - method marks are awarded even when the final value is wrong, and label gates or columns clearly.

Quick reference

NEB Grade 12 Computer Science - Quick Recall Formulas

  • Number of bits needed to represent N distinct values is ⌈log2 N⌉; n bits give 2^n distinct patterns.

  • 2's complement of an n-bit number: invert all bits and add 1; the range is −2^(n−1) to 2^(n−1)−1.

  • Hex to binary: expand each hex digit to 4 bits (A=1010, F=1111); group binary in 4s from the right to go back to hex.

  • Total addresses in a subnet = 2^(32 − prefix length); usable hosts = that total minus 2 (network and broadcast addresses).

  • Transmission time = file size ÷ bandwidth (keep units consistent); total time adds propagation delay = distance ÷ signal speed.

  • Truth-table size for n input variables is 2^n rows; a two-input gate has 4 rows, three inputs give 8 rows.

  • Array address: base + (index × size of element) for a zero-indexed one-dimensional array.

  • Binary search comparisons in the worst case ≈ ⌈log2 n⌉ + 1 for a sorted array of n elements.

Quick reference

NEB Grade 12 Computer Science - C Syntax and File Handling

  • Program skeleton: #include <stdio.h> then int main(void) { ... return 0; } - every statement ends with a semicolon and blocks use braces.

  • Format specifiers for printf/scanf: %d int, %f float, %lf double, %c char, %s string, %u unsigned; scanf needs an address, as in scanf("%d", &x).

  • Data types and sizes on typical exam compilers: char 1 byte, int 2 or 4 bytes, float 4 bytes, double 8 bytes.

  • String handling: a C string is a char array ending in the null character '\0'; strlen excludes the null, and strcpy/strcmp/strcat come from string.h.

  • File handling: fopen returns a FILE pointer, modes are "r", "w", "a" and their plus variants; fclose releases the handle and fscanf/fprintf read and write formatted data.

  • Structures group related fields: struct Student { int roll; char name[30]; }; and members are accessed with the dot operator.

  • Loop patterns: sum and count use an accumulator initialised before the loop; factorial and Fibonacci need correct initial values (fact = 1, fib seeds 0 and 1).