Karnataka II PUC Computer Science (KSEAB) study materials
Karnataka II PUC Computer Science (KSEAB) study resources

Karnataka II PUC Computer Science (KSEAB) cheat sheet

Karnataka II PUC Computer Science (KSEAB) · Keep the key ideas within reach.

Quick reference

Overview of Computers

  • A computer accepts data, processes it under stored instructions, and produces information; the basic IPO cycle is Input → Process → Output.

  • Von Neumann stored-program design keeps instructions and data in the same memory and executes them through fetch, decode, and execute cycles.

  • Core CPU parts: arithmetic logic unit performs arithmetic and logic, control unit coordinates operations, and registers hold temporary data at highest speed.

  • Memory hierarchy from fastest to slowest: registers, cache, main memory (RAM), then secondary storage; speed decreases and capacity increases down the hierarchy.

  • 1 byte = 8 bits; under the usual exam convention 1 KB = 1024 bytes, 1 MB = 1024 KB, 1 GB = 1024 MB.

  • Hardware is physical equipment; software is programs. System software manages the machine, while application software performs user tasks.

  • Computer generations: vacuum tubes, transistors, integrated circuits, microprocessors, and ULSI/AI-based systems.

  • Data is raw unprocessed facts; information is processed data that supports decisions.

Quick reference

Input/Output and Memory Devices

  • Input devices include keyboard, mouse, scanner, joystick, microphone, and touchscreen; output devices include monitor, printer, plotter, and speaker.

  • RAM is volatile primary memory: contents vanish on power loss. ROM is non-volatile and retains firmware or bootstrap instructions.

  • SRAM uses flip-flops, is fast and needs no refresh, and is used for cache. DRAM uses capacitors, is denser and cheaper, and needs periodic refresh.

  • ROM variants: PROM is programmed once, EPROM is erased by ultraviolet light, EEPROM is erased electrically, and flash memory is a form of EEPROM.

  • Cache memory lies between CPU and RAM and exploits temporal and spatial locality to reduce average access time.

  • Secondary storage is non-volatile: magnetic hard disks, optical CD/DVD/Blu-ray, and flash-based SSDs and pen drives.

  • Impact printers strike the paper, such as dot-matrix; non-impact printers such as inkjet and laser do not strike the paper.

  • Common ports and interfaces include USB, serial, parallel, HDMI, and Ethernet; a bus carries data, addresses, and control signals.

Quick reference

Data Representation

  • Number system bases: binary 2, octal 8, decimal 10, hexadecimal 16. Hexadecimal digits are 0-9 and A-F.

  • Binary to decimal: multiply each bit by 2 raised to its positional power and sum. Decimal to another base: repeatedly divide by the base and read remainders upward.

  • Group binary bits from the right in threes for octal and in fours for hexadecimal; each group converts directly to one digit.

  • 1's complement inverts every bit. 2's complement = 1's complement + 1; subtraction A − B is performed as A + 2's complement of B.

  • For n-bit 2's complement signed integers, range is −2^(n−1) to +2^(n−1) − 1. The leftmost bit is the sign bit.

  • Overflow occurs in signed addition when two operands of the same sign produce a result of the opposite sign.

  • BCD represents each decimal digit by four bits. ASCII uses 7 bits for codes 0-127; Unicode supports multilingual characters.

  • Fixed-point stores a fixed number of fractional bits; floating-point stores sign, mantissa, and exponent to cover a wide range.

Quick reference

Problem Solving Methodology

  • An algorithm must be finite, definite, effective, and have zero or more inputs and one or more outputs.

  • Flowchart symbols: oval for start/stop, parallelogram for input/output, rectangle for process, diamond for decision, circle for connector, and arrow for flow.

  • Three basic control constructs are sequence, selection (if/switch), and iteration (while/for/do-while).

  • Pseudocode uses readable structured statements such as READ, PRINT, IF...THEN...ELSE, and WHILE...ENDWHILE without language-specific syntax.

  • A trace table records variable values after each algorithm step and is used to verify logic and locate errors.

  • Linear search checks elements sequentially and works on unsorted data; binary search requires sorted data and repeatedly halves the search interval.

  • Loop correctness requires initialization before the loop, a condition that can become false, and an update inside the loop to avoid infinite iteration.

  • Swapping two variables needs a temporary variable: temp = a; a = b; b = temp.

Quick reference

Object-Oriented Concepts and Introduction to C++

  • OOP pillars: encapsulation, abstraction, inheritance, and polymorphism. A class is a blueprint; an object is an instance of a class.

  • A class contains data members and member functions. Private members are accessible only inside the class; public members form the interface.

  • In a class, members are private by default; in a struct, members are public by default.

  • A minimal C++ program includes , may use using namespace std;, defines int main(), and returns 0.

  • cin >> variable reads input; cout << expression writes output; endl inserts a newline and flushes the stream.

  • Compilation stages: preprocessing, compilation to assembly, assembly to object code, and linking to an executable.

  • C++ is case-sensitive; statements end with a semicolon; comments are // single-line or /* multi-line */.

  • Procedural programming organizes code around functions; OOP organizes code around objects combining state and behaviour.

Quick reference

C++ Fundamentals: Data Types, Operators and Control Structures

  • Typical sizes: char 1 byte, bool 1 byte, int 4 bytes, float 4 bytes, double 8 bytes; sizeof yields size in bytes.

  • Type qualifiers and modifiers include const, signed, unsigned, short, and long. const values cannot be modified after initialization.

  • Arithmetic operators: + − * / %. Integer division truncates toward zero; % works only with integer operands.

  • Relational operators return bool: <, >, <=, >=, ==, !=. Logical operators are &&, ||, and !.

  • Increment/decrement: ++x pre-increments then yields the new value; x++ yields the old value then increments.

  • Implicit conversion is automatic type promotion; explicit conversion uses a cast such as (float)total or static_cast(total).

  • switch requires an integral or enumeration controlling expression and constant case labels; break prevents fall-through.

  • while and for are pre-test loops; do-while is post-test and executes the body at least once. break exits a loop; continue skips to the next iteration.

Quick reference

Arrays

  • An array stores a fixed number of homogeneous elements in contiguous memory. For n elements, valid indices are 0 to n−1.

  • Declaration: type name[size]; example int marks[50]; initialization: int a[3] = {10, 20, 30};

  • C++ does not check array bounds at run time; accessing outside 0 to n−1 causes undefined behaviour.

  • Element address in a one-dimensional array = base address + index × size of one element.

  • A two-dimensional array is declared type name[rows][columns]; nested loops traverse it, usually row by row.

  • Common array algorithms: traversal, sum and average, maximum/minimum, linear search, and sorting.

  • Passing an array to a function passes the address of its first element; the function cannot determine the size, so pass size separately.

  • A C-string is a char array ending with the null character '\0'; cin.getline(array, size) reads a line including spaces.

Quick reference

Functions and Structures

  • A function prototype declares return type, name, and parameter types before use; the definition supplies the body.

  • Call by value passes copies, so changes do not affect the caller. Call by reference uses & in the parameter and modifies the original.

  • Default arguments apply when arguments are omitted and must appear at the rightmost positions. Function overloading uses the same name with different parameter lists.

  • A local variable is visible only in its block; a global variable is visible across the file; a static local variable retains its value between calls.

  • Recursion requires a base case and a recursive case that moves toward the base case; each call uses stack space.

  • A structure groups members of different types. Members are accessed with the dot operator, as in student.rollno.

  • An array of structures stores multiple records; each element is accessed as array[i].member.

  • Structures can be passed to and returned from functions by value, and pointers to structures use the -> operator.

Quick reference

Classes

  • A class definition contains data members and member functions; it ends with a semicolon after the closing brace.

  • Member functions defined outside the class use the scope-resolution operator: return_type ClassName::function().

  • Objects are created like variables, and public members are accessed with the dot operator: object.member.

  • Accessor functions read private data; mutator functions modify it. Declaring accessors const prevents modification.

  • A static data member is shared by all objects and must be defined outside the class; a static member function has no this pointer.

  • A friend function is not a member but can access private and protected members; friendship is granted by the class.

  • The this pointer inside a non-static member function points to the calling object and resolves name conflicts.

  • Objects can be stored in arrays, passed to functions, and returned from functions; class members can also be objects.

Quick reference

Constructors

  • A constructor has the same name as its class, has no return type, and is called automatically when an object is created.

  • A default constructor takes no arguments. If no constructor is declared, the compiler supplies an implicit default constructor.

  • A parameterized constructor initializes members with supplied values. Constructors can be overloaded by differing parameter lists.

  • A copy constructor takes a reference to the same class, as in Point(const Point &p), and initializes a new object from an existing one.

  • The compiler-supplied copy constructor performs a shallow copy; pointer members usually require a user-defined deep copy.

  • A destructor is named ~ClassName, takes no arguments, returns nothing, and is called when an object is destroyed.

  • Member initializer lists use ClassName(args) : member(value) {} and initialize members before the constructor body runs.

  • Construction order: base class, then data members in declaration order, then derived constructor body; destruction occurs in reverse order.

Quick reference

Operator Overloading

  • Operator overloading defines operator functions named operator@ for class or enumeration types; at least one operand must be a class or enum type.

  • Overloading cannot change operator precedence, associativity, or the number of operands.

  • Operators that cannot be overloaded include ::, ., .*, ?:, and sizeof.

  • As a member function, a binary operator takes one explicit parameter; as a friend function, it takes two.

  • =, [], (), and -> must be overloaded as non-static member functions.

  • A unary operator as a member takes no parameters; a postfix increment can use a dummy int parameter to distinguish it from prefix.

  • operator+ conventionally returns a new object by value and does not modify its operands.

  • The stream operators << and >> are commonly overloaded as friend functions returning an ostream or istream reference.

Quick reference

Inheritance

  • Derived class syntax: class Derived : access_specifier Base { ... }; where access_specifier is public, protected, or private.

  • With public inheritance, public and protected members of the base keep their status in the derived class; private base members remain inaccessible directly.

  • Protected members are accessible inside the class and its derived classes but not through outside objects.

  • Inheritance forms: single, multiple, multilevel, hierarchical, and hybrid.

  • Base class constructors run before derived class constructors; destructors run in reverse order, derived before base.

  • Multiple inheritance can cause ambiguity when two base classes have a member with the same name; resolve it with the scope-resolution operator.

  • A virtual base class in diamond inheritance ensures only one shared copy of the common base subobject exists.

  • A virtual function enables run-time polymorphism; a pure virtual function has = 0 and makes the class abstract.

Quick reference

Pointers and Data Files

  • A pointer stores an address. Declaration: type *ptr; the & operator gives an address and * dereferences a pointer.

  • Pointer arithmetic is scaled by the pointed-to type; ptr + 1 advances by sizeof(type) bytes, not one byte.

  • Dynamic allocation uses new and delete; arrays require new type[size] and delete[] pointer.

  • A pointer to an object accesses members with the arrow operator: ptr->member. The this pointer is an example of a pointer to the current object.

  • File stream classes: ifstream for input, ofstream for output, and fstream for both; include .

  • Open modes include ios::in, ios::out, ios::app, ios::ate, ios::binary, and ios::trunc; combine modes with |.

  • Functions open(), close(), eof(), getline(), read(), and write() perform file operations; always check successful opening.

  • Sequential access reads records in order; seekg()/seekp() and tellg()/tellp() support random access positioning.

Quick reference

Computer Networks and Internet Concepts

  • A network links autonomous computers to share resources and exchange data. LAN is local, MAN covers a city, and WAN spans countries.

  • Topologies: bus uses a shared backbone, star uses a central hub/switch, ring forms a closed loop, and mesh provides multiple paths.

  • The OSI model has seven layers: physical, data link, network, transport, session, presentation, and application.

  • TCP is connection-oriented and reliable; UDP is connectionless and faster but unreliable. IP handles addressing and routing.

  • IPv4 addresses are 32 bits; IPv6 addresses are 128 bits. DNS maps domain names to IP addresses.

  • Common protocols: HTTP/HTTPS for web, FTP for file transfer, SMTP for sending mail, POP3/IMAP for receiving mail.

  • Network devices: hub repeats to all ports, switch forwards by MAC address, router forwards by IP address, and modem converts signals.

  • The Internet is the global network of networks; the World Wide Web is a service on it using URLs, HTTP, and hyperlinks.

Quick reference

Database Concepts and SQL

  • A DBMS stores and manages data, controls redundancy, enforces integrity, and supports concurrent access and recovery.

  • Relational terms: relation = table, tuple = row, attribute = column, degree = number of columns, cardinality = number of rows.

  • A primary key uniquely identifies rows and cannot be NULL. A candidate key is any minimal unique key; one is chosen as primary.

  • A foreign key references a primary key in another table and enforces referential integrity.

  • DDL commands define structure: CREATE, ALTER, DROP. DML commands manipulate rows: SELECT, INSERT, UPDATE, DELETE.

  • SELECT clauses: WHERE filters rows, GROUP BY groups rows, HAVING filters groups, ORDER BY sorts results.

  • Aggregate functions: COUNT, SUM, AVG, MIN, MAX. They ignore NULL except COUNT(*).

  • A join combines rows from tables; a Cartesian product pairs every row, while an equi-join uses a matching condition such as A.id = B.id.

Quick reference

Web Technology (HTML)

  • HTML describes web page structure using tags. Most elements have an opening tag, content, and a closing tag; attributes appear in the opening tag.

  • Basic document structure: , , with , and <body> containing visible content.</p>

  • Heading tags are

    to ;

    creates a paragraph,
    inserts a line break, and


    draws a horizontal rule.

  • Lists:

      ordered,
        unordered, and
      • list items; defines a description list with and .

  • Links use text; images use and are void elements.

  • Tables use

    , for rows,
    for header cells, and for data cells; colspan and rowspan merge cells.

  • Forms use

    with , with
  • CSS can be inline with style, internal inside