MCA CET Prep मराठी

Section · 20 questions · 40 marks

Computer Concepts

Computer basics, data representation and binary arithmetic, Boolean algebra, architecture and interrupts, assembly vs high-level languages, C programming and OS basics.

The whole section, in one picture

A computer is a well-run restaurant kitchen. The CPU is the chef, RAM is the counter space, the hard disk is the store-room, the OS is the manager handing out orders, and binary is the simple on/off language every worker understands.

Official syllabus: Computer Basics; Data Representation (incl. binary arithmetic, two’s complement, floating point, Boolean algebra, truth tables, Venn diagrams); Computer Architecture; Computer Language (assembly, high-level, programming in C); Operating System basics.

0 of 16 topics done · 64 practice questions · Timed Computer drill →

Computer · Computer Basics · Topic 1 of 16

Computer Organization and the CPU

Think of it like…

A kirana shopkeeper billing a grocery chit

Ramesh runs a kirana shop in a Kolhapur galli. A customer hands him a chit: "1 kg sugar, 2 packets Parle-G, 500 g toor dal". Ramesh keeps his finger on the line he must do next. He reads that line (fetch), understands what it means — which shelf, how much (decode) — then weighs the item and adds its price to the running total on his small slate (execute). His finger moves to the next line and the cycle repeats until the chit ends. The chit is the program sitting in memory; his finger is the Program Counter; his brain, which understands each line and tells his hands what to do, is the Control Unit; the calculator is the ALU; and the slate holding the running total is a register (the accumulator). Notice that his brain never weighs or adds anything itself — it only directs. That is exactly the Control Unit.

In everyday lifeIn the exam topic
The customer’s chit (items in order)Program stored in main memory
Finger on the line to be done nextProgram Counter (PC)
The line he is reading right nowInstruction Register (IR)
His brain: understands the line, directs his handsControl Unit — decodes and sends control signals
Calculator + slate with the running totalALU + accumulator register

The concept

Almost every computer follows the von Neumann (stored-program) model: the program and its data sit together in main memory, and the CPU fetches instructions one at a time. The machine has five functional units — input, memory, ALU, control unit, output. The CPU is the ALU + control unit + registers, on one chip.

The ALU (Arithmetic Logic Unit) does arithmetic (+, −) and logic (AND, OR, NOT, compare). The Control Unit processes no data at all: it decodes each instruction and sends control signals (memory read, memory write, which ALU operation) to every other unit, in step with the clock. Registers are tiny, fastest storage inside the CPU: PC, IR, MAR, MDR (also called MBR), the accumulator and the flag (status) register.

The CPU repeats the instruction cycle forever: fetch (MAR ← PC; MDR ← M[MAR]; IR ← MDR; PC ← PC + 1), decode (the CU reads the opcode), execute (ALU, memory or I/O action; flags updated). Then it checks for interrupts and starts again. Speed is set by the clock: a 2 GHz clock gives 2 × 10⁹ cycles per second, so one cycle lasts 0.5 ns.

Key points & formulas

  • CPU = ALU + Control Unit + registers; the CU directs, the ALU computes
  • PC: address of the next instruction; IR: the instruction being executed now
  • MAR: address sent to memory; MDR/MBR: data coming from or going to memory
  • Accumulator holds ALU results; flag register holds Zero, Sign, Carry, Overflow bits
  • Fetch: MAR ← PC → MDR ← M[MAR] → IR ← MDR, PC ← PC + 1
  • Clock period = 1 ÷ frequency; instruction time = cycles × period
  • Von Neumann: one memory for program and data (the “von Neumann bottleneck”); Harvard: separate instruction and data memories
  • Control unit design: hardwired (fast, fixed logic) or microprogrammed (control memory, easy to change)

Worked example

Memory holds a program at addresses 100–102: LOAD 500, ADD 501, STORE 502. M[500] = 7 and M[501] = 5. The PC starts at 100. Trace the registers. What are M[502] and the PC at the end?

Show solution
  1. Fetch 1: MAR ← 100, IR ← LOAD 500, PC ← 101. Execute: AC ← M[500] = 7.
  2. Fetch 2: MAR ← 101, IR ← ADD 501, PC ← 102. Execute: the ALU adds, AC ← 7 + M[501] = 12.
  3. Fetch 3: MAR ← 102, IR ← STORE 502, PC ← 103. Execute: M[502] ← AC = 12.
  4. The PC is incremented during every fetch, so after three instructions it points to 103.

Answer: M[502] = 12, PC = 103

Exam shortcut

For “which register” questions ask: is it an address or a content? Addresses live in the PC and MAR; contents live in the IR, MDR and accumulator. For clock questions, period in ns = 1 ÷ (GHz value): 2.5 GHz → 0.4 ns.

Common traps

  • The PC holds the address of the next instruction, not the current one (it is incremented during fetch).
  • The Control Unit does no calculation; even a comparison such as a < b is done by the ALU.

Practice · tap an option to check

Q1. Which register holds the address of the next instruction to be fetched?

Q2. Which sequence correctly describes the fetch phase of the instruction cycle?

Q3. Which unit of the CPU interprets instructions and generates timing and control signals, but does not itself process data?

Q4. A processor runs at 2.5 GHz. An instruction needs 5 clock cycles. How long does the instruction take?

↑ Back to topic list

Computer · Computer Basics · Topic 2 of 16

Instruction Structure and Addressing Modes

Think of it like…

The Mumbai dabbawala’s lid code

Mumbai’s dabbawalas deliver lakhs of tiffins every day with very few mistakes, using a short code painted on each lid. Think of each tiffin as an instruction: the job is fixed — “deliver this” (the opcode) — and the painted code says where (the address field). Sometimes what you need is already inside the tiffin, like a note with money: no trip needed (immediate). Usually the lid gives the exact office desk (direct). Sometimes the lid only says “ask at the Churchgate sorting desk”, and the desk tells you the real office — one extra trip (indirect). And sometimes it says “building 4, then 3 floors up” — a fixed starting point plus a count (indexed / base + offset). Same delivery, different ways of naming the place: that is all addressing modes are.

In everyday lifeIn the exam topic
The job on the slip: “deliver”Opcode (which operation)
Money kept inside the tiffin itselfImmediate: operand is inside the instruction
Lid gives the exact office deskDirect: address field = effective address
Lid says “ask the sorting desk”; desk gives the real addressIndirect: EA = M[address field] (one extra memory access)
“Building 4, then 3 floors up”Indexed / base: EA = register + offset

The concept

An instruction is a bit pattern divided into fields: an opcode (which operation) and one or more operand/address fields (where the data is). With n opcode bits the CPU can have at most 2n different operations. By the number of addresses, instructions are 3-address (ADD R1, R2, R3), 2-address (ADD R1, R2), 1-address (ADD X, the other operand is the accumulator) and 0-address (ADD on a stack, used for postfix evaluation).

The addressing mode tells the CPU how to find the operand; the memory address it finally uses is the effective address (EA). Immediate: the operand is in the instruction (no memory access). Direct: EA = address field. Indirect: EA = M[address field], so one extra memory access. Register: operand is in a register. Register indirect: EA = contents of a register. Indexed: EA = address field + index register (good for arrays). Relative: EA = PC + offset (good for branches and relocatable code). Implied: the operand is fixed by the opcode itself (e.g. CMA, complement the accumulator).

Key points & formulas

  • Instruction = opcode + address field(s); n opcode bits → 2n operations
  • Bits for address = instruction length − opcode bits − register-field bits
  • Immediate: operand = value in the instruction (a constant, no memory access)
  • Direct: EA = A; Indirect: EA = M[A] (one extra memory reference)
  • Register indirect: EA = (R); Indexed: EA = A + (XR); Base: EA = (BR) + A
  • PC-relative: EA = PC + offset, where PC already points to the next instruction
  • 0-address instructions work on a stack (PUSH, POP, ADD) — postfix form

Worked example

An instruction has address field 300, and the index register XR holds 100. Memory: M[300] = 500, M[400] = 700, M[500] = 800. Find the operand in immediate, direct, indirect and indexed modes.

Show solution
  1. Immediate: the operand is the address field itself → 300.
  2. Direct: EA = 300, operand = M[300] → 500.
  3. Indirect: EA = M[300] = 500, operand = M[500] → 800.
  4. Indexed: EA = 300 + 100 = 400, operand = M[400] → 700.

Answer: Immediate 300, Direct 500, Indirect 800, Indexed 700

Exam shortcut

Count memory trips needed for the operand after the instruction is fetched: immediate 0, register 0, direct 1, register indirect 1, indexed 1, indirect 2. “Fastest / slowest mode” questions then answer themselves.

Common traps

  • In PC-relative mode the offset is added to the updated PC (address of the next instruction), not the address of the branch itself — unless the question says otherwise.
  • Immediate mode does not mean “fast memory”; it means the operand needs no memory access at all.

Practice · tap an option to check

Q1. In which addressing mode is the operand itself part of the instruction?

Q2. Which addressing mode needs two memory references to get the operand (after the instruction has been fetched)?

Q3. A computer has 32-bit instructions and 128 different operations. Each instruction has one register operand (32 registers) and one memory address field. How many bits are left for the memory address?

Q4. A 2-word branch instruction using PC-relative addressing is stored at address 1000 (word-addressable memory). Its offset field is +20, and the offset is added to the PC after the instruction has been fetched (the PC has already been advanced past it). What is the target (effective) address?

↑ Back to topic list

Computer · Computer Basics · Topic 3 of 16

Input / Output and Backup Devices

Think of it like…

The talathi office and the farmer’s 7/12 photocopies

Think of a village talathi office that keeps land records — the 7/12 extracts (satbara utara). A farmer brings a filled form and the clerk types it in: that is input. The office prints a fresh 7/12 extract and hands it over: that is output. The farmer is wise: he keeps a photocopy of every extract at home, so a flood or fire in one place cannot wipe out his proof — that is a backup. The old record books in the godown can only be searched page after page from the start, unlike a register where you jump straight to a page — that is sequential access (magnetic tape) versus direct access (disk). And when only a few pages change, he photocopies just the new pages instead of the whole file — an incremental backup.

In everyday lifeIn the exam topic
Farmer’s form typed in by the clerkInput device (keyboard, scanner, OMR, MICR)
Printed 7/12 extract handed overOutput device (printer, monitor)
Photocopy kept safely at homeBackup copy on another device or place
Old record books read page by page from the startMagnetic tape — sequential access
Copying only the pages changed since the last copyIncremental backup

The concept

Input devices turn real-world data into signals the computer understands: keyboard, mouse, scanner, microphone, webcam, joystick, light pen, barcode reader, biometric scanner. Three special readers are favourite exam questions: MICR (Magnetic Ink Character Recognition) reads the magnetic-ink numbers at the bottom of bank cheques; OMR (Optical Mark Reader) detects filled bubbles on answer sheets; OCR (Optical Character Recognition) turns printed text in an image into editable text. A touch screen is both an input and an output device.

Output devices: monitors (CRT, LCD, LED), speakers, projectors, plotters (large engineering drawings) and printers. Impact printers strike a ribbon: dot-matrix (speed in characters per second, cps), line printer (lines per minute, lpm), daisy wheel. Non-impact printers do not hammer the paper: inkjet, laser (pages per minute, ppm), thermal (bill printers). Print quality is measured in dpi (dots per inch).

Backup devices keep a second copy of data: magnetic tape (cheap, huge, sequential — used for archives), external hard disks, optical discs (CD ≈ 700 MB, DVD ≈ 4.7 GB single layer, Blu-ray ≈ 25 GB single layer), flash storage (pen drive, SSD, memory card) and cloud/network storage. Backup types: full (everything), incremental (changes since the last backup of any type — quickest to take, slowest to restore) and differential (changes since the last full backup — restore needs only the full plus the latest differential).

Key points & formulas

  • MICR → bank cheques; OMR → bubble answer sheets; OCR → printed text to editable text; barcode reader → shop billing
  • Impact: dot-matrix (cps), line printer (lpm), daisy wheel; non-impact: inkjet, laser (ppm), thermal
  • Touch screen = input + output; plotter = output for large drawings
  • Magnetic tape is sequential access; hard disk, SSD and RAM are direct (random) access
  • CD ≈ 700 MB, DVD ≈ 4.7 GB (single layer), Blu-ray ≈ 25 GB (single layer)
  • Restore with incremental backups: last full + every incremental after it, in order
  • Restore with differential backups: last full + only the latest differential
  • 3-2-1 rule: 3 copies, on 2 types of media, 1 kept off-site

Worked example

A college office takes a full backup every Sunday night and an incremental backup every other night. The disk crashes on Thursday morning. Which backups are needed to restore, and in what order? What changes if the nightly backups were differential instead?

Show solution
  1. The last full backup is Sunday night’s.
  2. Incrementals after it: Monday, Tuesday and Wednesday nights. Each holds only that one day’s changes, so all three are needed.
  3. Restore order: Sunday full → Monday → Tuesday → Wednesday.
  4. With differential backups, Wednesday’s differential already holds every change since Sunday, so only Sunday full + Wednesday differential are needed.

Answer: Incremental: Sunday full + Mon + Tue + Wed (4 sets). Differential: Sunday full + Wednesday (2 sets).

Exam shortcut

Match the reader to its job by one word: MICR = Magnetic ink → money (cheques); OMR = Marks (bubbles); OCR = Characters (text).

Common traps

  • OMR and OCR are both optical, but OMR only detects whether a bubble is filled; it cannot read letters.
  • A laser printer is non-impact even though offices use it for bulk printing; “impact” means a pin or hammer strikes a ribbon.

Practice · tap an option to check

Q1. The numbers printed at the bottom of a bank cheque are read by:

Q2. Which of the following is an impact printer?

Q3. A full backup is taken on Sunday night and a differential backup every other night. The disk fails on Friday morning. Which backups must be restored?

Q4. Which storage medium gives only sequential access and is mainly used for long-term archival backup?

↑ Back to topic list

Computer · Computer Basics · Topic 4 of 16

Memory Hierarchy and Organization

Think of it like…

Studying at your desk for CET

Picture yourself studying for CET. The pen and the one formula you are using right now are in your hand — instant, but you can hold very little (registers). The few books open on your desk are a hand-stretch away (cache). The bookshelf in your room holds all this year’s books, but you must get up to fetch one (main memory, RAM). The college library has thousands of books but needs a bicycle ride (secondary storage — SSD/hard disk). Closer means faster but smaller; farther means bigger, slower and cheaper. The whiteboard on your wall is wiped clean every night (volatile RAM), while the printed textbook stays the same for years (ROM). You leave the book you just used on the desk because you will probably need it again soon — that habit, locality of reference, is the reason cache works.

In everyday lifeIn the exam topic
Pen / formula in your handRegisters (inside the CPU, fastest, smallest)
Books open on the deskCache memory (SRAM)
Bookshelf in your roomMain memory (RAM, built from DRAM)
College library across townSecondary storage (SSD, hard disk)
Whiteboard wiped each night vs printed textbookVolatile RAM vs non-volatile ROM

The concept

Memory is arranged as a hierarchy: registers → cache (L1, L2, L3) → main memory (RAM) → secondary storage (SSD, HDD) → backup storage (tape, optical). Moving down, capacity rises and cost per bit falls, but access time grows. The CPU directly accesses only registers, cache and main memory (primary memory); secondary storage is reached through I/O. Cache works because of locality of reference: temporal (a word used now will be used again soon) and spatial (its neighbours will be used soon).

RAM is volatile. SRAM uses flip-flops — fast, no refresh, costly — and is used for cache. DRAM stores each bit as charge on a capacitor — dense and cheap but must be refreshed — and is used for main memory. ROM is non-volatile and holds firmware such as the BIOS/boot program: mask ROM (written at the factory), PROM (programmed once by the user), EPROM (erased with ultraviolet light), EEPROM (erased electrically, byte by byte) and flash (erased electrically in blocks — pen drives, SSDs).

A memory chip is described as words × bits per word. A chip with n address lines has 2n locations; with m data lines, each location holds m bits. So capacity = 2n × m bits. CET uses binary units: 1 KB = 210 bytes, 1 MB = 220, 1 GB = 230, 1 TB = 240; a nibble is 4 bits and a byte is 8 bits.

Key points & formulas

  • Speed: registers > cache > RAM > SSD > HDD > tape; cost per bit falls in the same order
  • Cache = SRAM (no refresh); main memory = DRAM (needs refresh)
  • PROM: write once; EPROM: UV erase; EEPROM: electrical, byte-wise; Flash: electrical, block-wise
  • Capacity = 2address lines × word size; address lines = log₂(number of locations)
  • Chips needed = (total words ÷ chip words) × (total word size ÷ chip word size)
  • Hit ratio h = hits ÷ total accesses
  • EAT if a miss checks cache first, then memory: h·Tc + (1 − h)(Tc + Tm); if both are accessed together: h·Tc + (1 − h)·Tm
  • 1 KB = 210 B, 1 MB = 220 B, 1 GB = 230 B, 1 TB = 240 B

Worked example

A 32K × 8 memory is built from 8K × 8 RAM chips. How many chips are needed? How many address lines does the whole memory need, how many go to every chip, and how many to the decoder that selects a chip?

Show solution
  1. Chips = (32K ÷ 8K) × (8 ÷ 8) = 4 × 1 = 4 chips.
  2. Total words = 32K = 25 × 210 = 215, so the memory needs 15 address lines.
  3. Each chip has 8K = 213 words, so the lower 13 lines go to every chip in parallel.
  4. The remaining 15 − 13 = 2 high-order lines drive a 2-to-4 decoder that enables one of the 4 chips.

Answer: 4 chips; 15 address lines in all — 13 to each chip, 2 to a 2×4 decoder

Exam shortcut

Turn every size into a power of 2 first: 2 MB = 21 × 220 = 221 bytes → 21 address lines for a byte-addressable memory. After that, everything is just adding and subtracting exponents.

Common traps

  • Address lines count locations, not bits. A 64K × 16 word-addressable memory needs 16 address lines; the “× 16” only decides the number of data lines.
  • Check byte-addressable vs word-addressable: 1 MB of 32-bit words is 218 words (18 lines) but 220 bytes (20 lines).
  • The two EAT formulas give different answers; read whether a miss also spends the cache access time.

Practice · tap an option to check

Q1. A memory chip has 12 address lines and 8 data lines. Its capacity is:

Q2. How many address lines are needed to address a 2 MB byte-addressable memory?

Q3. How many 1K × 4 RAM chips are needed to build an 8K × 8 memory?

Q4. A cache has access time 10 ns and hit ratio 0.9; main memory access time is 100 ns. Every access looks in the cache first; on a miss, main memory is read only after the cache lookup fails, so a miss costs the cache time plus the memory time. The effective access time is:

↑ Back to topic list

Computer · Data Representation · Topic 5 of 16

Number Systems and Conversions

Think of it like…

Paying with one coin of each power of 2

Imagine a toll-booth cashier who has only coins of ₹1, ₹2, ₹4, ₹8, ₹16, ₹32, ₹64 and ₹128 — and may give at most one coin of each value. To pay ₹13 she takes the biggest coin that fits (₹8, leaving 5), then ₹4 (leaving 1), skips ₹2, then takes ₹1. Writing “took = 1, skipped = 0” from the biggest coin down gives 1101 — and that is 13 in binary. Our normal decimal system works the same way with notes of ₹1, ₹10, ₹100, ₹1000, where you may use up to nine of each. Every number system is just “which note values exist, and how many of each may you use”.

In everyday lifeIn the exam topic
Coin values ₹1, ₹2, ₹4, ₹8 …Place values 2⁰, 2¹, 2², 2³ … (base 2)
At most one coin of each valueEach binary digit is only 0 or 1
Took = 1, skipped = 0, biggest coin firstThe bit pattern, e.g. 13 = 11012
Notes ₹1, ₹10, ₹100, up to nine of eachDecimal: base 10, digits 0–9
Always take the biggest coin that still fitsConversion by subtracting powers of 2

The concept

In a positional number system with base (radix) r, each digit is multiplied by a power of r that depends on its position. Binary (base 2) uses 0–1, octal (base 8) uses 0–7, decimal (base 10) uses 0–9, and hexadecimal (base 16) uses 0–9 and A–F (A = 10 … F = 15). To convert any base to decimal, multiply each digit by its place value and add: 1011.12 = 8 + 0 + 2 + 1 + 0.5 = 11.5.

To convert a decimal integer to base r, divide repeatedly by r and read the remainders from bottom to top. For a decimal fraction, multiply repeatedly by r and read the integer parts from top to bottom. Some fractions never end: 0.110 = 0.000110011…2, which is why a computer cannot store 0.1 exactly.

Binary ↔ octal and binary ↔ hex need no division at all, because 8 = 2³ and 16 = 2⁴. Group bits in threes (octal) or fours (hex), starting from the binary point — leftwards for the integer part and rightwards for the fraction — padding with zeros. For octal ↔ hex, go through binary.

Key points & formulas

  • Value = Σ digit × rposition (positions …, 2, 1, 0, −1, −2 …)
  • Integer → base r: divide by r, read remainders bottom-up
  • Fraction → base r: multiply by r, read integer parts top-down
  • Binary → octal: groups of 3; binary → hex: groups of 4, from the point outwards
  • Hex digits: A = 10, B = 11, C = 12, D = 13, E = 14, F = 15
  • Useful powers: 2¹⁰ = 1024, 8² = 64, 8³ = 512, 16² = 256, 16³ = 4096
  • Largest n-digit number in base r = rn − 1 (8 bits → 255 = FF16)

Worked example

Convert 156.62510 to binary, octal and hexadecimal.

Show solution
  1. Integer part: dividing 156 by 2 again and again gives remainders 0, 0, 1, 1, 1, 0, 0, 1. Read bottom to top: 10011100. Check: 128 + 16 + 8 + 4 = 156.
  2. Fraction: 0.625 × 2 = 1.25 → 1; 0.25 × 2 = 0.5 → 0; 0.5 × 2 = 1.0 → 1. Read top-down: .101.
  3. Binary: 10011100.1012.
  4. Octal: 010 011 100 . 101 → 234.58.
  5. Hex: 1001 1100 . 1010 (fraction padded with a 0) → 9C.A16.

Answer: 10011100.1012 = 234.58 = 9C.A16

Exam shortcut

For decimal → binary of small numbers, skip division: write 128 64 32 16 8 4 2 1 and tick the values that add up to the number (the coin method). For “find the base” questions, write the number as a polynomial in b and test the options.

Common traps

  • Grouping for octal/hex starts at the binary point, not at the left end: 1011.12 = 001 011 . 100 = 13.48, not 13.18.
  • For fractions, read the integer parts top-down; reading them bottom-up (like integer remainders) gives a wrong answer.

Practice · tap an option to check

Q1. (2AF)16 in decimal is:

Q2. (0.375)10 in binary is:

Q3. (725)8 in hexadecimal is:

Q4. If (121)b = (49)10, the base b is:

↑ Back to topic list

Computer · Data Representation · Topic 6 of 16

Character and Data Representation (ASCII, Unicode, BCD, Parity)

Think of it like…

Indian Railways train numbers

Every train in India has a fixed number. The station master in Nagpur, the booking clerk in Pune and the app on your phone all agree that 12123 is the Deccan Queen, so a ticket made in one city is understood everywhere. Computers do the same with letters: they agree on one number for each character — “A” is 65 everywhere — so a file typed on one machine reads correctly on another. The old railway scheme used four digits and ran short of numbers as trains increased; in 2010 it moved to five digits and kept the old numbers inside the new ones (2123 became 12123). Text coding went through the same story: 7-bit ASCII has only 128 codes — enough for English, no room for मराठी. Unicode gives a number to every character of every script and keeps the 128 ASCII codes as its first 128, so old English text still works.

In everyday lifeIn the exam topic
Train name (Deccan Queen)A character (the letter A)
Its fixed train number (12123)Its character code (65)
Same number at every station in IndiaSame code table on every computer, so text can be exchanged
Old 4-digit numbers ran short7-bit ASCII: only 2⁷ = 128 codes, no Devanagari
5-digit scheme keeps old numbers insideUnicode: the first 128 code points are exactly ASCII

The concept

Computers store only bits, so every character gets an agreed number (its code). ASCII is a 7-bit code with 128 characters: 0–31 are control characters, 32 is space, 48–57 are the digits ‘0’–‘9’, 65–90 are A–Z and 97–122 are a–z. Extended ASCII uses 8 bits (256 characters). IBM mainframes used EBCDIC, an 8-bit code. Unicode covers all scripts and is stored as UTF-8 (1 to 4 bytes per character: ASCII characters take 1 byte, Devanagari letters take 3), UTF-16 (2 or 4 bytes) or UTF-32 (always 4 bytes).

Numbers can also be stored digit by digit. BCD (Binary Coded Decimal, 8421 code) writes each decimal digit in 4 bits: 395 = 0011 1001 0101. The patterns 1010 to 1111 are invalid in BCD. Excess-3 adds 3 to each digit before coding (5 → 1000). Gray code changes only one bit between consecutive numbers.

A parity bit is an extra bit chosen so that the total number of 1s is even (even parity) or odd (odd parity). The receiver counts the 1s; a wrong count means an error. Parity detects any odd number of flipped bits (for example, one), but misses two flipped bits, and cannot tell which bit is wrong, so it cannot correct errors (a Hamming code can).

Key points & formulas

  • ASCII: 7 bits, 128 characters; extended ASCII: 8 bits, 256 characters
  • ‘0’ = 48, ‘A’ = 65, ‘a’ = 97, space = 32; lowercase = uppercase + 32 (only bit 5 differs)
  • Unicode: one code point for every character of every script; the first 128 are ASCII
  • UTF-8: 1 byte for ASCII, 3 bytes for Devanagari (e.g. अ = U+0905)
  • BCD: 4 bits per decimal digit; 1010–1111 are invalid
  • Excess-3 = BCD of (digit + 3); Gray code: one bit changes between neighbours
  • Parity detects an odd number of bit errors (e.g. 1), misses 2, and cannot correct
  • n bits can represent 2n different characters

Worked example

The ASCII code of ‘g’ is 103. Write its 7-bit binary form and convert it to uppercase ‘G’ by changing a single bit.

Show solution
  1. 103 = 64 + 32 + 4 + 2 + 1 → 11001112.
  2. Uppercase letters are exactly 32 less than lowercase, and 32 = 01000002 is bit 5 (counting from bit 0 on the right).
  3. Clear bit 5: 1100111 → 10001112 = 64 + 4 + 2 + 1 = 71.
  4. 71 is the ASCII code of ‘G’.

Answer: ‘g’ = 11001112; clearing bit 5 gives 10001112 = 71 = ‘G’

Exam shortcut

Remember three anchors: 48, 65, 97 (‘0’, ‘A’, ‘a’). Every other code is anchor + position: ‘d’ = 97 + 3 = 100, ‘7’ = 48 + 7 = 55, ‘Z’ = 65 + 25 = 90.

Common traps

  • The character ‘7’ is not the number 7: its ASCII code is 55. In C, '7' - '0' gives 7.
  • BCD is not binary: 25 in BCD is 0010 0101, but in binary it is 11001.

Practice · tap an option to check

Q1. If the ASCII code of ‘A’ is 65, what is the ASCII code of ‘d’?

Q2. The BCD (8421) representation of 395 is:

Q3. A receiver uses even parity on 8-bit words (7 data bits + 1 parity bit). Which received word shows an error?

Q4. In UTF-8, how many bytes are needed to store the two-character string “Aअ” (Latin A followed by Devanagari अ)?

↑ Back to topic list

Computer · Data Representation · Topic 7 of 16

Binary Arithmetic, Signed Numbers and Two’s Complement

Think of it like…

A scooter odometer rolling back below 0000

Look at an old scooter’s mechanical odometer with four digits. Wind it back by 1 from 0000 and it does not show “−1”; it rolls over to 9999. A mechanic who knows this simply reads 9999 as “one below zero”, 9998 as “two below zero”, and so on. Now imagine a binary odometer with 4 wheels that show only 0 or 1. Going back one from 0000 gives 1111, so 1111 means −1, 1110 means −2, and 1000 (halfway round) is the most negative, −8. That rolled-back reading is exactly the two’s complement code. Because the meter just counts round a circle, adding a negative number is the same as winding forward — so the computer needs only an adder, never a separate subtractor. Crossing the halfway mark by accident (7 + 1 landing on 1000 = −8) is overflow.

In everyday lifeIn the exam topic
Fixed number of odometer wheelsFixed number of bits (n-bit register)
Rolling back below 0000 to 1111−1 is stored as all 1s
Distance left to the wrap-around point 10000Two’s complement of x = 2n − x
No fifth wheel to show the carryThe final carry out is discarded
7 + 1 jumping across halfway to 1000Overflow: result does not fit, sign comes out wrong

The concept

Binary addition uses 0 + 0 = 0, 0 + 1 = 1, 1 + 1 = 10 (write 0, carry 1) and 1 + 1 + 1 = 11. Signed numbers can be stored in three ways in n bits. Sign-magnitude: the MSB is the sign and the rest is the size. One’s complement: a negative number is the positive number with every bit inverted. Two’s complement: invert every bit and add 1 (equivalently 2n − x). Sign-magnitude and one’s complement both have two zeros (+0 and −0); two’s complement has only one zero, which is why every modern CPU uses it.

To find A − B in two’s complement, add A to the two’s complement of B and ignore any carry out of the MSB. If the MSB of the answer is 1, the answer is negative; take its two’s complement to read the size. Overflow happens only when two numbers of the same sign are added and the result has the opposite sign — equivalently, when the carry into the MSB differs from the carry out of it. Adding a positive and a negative number can never overflow.

To widen a two’s-complement number to more bits, copy the sign bit into the new places (sign extension): −3 is 1101 in 4 bits and 11111101 in 8 bits.

Key points & formulas

  • n-bit two’s complement range: −2n−1 to +2n−1 − 1 (8 bits: −128 to +127)
  • n-bit sign-magnitude and one’s complement range: −(2n−1 − 1) to +(2n−1 − 1), with two zeros
  • Two’s complement = one’s complement + 1 = 2n − x
  • Quick method: copy bits from the right up to and including the first 1, then invert the rest
  • A − B = A + (two’s complement of B); discard the end carry
  • Overflow: (+) + (+) gives (−), or (−) + (−) gives (+); carry into MSB ≠ carry out of MSB
  • Sign extension: repeat the MSB when widening

Worked example

Compute 25 − 37 using 8-bit two’s complement arithmetic.

Show solution
  1. 25 = 00011001 and 37 = 00100101.
  2. Two’s complement of 37: invert → 11011010, add 1 → 11011011.
  3. Add: 00011001 + 11011011 = 11110100 (no carry out).
  4. The MSB is 1, so the answer is negative. Two’s complement of 11110100 = 00001100 = 12.
  5. So the result is −12. Check: 25 − 37 = −12. ✓

Answer: 111101002 = −12

Exam shortcut

To read a negative two’s-complement number fast, give the MSB a negative weight: 11110100 = −128 + 64 + 32 + 16 + 4 = −12. No inverting needed.

Common traps

  • “Invert and add 1” is two’s complement; inverting alone is one’s complement. Read which one the question asks for.
  • A carry out of the MSB is not overflow in two’s complement. Judge overflow by the signs, not by the carry.
  • The range is not symmetric: −128 fits in 8 bits, +128 does not.

Practice · tap an option to check

Q1. The 8-bit two’s complement representation of −45 is:

Q2. The range of integers that can be represented in 8-bit two’s complement is:

Q3. In 4-bit two’s complement arithmetic, 0110 + 0101 = 1011. Which statement is correct?

Q4. The 8-bit pattern 10000001 represents which values in sign-magnitude, one’s complement and two’s complement respectively?

↑ Back to topic list

Computer · Data Representation · Topic 8 of 16

Floating Point and Normalization (IEEE 754)

Think of it like…

Property prices written in lakh and crore

A builder’s rate board in Pune has room for just three digits and one unit word: “₹ 2.53 crore”, “₹ 8.40 lakh”. Nobody writes ₹25300000 — it is too long — and nobody writes “₹ 0.253 ten-crore”, because that wastes a digit on a leading zero. The rule “one non-zero digit before the point, then the unit word” is normalization. The three digits are the mantissa (significand): they give precision. The unit word is the exponent: it gives range. A flat costing ₹2,53,46,781 is shown as 2.53 crore, so the last digits are lost — that is rounding error. Computers do the same thing in base 2, and since a normalized binary number always starts with 1, they do not even store that 1 (the hidden bit).

In everyday lifeIn the exam topic
The three digits shown, e.g. 2.53Mantissa / significand (precision)
The unit word: lakh, croreExponent (range — the power of the base)
“One non-zero digit before the point” ruleNormalization: 1.xxx × 2e
Last digits of ₹2,53,46,781 droppedRounding error from limited mantissa bits
Minus sign for a lossSign bit

The concept

Floating point stores a real number as ± M × BE: a sign, a mantissa M and an exponent E (base B = 2 in computers). A number is normalized when the mantissa has no leading zeros, so no bit is wasted. Two conventions appear in books: older textbooks use 0.1xxx × 2E (first bit after the point is 1); IEEE 754 uses 1.xxx × 2E. Read the question to see which one is meant.

IEEE 754 single precision (32 bits, C’s float) has 1 sign bit, 8 exponent bits and 23 fraction bits. The exponent is stored with a bias of 127 (stored E = actual exponent + 127), and the leading 1 is not stored (hidden bit), so value = (−1)S × 1.F × 2E − 127. Double precision (64 bits) uses 1 + 11 + 52 bits with bias 1023.

Special patterns: E = 0 and F = 0 is ±0; E = 255 and F = 0 is ±∞; E = 255 and F ≠ 0 is NaN (not a number, e.g. 0/0); E = 0 and F ≠ 0 is a denormal (very tiny) number. So normal exponents run from −126 to +127. A number such as 0.1 is a repeating fraction in binary and is stored only approximately; numbers made of halves, quarters and eighths (0.5, 0.75, 0.625) are exact.

Key points & formulas

  • Single: 1 sign + 8 exponent + 23 fraction = 32 bits, bias 127
  • Double: 1 sign + 11 exponent + 52 fraction = 64 bits, bias 1023
  • Value = (−1)S × 1.F × 2E − 127 (the hidden 1 is not stored)
  • Stored exponent = actual exponent + 127 (so 1.0 has E = 127 = 01111111)
  • E all 0s and F = 0 → zero; E all 1s and F = 0 → infinity; E all 1s and F ≠ 0 → NaN
  • Normalizing: move the point until a single 1 is left of it; moving the point left raises the exponent
  • Only fractions with a power-of-2 denominator are exact (0.5, 0.25, 0.625 yes; 0.1, 0.2 no)

Worked example

Write −12.375 in IEEE 754 single precision (binary and hex).

Show solution
  1. Sign: negative → S = 1.
  2. 12 = 1100 and 0.375 = .011, so 12.375 = 1100.0112.
  3. Normalize: 1100.011 = 1.100011 × 2³ (point moved 3 places left).
  4. Stored exponent = 3 + 127 = 130 = 10000010.
  5. Fraction (after the hidden 1): 100011 followed by 17 zeros.
  6. Bits: 1 | 10000010 | 10001100000000000000000. In fours: 1100 0001 0100 0110 0000 … → C146000016.

Answer: 1 10000010 10001100000000000000000 = C146000016

Exam shortcut

To decode a hex pattern such as C0A00000, write only the first 3 hex digits in binary (C0A → 1100 0000 1010): first bit = sign, next 8 bits = exponent, the rest = start of the fraction. You rarely need more than 12 bits.

Common traps

  • Do not forget the bias: the stored exponent is actual + 127, not the actual exponent.
  • The hidden 1 is not stored; the 23 fraction bits are only what comes after the point.
  • If the question uses the 0.1xxx normalization, 1100.011 becomes 0.1100011 × 2⁴ — a different exponent.

Practice · tap an option to check

Q1. The IEEE 754 single-precision pattern C0A0000016 represents:

Q2. In IEEE 754 single precision, the stored (biased) exponent field for the number 1.0 is:

Q3. The IEEE-style normalized form (1.F × 2e) of 0.00010112 is:

Q4. Which of these decimal numbers can be stored exactly in IEEE 754 single precision?

↑ Back to topic list

Computer · Data Representation · Topic 9 of 16

Boolean Algebra, Logic Gates, Truth Tables and K-maps

Think of it like…

The switches and bulbs in your house

Look at the wiring in your house. If a bulb is connected through two switches placed one after the other (in series), it glows only when switch A and switch B are both on — that is AND. If the two switches are placed side by side (in parallel), either one can light it — that is OR. A push-button that breaks the circuit when pressed gives NOT. And the staircase light, which you switch on downstairs and off upstairs, changes state whenever exactly one switch is flipped — those two-way switches behave as XOR. Boolean algebra is simply the arithmetic of such on/off switches: 1 = on/closed/true, 0 = off/open/false.

In everyday lifeIn the exam topic
Two switches in seriesAND: A·B
Two switches in parallelOR: A + B
Push-button that cuts the circuit when pressedNOT: A′
Staircase two-way switches — any single flip toggles the lightXOR: A ⊕ B = A′B + AB′
Bulb on / offOutput 1 / 0

The concept

Boolean algebra works on the values 0 and 1 with three basic operations: AND (·), OR (+) and NOT (′ or a bar). Other gates are combinations: NAND = NOT of AND, NOR = NOT of OR, XOR (1 when the inputs differ), XNOR (1 when the inputs are equal). NAND and NOR are universal gates: any circuit can be built using only one of them. A truth table for n inputs has 2n rows, and there are 22n different Boolean functions of n variables.

Key laws: A + 0 = A, A·1 = A, A + 1 = 1, A·0 = 0, A + A = A, A + A′ = 1, A·A′ = 0, (A′)′ = A; distributive A + BC = (A + B)(A + C); absorption A + AB = A, A(A + B) = A, and A + A′B = A + B. De Morgan’s laws: (A + B)′ = A′·B′ and (A·B)′ = A′ + B′ — “break the bar, change the sign”.

In a Venn diagram, AND is the overlap (intersection), OR is the union, NOT is everything outside the circle, and XOR is the two side parts without the overlap. A Karnaugh map places minterms in Gray-code order (00, 01, 11, 10) so neighbouring cells differ in one variable. Group adjacent 1s in blocks of 1, 2, 4 or 8 (groups may wrap around the edges); in each group, the variables that stay constant form one product term.

Key points & formulas

  • AND: 1 only if all inputs are 1; OR: 0 only if all inputs are 0
  • NAND: 0 only if all inputs are 1; NOR: 1 only if all inputs are 0 — both are universal
  • XOR = A′B + AB′ (1 when inputs differ); XNOR = AB + A′B′
  • De Morgan: (A + B)′ = A′B′; (AB)′ = A′ + B′
  • Absorption: A + AB = A; A(A + B) = A; A + A′B = A + B
  • n variables: 2n truth-table rows and 22n possible functions
  • K-map order 00, 01, 11, 10; a group of 2k cells removes k variables
  • Venn: AND = intersection, OR = union, XOR = symmetric difference

Worked example

Simplify F(A, B, C) = Σm(0, 1, 2, 4, 5) using a K-map.

Show solution
  1. Minterms as ABC: 0 = 000, 1 = 001, 2 = 010, 4 = 100, 5 = 101.
  2. K-map rows A = 0, 1; columns BC = 00, 01, 11, 10. Row A = 0 has 1s under 00, 01, 10; row A = 1 has 1s under 00, 01.
  3. Group of four: cells 0, 1, 4, 5 (columns 00 and 01 in both rows). B = 0 throughout while A and C change → term B′.
  4. Cell 2 (010) is still uncovered. Pair it with cell 0 (000) by wrapping around the row edge: A = 0 and C = 0 stay fixed → term A′C′.
  5. F = B′ + A′C′. Check m2 = 010: B = 1, so only A′C′ covers it. ✓

Answer: F = B′ + A′C′

Exam shortcut

For “simplify” MCQs, test the original and the four options with a few input rows, e.g. (A, B) = (0, 0), (0, 1), (1, 0), (1, 1). Usually one or two rows rule out three options.

Common traps

  • De Morgan changes the operator too: (A + B)′ is A′B′, not A′ + B′.
  • K-map columns go 00, 01, 11, 10 — not 00, 01, 10, 11. Binary order breaks the adjacency.
  • A + BC = (A + B)(A + C) is true in Boolean algebra even though it looks wrong in ordinary algebra.

Practice · tap an option to check

Q1. A + A′B simplifies to:

Q2. By De Morgan’s law, (A + B + C)′ equals:

Q3. In a Venn diagram of sets A and B, the shaded region is everything in A or in B but not in both. Which Boolean expression does it represent?

Q4. The minimal expression for F(A, B, C, D) = Σm(0, 2, 8, 10) is:

↑ Back to topic list

Computer · Computer Architecture · Topic 10 of 16

Buses, Processor–I/O Communication and Interrupts

Think of it like…

A teacher handling doubts in a classroom

A teacher is explaining a chapter to a class of sixty. One way to handle doubts is to stop after every few lines and ask each student in turn, “Any doubt? Any doubt?” — tiring and mostly wasted (polling / programmed I/O). A better way: students simply raise a hand when they need help. The teacher finishes the sentence she is speaking, keeps a finger on the line in the textbook, answers the doubt, then continues from the same line (interrupt: finish the current instruction, save the PC, run the service routine, return). If two hands go up together, a fixed rule decides who goes first (priority), and if the principal walks in with an announcement, nobody can ignore it (non-maskable interrupt). To collect sixty notebooks and carry them to the staffroom, she just tells the class monitor to do it and keeps teaching; he tells her only when the job is finished (DMA).

In everyday lifeIn the exam topic
Asking every student “any doubt?” again and againProgrammed I/O (polling): CPU keeps checking the device status
A student raising a handInterrupt request (IRQ) from a device
Finger on the textbook line, answer, then continueSave PC and flags, run the ISR, return
Principal’s announcement that cannot be ignoredNon-maskable interrupt (e.g. power failure)
Monitor carries the notebooks by himselfDMA: controller moves the block, interrupts only at the end

The concept

At block level a computer is CPU + memory + I/O modules joined by a system bus with three parts. The address bus carries the location the CPU wants (one-way: CPU → memory/I/O); with n address lines the CPU can address 2n locations. The data bus carries the data itself (two-way); its width is the number of bits moved in one transfer. The control bus carries signals such as memory read/write, I/O read/write, interrupt request, bus request/grant and the clock. Devices connect through interfaces/ports, addressed either as part of memory (memory-mapped I/O) or with separate I/O instructions (isolated I/O).

The processor and I/O can talk in three ways. Programmed I/O: the CPU keeps testing the device’s status bit (busy-waiting), wasting CPU time. Interrupt-driven I/O: the device sends an interrupt when it is ready; the CPU does other work meanwhile but still moves every word itself. DMA (Direct Memory Access): the CPU gives the DMA controller the start address, word count and direction; the controller takes the bus (bus request / bus grant, HOLD/HLDA) and moves the whole block between device and memory, by cycle stealing or in burst mode, then interrupts the CPU once at the end. DMA suits fast bulk devices such as disks.

When an interrupt arrives, the CPU finishes the current instruction, saves the PC and flags on the stack, finds the address of the Interrupt Service Routine (ISR) — often from an interrupt vector table — runs it, and on the return instruction restores the saved state. Hardware interrupts come from devices and are maskable (can be disabled) or non-maskable (NMI, e.g. power failure). Software interrupts / traps are caused by instructions (system calls) or by errors (divide by zero, invalid opcode, page fault — called exceptions). With several devices, priority is set by polling order in software or by daisy chaining in hardware, where the device nearest the CPU has the highest priority.

Key points & formulas

  • Address bus: one-way (from CPU); data bus: two-way; control bus: individual signal lines
  • n address lines → 2n locations; data bus width = bits per transfer
  • Programmed I/O: CPU busy-waits; interrupt I/O: CPU free until the device signals; DMA: block moved without the CPU
  • DMA uses bus request/grant (HOLD/HLDA); modes: cycle stealing and burst
  • The CPU checks for interrupts at the end of each instruction cycle
  • On interrupt: finish instruction → save PC + flags on stack → run ISR → restore → resume
  • NMI cannot be disabled (power failure); divide by zero is an internal trap/exception
  • Daisy chain: priority by position — the device nearest the CPU is highest

Worked example

A program is executing the one-word instruction at address 2000 when a keyboard interrupt arrives. The ISR starts at address 6000. List what the CPU does, in order.

Show solution
  1. Finish executing the current instruction at 2000. The PC already holds 2001, the next instruction’s address.
  2. Acknowledge the interrupt and (usually) disable further maskable interrupts.
  3. Push the PC (2001) and the flag register onto the stack.
  4. Load the PC with the ISR address 6000 (from the vector table) and run the ISR — it reads the key code from the keyboard port.
  5. On the return-from-interrupt instruction, pop the flags and the PC (2001) and continue the program as if nothing had happened.

Answer: Finish instruction → save PC (2001) and flags → jump to 6000 → run ISR → restore → resume at 2001

Exam shortcut

Rank the three I/O methods by CPU involvement: programmed I/O (most) > interrupt-driven > DMA (least). Any question mentioning “large block”, “disk” or “without the CPU” → DMA.

Common traps

  • The CPU does not abandon an instruction half-way for an ordinary interrupt; it completes the current instruction first.
  • DMA still uses one interrupt — at the end of the whole block, not for every word.

Practice · tap an option to check

Q1. Which part of the system bus is unidirectional?

Q2. Transferring a large block of data from disk to main memory with the least CPU involvement is done by:

Q3. An I/O device raises a maskable interrupt (interrupts are enabled) while the CPU is in the middle of an instruction. What does the CPU do?

Q4. A device is polled 1000 times per second. Each poll takes 100 clock cycles, and the CPU runs at 100 MHz. What fraction of CPU time is spent polling?

↑ Back to topic list

Computer · Computer Language · Topic 11 of 16

Assembly vs High-Level Languages; Compiler, Interpreter, Assembler, Linker, Loader

Think of it like…

Translating a Marathi novel vs a live interpreter at a gram sabha

Suppose a popular Marathi novel must reach English readers. One way: a translator works for months, translates the whole book, lists all the unclear sentences together, and prints an English edition. After that, readers read the English book as often as they like without the translator — that is a compiler. Another way: at a gram sabha with a foreign visitor, an interpreter stands beside the speaker and translates sentence by sentence as it is spoken; if one sentence makes no sense she stops right there — and if the speech is given again tomorrow, she must translate it all over again. A stenographer’s shorthand, where each squiggle stands for one exact word, is like assembly language, and typing it out word for word is the assembler. The binder who stitches chapters written by different authors and an appendix from a reference book into one volume is the linker, and the library peon who places the bound book on the reader’s desk is the loader.

In everyday lifeIn the exam topic
Whole book translated once; printed edition read many timesCompiler: whole program → object code, then run without the compiler
Live translator, sentence by sentence, stops at the first confusing sentenceInterpreter: statement by statement, stops at the first error, re-translates on every run
Shorthand symbol per word, typed out by the stenoAssembly mnemonic per machine instruction, translated by an assembler
Binder stitching chapters + reference appendix into one bookLinker: joins object files + library code into one executable
Peon placing the book on the reader’s deskLoader: puts the executable into memory and starts it

The concept

Languages are grouped in generations. Machine language (1GL) is pure binary — the only thing a CPU executes; fast but machine-dependent and hard to write. Assembly language (2GL) replaces bit patterns with mnemonics (MOV, ADD, JMP) and labels; each statement usually becomes exactly one machine instruction, so it is still machine-dependent (not portable) but gives full control of the hardware — used in device drivers and embedded code. High-level languages (3GL: C, C++, Java, Python) are close to English and maths, portable, and one statement becomes many machine instructions. 4GLs such as SQL describe what you want, not how.

An assembler converts assembly into machine code (a two-pass assembler builds a symbol table of labels in pass 1). A compiler translates the whole high-level program into object code and lists all errors after scanning it; the result runs fast and needs no compiler at run time (C, C++). An interpreter translates and executes one statement at a time, stops at the first error, produces no object file and runs slower (Python, BASIC; Java bytecode is run by the JVM). A cross-compiler produces code for a different machine.

Building a C program goes: preprocessor (handles #include and #define, removes comments) → compiler (C to assembly) → assembler (to an object file, .o/.obj) → linker (joins object files with library code such as printf, resolves external references, produces the executable) → loader (copies the executable into memory, relocates it and starts it). Syntax errors are caught by the compiler; a function declared but never defined gives a linker error; dividing by zero is a run-time error.

Key points & formulas

  • 1GL machine, 2GL assembly, 3GL high-level (C, Java), 4GL (SQL), 5GL (Prolog, AI)
  • Assembly: mnemonics, one-to-one with machine code, machine-dependent, needs an assembler
  • Compiler: whole program at once, all errors listed, produces object code, faster execution
  • Interpreter: line by line, stops at the first error, no object code, slower execution
  • C build chain: preprocessor → compiler → assembler → linker → loader
  • Linker resolves external references; loader allocates memory and relocates
  • Syntax error → compile time; missing function body → link time; divide by zero → run time

Worked example

A file marks.c has three separate problems: (1) a missing semicolon; (2) a function avg() declared with a prototype and called, but its body is never written anywhere; (3) a division by a variable that becomes 0 for one student. At which stage does each problem show up?

Show solution
  1. The preprocessor only copies headers and expands macros; it does not check C grammar.
  2. (1) A missing semicolon breaks the grammar → reported by the compiler (compile-time syntax error).
  3. (2) The prototype lets the call compile, but no object file contains the body of avg() → the linker reports “undefined reference to avg”.
  4. (3) Nothing is wrong in the text, so the program builds. When it runs, dividing by zero crashes it → run-time error.

Answer: (1) compiler, (2) linker, (3) run time

Exam shortcut

Remember the C chain as “Please Compile And Link, Later”: Preprocessor, Compiler, Assembler, Linker, Loader.

Common traps

  • An interpreter produces no object/executable file; “faster execution” always goes with the compiler.
  • Linker and loader are different: the linker makes the executable file; the loader puts it into memory when you run it.

Practice · tap an option to check

Q1. Which translator translates and executes a high-level program one statement at a time?

Q2. Combining several object files and library routines into a single executable file is the job of the:

Q3. Which statement about assembly language is FALSE?

Q4. The correct order of stages when a C program is built and run is:

↑ Back to topic list

Computer · Computer Language · Topic 12 of 16

C Basics: Data Types, Operators, Precedence, Type Conversion, printf

Think of it like…

Milk cans at the village dairy collection centre

At the village milk collection centre, milk is measured into containers of fixed size: a 250 ml mug, a 1-litre can, a 40-litre drum. Each container has a label saying what it holds. Pour the mug into a big can and nothing spills — that is safe widening (char → int → double). Pour a big can into a small mug and milk overflows — narrowing, where data is lost. Feed 2.75 litres to a counter that records only whole litres and it writes 2: the fraction is simply dropped, just as C drops the fraction when a double is stored in an int. If the clerk reads buffalo milk with the cow-milk fat chart, the reading is nonsense — like printing a float with %d. And the clerk always works in a fixed order — weigh, test fat, then multiply by the rate — just as C fixes the order of operators by precedence.

In everyday lifeIn the exam topic
Mug, can, drum of fixed sizesData types of fixed size: char (1 B), int (4 B), double (8 B)
Mug poured into a big can — nothing lostImplicit widening / promotion (int → double)
Whole-litre counter records 2.75 L as 2double → int conversion truncates the fraction
Buffalo milk read with the cow-milk chartWrong printf format specifier prints garbage
Fixed order: weigh, test fat, multiply by rateOperator precedence and associativity

The concept

C’s basic types (assume a typical system): char 1 byte, short 2, int 4, long 4 or 8, float 4, double 8. A signed n-bit integer ranges from −2n−1 to 2n−1 − 1 (a 4-byte int is about ±2.1 × 10⁹); unsigned ranges from 0 to 2n − 1. sizeof is an operator that gives a size in bytes. Integer division drops the fraction (7 / 2 is 3), and % works only on integers, with the result taking the sign of the left operand (-7 % 2 is −1).

Operators from highest to lowest precedence: postfix () [] ++ -- → unary ! ~ ++ -- - (type) sizeof → * / % → + - → shifts << >> → relational < <= > >= → == != → & → ^ → | → && → || → ?: → assignment → comma. Operators of equal precedence group left to right, except unary operators, ?: and assignment, which group right to left. && and || short-circuit: the right side is not evaluated if the left side already decides the answer.

In mixed expressions C converts the smaller type to the larger (implicit conversion: char/short → int → long → float → double); assigning to a smaller type truncates. A cast forces a conversion: (float)7 / 2 is 3.5, but (float)(7 / 2) is 3.0 because the division already happened in int. Common printf formats: %d/%i int, %u unsigned, %ld long, %f float/double (6 decimals by default), %e exponent form, %c char, %s string, %x hex, %o octal, %p pointer, %% a percent sign; %5d sets width 5, %-5d left-justifies, %.2f prints 2 decimals.

Key points & formulas

  • Assume char 1, short 2, int 4, float 4, double 8 bytes unless told otherwise
  • 7 / 2 = 3; 7 % 2 = 1; -7 / 2 = −3; -7 % 2 = −1 (sign of the left operand)
  • Precedence: unary > * / % > + − > << >> > relational > == != > & > ^ > | > && > || > ?: > = > ,
  • Right-to-left grouping: unary operators, ?:, assignment (a = b = 5)
  • Short-circuit: in a && b, b is skipped if a is 0; in a || b, b is skipped if a is non-zero
  • x << n = x × 2n; x >> n = x ÷ 2n (for non-negative x)
  • Promotion: char → int → long → float → double; a cast applies only to the operand right after it
  • printf: %d %u %f %c %s %x %o %e %p %%; %.2f = 2 decimals; %5d = width 5

Worked example

What does this program print?

#include <stdio.h>
int main(void) {
    int a = 7, b = 2;
    float f = a / b;
    float g = (float)a / b;
    printf("%.2f %.2f %d %d\n", f, g, a % b, -a % b);
    return 0;
}
Show solution
  1. a / b is int ÷ int = 3 (fraction dropped). Only then is 3 stored in the float, so f = 3.0.
  2. (float)a gives 7.0, and 7.0 / 2 is a float division = 3.5, so g = 3.5.
  3. a % b = 7 % 2 = 1.
  4. -a % b: unary minus binds tighter than %, so it is (−7) % 2 = −1 (sign follows the left operand).
  5. %.2f prints two decimal places.

Answer: 3.00 3.50 1 -1

Exam shortcut

For precedence questions, put in the brackets yourself first, in this order: unary, then * / %, then + −, then shifts, then comparisons, then bitwise & ^ |, then && ||, then ?:, then =. Mnemonic: “Uncle Arjun Saw Rani Buying Lots of Tea Again” — Unary, Arithmetic, Shift, Relational, Bitwise, Logical, Ternary, Assignment.

Common traps

  • float f = 7 / 2; stores 3.0, not 3.5 — the division is done in int before the conversion.
  • Bitwise & has lower precedence than ==: x & 1 == 0 means x & (1 == 0), which is always 0.
  • Printing a float with %d (or an int with %f) is undefined behaviour and prints garbage, not a converted value.

Practice · tap an option to check

Q1. What is the output of this program?

#include <stdio.h>
int main(void) {
    int x = 5 + 3 * 2 - 8 / 4 % 3;
    printf("%d", x);
    return 0;
}

Q2. What is the output of this program?

#include <stdio.h>
int main(void) {
    int a = 12, b = 10;
    printf("%d %d %d %d", a & b, a | b, a ^ b, a << 2);
    return 0;
}

Q3. What is the output of this program?

#include <stdio.h>
int main(void) {
    int a = 0, b = 5;
    if (a && ++b)
        printf("yes ");
    printf("%d %d", a, b);
    return 0;
}

Q4. What is the output of this program?

#include <stdio.h>
int main(void) {
    char c = 'A' + 2;
    printf("%c %d %x %o", c, c, c, c);
    return 0;
}

↑ Back to topic list

Computer · Computer Language · Topic 13 of 16

C Control Flow and Loops (Output Prediction)

Think of it like…

A PMPML city bus on its route

Think of a PMPML city bus in Pune running its route from stop 1 to stop 20. Before leaving each stop the conductor checks one condition: “Have we reached the last stop?” If not, the bus moves on — that check-then-repeat is a loop, and the stop number is the loop counter. At a stop where nobody is waiting and nobody wants to get down, the bus does not halt; it skips the rest of that stop’s work and goes on to the next stop — that is continue. If the bus breaks down at stop 12, the route ends there and everyone gets down — that is break. Now think of a passenger: someone who boards at stop 5 keeps riding through stops 6, 7, 8 … until they decide to get down. That is exactly a switch: control jumps in at the matching case and keeps running through the following cases until it meets a break.

In everyday lifeIn the exam topic
Stop number 1, 2, 3 …Loop counter (i)
Conductor checks “last stop?” before moving onLoop condition tested on every pass
Empty stop — bus skips it and goes to the nextcontinue: skip the rest of this pass
Breakdown — the route ends at oncebreak: leave the loop immediately
Passenger boards at stop 5 and rides on until getting downswitch enters at the matching case and falls through until break

The concept

if / else chooses between paths; any non-zero value counts as true. An else always pairs with the nearest unmatched if (the dangling-else rule), whatever the indentation. if (x = 0) is an assignment, not a comparison: it sets x to 0 and the condition is false. switch works only on integer/char values; control jumps to the matching case label and falls through every following case until a break or the end. default runs when no case matches, wherever it is written.

C has three loops. for (init; condition; update) and while (condition) test before each pass, so they may run zero times. do { … } while (condition); tests after each pass, so it always runs at least once. In a for loop, continue jumps to the update part (e.g. i++) and then the test; break leaves only the innermost loop or switch.

For output prediction, never guess: make a small table with one column per variable and one row per pass, and update it line by line. Watch post-increment/decrement inside conditions: in while (n-- > 2) the old value of n is compared and then n is decreased — even on the final, false test. A stray semicolon after for (…); or while (…); gives the loop an empty body.

Key points & formulas

  • Non-zero = true, 0 = false; if (x = 0) assigns and is always false
  • else pairs with the nearest unmatched if
  • switch: integer/char only; falls through until break; case labels must be constants
  • for/while: test first (0 or more passes); do-while: test last (at least 1 pass)
  • continue → next pass (in a for loop the update runs first); break → leave the innermost loop/switch
  • Nested loops with i = 1..n and j = i..n run n(n + 1)/2 times
  • for (i = 0; i < 5; i++); — the semicolon is an empty body; i ends at 5

Worked example

What does this program print?

#include <stdio.h>
int main(void) {
    int i, j, count = 0;
    for (i = 1; i <= 4; i++)
        for (j = i; j <= 4; j++)
            count++;
    printf("%d", count);
    return 0;
}
Show solution
  1. i = 1: j runs 1, 2, 3, 4 → 4 times.
  2. i = 2: j runs 2, 3, 4 → 3 times.
  3. i = 3: j runs 3, 4 → 2 times. i = 4: j runs 4 → 1 time.
  4. Total = 4 + 3 + 2 + 1 = 10, which is n(n + 1)/2 with n = 4.

Answer: 10

Exam shortcut

For loops with continue/break, write the i values in a row, strike out the ones skipped by continue and everything from the break onwards, then add what is left. For a switch, find the entry case and read downwards until the first break.

Common traps

  • A switch without break runs every case below the matching one, including default if it is below.
  • In while (n-- > 2), n is decreased one extra time on the final, failed test.
  • for (i = 0; i < 5; i++); followed by printf("%d", i); prints 5 once, not 0 to 4 — the semicolon ends the loop.

Practice · tap an option to check

Q1. What is the output of this program?

#include <stdio.h>
int main(void) {
    int x = 2;
    switch (x) {
        case 1: printf("one ");
        case 2: printf("two ");
        case 3: printf("three ");
                break;
        default: printf("other ");
    }
    return 0;
}

Q2. What is the output of this program?

#include <stdio.h>
int main(void) {
    int n = 5;
    while (n-- > 2)
        printf("%d ", n);
    printf("| %d", n);
    return 0;
}

Q3. What is the output of this program?

#include <stdio.h>
int main(void) {
    int i, sum = 0;
    for (i = 1; i <= 10; i++) {
        if (i % 3 == 0) continue;
        if (i > 7) break;
        sum += i;
    }
    printf("%d", sum);
    return 0;
}

Q4. What is the output of this program?

#include <stdio.h>
int main(void) {
    int x = 5;
    if (x = 0)
        printf("zero");
    else
        printf("nonzero %d", x);
    return 0;
}

↑ Back to topic list

Computer · Computer Language · Topic 14 of 16

C Arrays, Strings, Pointers and Functions (Recursion, Call by Value/Reference)

Think of it like…

Rooms in a Mumbai chawl

In an old Mumbai chawl, rooms run along one corridor with consecutive numbers — 101, 102, 103 … — all the same size. That is an array: equal boxes side by side, and the chawl’s name tells you where the first room is. A pointer is a chit with a room number written on it. Reading the chit is not visiting the room; you must walk to the room to see who lives there — that is dereferencing (*p). “Two rooms ahead” of 101 is 103, whatever the size of a room, just as p + 2 moves two elements, not two bytes. Now, when the society secretary wants to check your electricity bill, you can hand over a photocopy: he may scribble on it, and your original stays clean — call by value. Or you can give him your room number, and he can walk in and repaint your wall — call by reference (passing an address).

In everyday lifeIn the exam topic
Rooms 101, 102, 103 … of equal size in a rowArray elements in contiguous memory
Chit with a room number written on itPointer (holds an address)
Walking to the room to see who lives thereDereferencing: *p
“Two rooms ahead”Pointer arithmetic: p + 2 skips 2 elements
Photocopy vs your room number given to the secretaryCall by value vs call by reference (passing &x)

The concept

An array stores elements of one type in consecutive memory. Indexes start at 0, so int a[5] has a[0] to a[4], and C does no bounds checking. In an expression the array name becomes a pointer to the first element, and a[i] means exactly *(a + i); the address of a[i] = base + i × (size of one element). A string is a char array ending in the null character '\0': strlen counts the characters before it, while sizeof on the array counts the whole array including the '\0'.

A pointer holds an address. &x gives the address of x; *p gives the value stored at the address in p. Adding 1 to a pointer moves it by one element (4 bytes for an int *, 1 byte for a char *). C passes every argument by value: the function receives a copy, so changing the parameter does not change the caller’s variable. To let a function change a variable, pass its address and work through * — this is how C does call by reference (e.g. swap(&a, &b), scanf("%d", &n)). Arrays are passed as a pointer to the first element, so a function can change the caller’s array.

A recursive function calls itself. It needs a base case that stops the calls, and every call must move closer to it. Each call gets its own copy of local variables on the stack; statements written after the recursive call run while the calls return, in reverse order. A static local variable is created once and keeps its value between calls.

Key points & formulas

  • a[i] ≡ *(a + i) ≡ i[a]; address of a[i] = base + i × sizeof(element)
  • 2-D array (row-major): address of a[i][j] = base + (i × columns + j) × size
  • char s[] = "CET"; → sizeof is 4 (includes '\0'), strlen is 3
  • & = address of; * = value at; p + 1 moves one element
  • C passes by value; pass addresses (pointers) to change the caller’s variables
  • Arrays are passed as pointers, so changes made inside the function are visible outside
  • Recursion: base case + smaller sub-problem; code after the recursive call runs in reverse order
  • A static local variable is initialized once and keeps its value between calls

Worked example

What does this program print?

#include <stdio.h>
void swapVal(int x, int y) { int t = x; x = y; y = t; }
void swapPtr(int *x, int *y) { int t = *x; *x = *y; *y = t; }
int main(void) {
    int a = 3, b = 8;
    swapVal(a, b);
    printf("%d %d\n", a, b);
    swapPtr(&a, &b);
    printf("%d %d\n", a, b);
    return 0;
}
Show solution
  1. swapVal(a, b) receives copies x = 3, y = 8 and swaps only the copies. a and b in main are untouched → prints 3 8.
  2. swapPtr(&a, &b) receives the addresses. *x is a itself and *y is b itself, so the swap changes main’s variables → prints 8 3.

Answer: 3 8 on the first line, then 8 3

Exam shortcut

For pointer-and-array questions, draw the array as boxes with indexes under them and an arrow for p; read every *(p + k) or p[k] as “k boxes to the right of the arrow”. For recursion that prints after the call, the output appears in reverse order of the calls — like remainders read bottom-up in binary conversion.

Common traps

  • sizeof(s) for char s[] = "CET2026" is 8, not 7 — the hidden '\0' counts. (Inside a function where s is a pointer parameter, sizeof gives the pointer’s size instead.)
  • Changing a parameter inside a function never changes the caller’s variable unless you write through a pointer (*p = …).

Practice · tap an option to check

Q1. What is the output of this program?

#include <stdio.h>
int main(void) {
    int a[] = {10, 20, 30, 40, 50};
    int *p = a + 1;
    printf("%d %d %d", *p, *(p + 2), p[1]);
    return 0;
}

Q2. What is the output of this program?

#include <stdio.h>
#include <string.h>
int main(void) {
    char s[] = "CET2026";
    printf("%zu %zu", sizeof(s), strlen(s));
    return 0;
}

Q3. What is the output of this program?

#include <stdio.h>
void show(int n) {
    if (n == 0) return;
    show(n / 2);
    printf("%d", n % 2);
}
int main(void) {
    show(13);
    return 0;
}

Q4. What is the output of this program?

#include <stdio.h>
void change(int x, int *y) {
    x = x * 2;
    *y = *y * 2;
}
int main(void) {
    int a = 5, b = 5;
    change(a, &b);
    printf("%d %d", a, b);
    return 0;
}

↑ Back to topic list

Computer · Operating System basics · Topic 15 of 16

OS Basics: Processes, CPU Scheduling, Paging, Deadlock, File Systems

Think of it like…

The one-machine xerox shop near college

Near every college there is a xerox shop with one machine and a crowd of students. The shopkeeper is the scheduler and the machine is the CPU. If he serves strictly in order of arrival, one student with a 200-page thesis at the front makes ten students with 2 pages each wait a long time (FCFS and its convoy effect). If he first serves whoever has the fewest pages, the average waiting time is the least possible (SJF) — but the thesis student may wait for ever if short jobs keep arriving (starvation). If he copies 10 pages for each person in turn and sends unfinished jobs to the back of the line, everyone sees progress (Round Robin, time quantum = 10 pages). And if two students each hold one book and each refuses to let go until they get the other’s book, both wait for ever — deadlock.

In everyday lifeIn the exam topic
One xerox machine, many studentsOne CPU, many processes in the ready queue
Number of pages to copyCPU burst time
Time spent standing around, not being servedWaiting time = turnaround − burst
10 pages each, then back of the lineRound Robin with a time quantum
Two students each holding the book the other needsDeadlock: hold-and-wait + circular wait

The concept

An operating system manages the hardware and provides services to programs: process management, memory management, file management, device (I/O) management, security, and a user interface (shell or GUI). The kernel is its core, and programs ask it for services through system calls. Types: batch, multiprogramming, time-sharing (multitasking), real-time and distributed. A process is a program in execution, described by its PCB (Process Control Block). It moves through the states new → ready → running → waiting (blocked) → ready … → terminated; switching the CPU from one process to another is a context switch.

CPU scheduling picks the next ready process. FCFS: in arrival order, non-preemptive, suffers the convoy effect. SJF: shortest burst first; gives the minimum average waiting time; its preemptive form is SRTF; long jobs may starve. Priority: highest priority first; starvation is cured by aging. Round Robin: each process gets a fixed time quantum, then goes to the back of the queue; designed for time-sharing. For each process, turnaround time = completion − arrival and waiting time = turnaround − burst.

Paging divides a process into fixed-size pages and memory into equal-size frames; a page table maps pages to frames. It removes external fragmentation (some internal fragmentation remains in the last page). A logical address = page number + offset, and the number of pages = 2address bits ÷ page size. Virtual memory keeps only the needed pages in RAM; a missing page causes a page fault; constant faulting is thrashing; replacement policies are FIFO (can show Belady’s anomaly), LRU and Optimal. Deadlock needs all four conditions together — mutual exclusion, hold and wait, no preemption, circular wait; the Banker’s algorithm avoids it. File systems organise files in directories (single-level, two-level, tree) and allocate disk blocks contiguously, as a linked list, or through an index block (FAT, NTFS, ext4).

Key points & formulas

  • TAT = completion time − arrival time; WT = TAT − burst time
  • FCFS: non-preemptive, convoy effect; SJF: minimum average WT, may starve long jobs
  • SRTF = preemptive SJF; starvation in priority scheduling is fixed by aging
  • Round Robin: preemptive with a time quantum; a very large quantum makes it behave like FCFS
  • Process states: new, ready, running, waiting, terminated; the PCB stores each process’s details
  • Paging: page size = frame size; page-table entries = 2logical address bits ÷ page size
  • Deadlock conditions: mutual exclusion, hold and wait, no preemption, circular wait (all four needed)
  • FIFO page replacement can show Belady’s anomaly (more frames, yet more faults)

Worked example

Four processes arrive at time 0 with burst times P1 = 8, P2 = 4, P3 = 2, P4 = 6 (ms). Find the average waiting time under FCFS and under SJF.

Show solution
  1. FCFS order P1, P2, P3, P4. Gantt chart: P1 0–8, P2 8–12, P3 12–14, P4 14–20.
  2. All arrive at 0, so waiting time = start time: 0, 8, 12, 14 → average = 34 ÷ 4 = 8.5 ms.
  3. SJF order by burst: P3 (2), P2 (4), P4 (6), P1 (8). Gantt chart: P3 0–2, P2 2–6, P4 6–12, P1 12–20.
  4. SJF waiting times: P1 = 12, P2 = 2, P3 = 0, P4 = 6 → average = 20 ÷ 4 = 5 ms.

Answer: FCFS 8.5 ms; SJF 5 ms

Exam shortcut

When all processes arrive at time 0 and the policy is non-preemptive, each waiting time is simply that process’s start time in the Gantt chart: add the start times and divide. With different arrival times, subtract each arrival time from its start time.

Common traps

  • With different arrival times or preemption (Round Robin, SRTF), waiting time is not just the start time; use WT = completion − arrival − burst.
  • In non-preemptive SJF with arrival times, only processes that have already arrived can be chosen.
  • Deadlock needs all four conditions. “Preemption” is not one of them — “no preemption” is.

Practice · tap an option to check

Q1. Three processes arrive at time 0 in the order P1, P2, P3 with burst times 5, 3 and 1 ms. Using Round Robin with a time quantum of 2 ms, the average waiting time is:

Q2. Processes with (arrival, burst) times P1 (0, 7), P2 (2, 4), P3 (4, 1), P4 (5, 4) are scheduled with non-preemptive SJF. The average waiting time is:

Q3. Which of the following is NOT one of the four necessary conditions for deadlock?

Q4. A system uses 32-bit logical addresses and a page size of 4 KB. How many entries does a single-level page table have?

↑ Back to topic list

Computer · Computer Basics · Topic 16 of 16

Computer Awareness: Internet, Email, Web and Software

Think of it like…

Posting a wedding patrika from Pune to the village

Your cousin’s wedding is fixed and you are posting the patrika (invitation card) from Pune to relatives in the village. The roads, railways and trucks that connect every town are the internet: one physical network that carries letters, parcels, passengers and milk alike. The letters travelling on it are email; the shops and offices you can visit along those roads are the World Wide Web — just one of the many things the roads are used for. On the envelope you write Sunil Patil, Mhaswad: the person and the place, exactly the username@domain of an email address. The Pune post office that accepts your letter and sends it onward is the sending mail server (SMTP); the Mhaswad post office that holds it until Sunil collects it is the receiving server (POP/IMAP). The village postman who knows that “Sunil Patil” means house number 42 is DNS, turning a name into a number (IP address). You print extra copies for the whole family (CC), slip a photo into the envelope (attachment), and send an open postcard to a friend (HTTP) but a sealed registered envelope to the bank (HTTPS). The patrika is printed in standard Devanagari, so any relative in any village can read it — just as a page written in standard HTML opens in any browser.

In everyday lifeIn the exam topic
Roads and railways joining every town and villageThe internet: the physical network of networks
Shops and offices you can visit along the roadsThe World Wide Web: web pages, one service on the internet
Sunil Patil, Mhaswad on the envelopeEmail address username@domain; the post offices at both ends are mail servers (SMTP / POP, IMAP)
The postman who knows which house “Sunil Patil” isDNS: domain name → IP address
Open postcard vs sealed registered envelopeHTTP vs HTTPS (encrypted with SSL/TLS)

The concept

The internet is a worldwide network of networks that connects computers using the TCP/IP protocols; it grew out of ARPANET (1969). The World Wide Web (WWW) is only one service running on it — a collection of interlinked pages (hypertext) invented by Tim Berners-Lee at CERN in 1989; email, file transfer (FTP) and video calls are other services. A web page is found by its URL (Uniform Resource Locator), for example https://www.mahacet.org/exams/mca.html: the protocol (https), the domain name (www.mahacet.org, whose last part .org is the top-level domain, like .com, .in, .edu, .gov), and the path and file name (/exams/mca.html). HTTP (HyperText Transfer Protocol, port 80) carries pages between a web server and your browser (Chrome, Firefox, Edge, Safari); HTTPS adds SSL/TLS encryption (port 443) and shows the padlock. Pages are written in HTML (HyperText Markup Language): a markup language of tags such as <p> and <a href="…"> that describe structure and links, not a programming language. Because HTML is an open standard understood by every browser on every operating system, the same document can be displayed anywhere — its main advantage. Email (electronic mail) delivers messages to an address of the form username@domain, e.g. sunil.patil@gmail.com: the user name (mailbox) before the @ and the domain name of the mail provider after it. SMTP (Simple Mail Transfer Protocol) sends mail; POP3 (Post Office Protocol) downloads it to one device; IMAP (Internet Message Access Protocol) keeps it on the server so phone and laptop stay in sync. CC (carbon copy) recipients are visible to everyone; BCC (blind carbon copy) recipients are hidden; an attachment is a file sent along with the message; unwanted bulk mail is spam.

Software is of three kinds. System software runs the machine itself: the operating system (Windows, Linux, macOS, Android), device drivers and language translators (compiler, interpreter, assembler). Application software does the user’s work: word processor (MS Word), spreadsheet (Excel), presentation (PowerPoint), browser, WhatsApp, Tally. Utility software maintains the system: antivirus, disk clean-up, file compression (WinRAR, 7-Zip), backup tools. Software burnt into ROM (the BIOS) is firmware; open-source software (Linux, Firefox) ships its source code, proprietary software (Windows, MS Office) does not. A file’s extension tells its type: .docx Word, .xlsx Excel, .pptx PowerPoint, .pdf portable document, .txt plain text, .jpg/.png/.gif images, .mp3 audio, .mp4 video, .zip compressed archive, .exe Windows program, .apk Android app, .html web page, .c C source. Networks are named by size: PAN (personal, Bluetooth), LAN (Local Area Network — one building or campus, such as a college lab), MAN (a city) and WAN (Wide Area Network — across cities and countries; the internet is the largest WAN). Every device on a network has an IP address: IPv4 is 32 bits written as four numbers from 0 to 255 separated by dots (192.168.1.1); IPv6 is 128 bits. DNS (Domain Name System) translates names such as www.google.com into IP addresses — the phone book of the internet. A modem (modulator–demodulator) converts the computer’s digital signals to and from the analog signals of a telephone or cable line; a router forwards data packets between networks and shares one connection among many devices; a switch or hub joins devices inside a LAN; Wi-Fi (IEEE 802.11) is a wireless LAN; an ISP (Internet Service Provider — Jio, Airtel, BSNL) connects you to the internet. Bandwidth is the maximum rate at which a link carries data, measured in bits per second (kbps, Mbps, Gbps).

Security: malware is any harmful program. A virus attaches itself to a file and spreads when that file is run; a worm copies itself across a network on its own; a Trojan horse hides inside software that looks useful; spyware steals information and ransomware locks your files for money. Antivirus software (Quick Heal from Pune, Norton, McAfee, Kaspersky) detects and removes malware and must be updated regularly. A firewall (hardware or software) filters the traffic between a trusted network and the internet according to rules. Phishing is a fake email, SMS or website pretending to be a bank or a known company to “fish” for passwords, OTPs and card numbers; a bank never asks for these. A strong password is long (at least 8–12 characters), mixes upper- and lower-case letters, digits and symbols, is not a name or a date of birth, and is backed by two-factor authentication (OTP). Encryption scrambles data so that only the holder of the key can read it. Types of computer by size and power, smallest first: microcomputer (one microprocessor — desktop, laptop/notebook, tablet, smartphone), minicomputer (mid-range, many users in a department), mainframe (thousands of users at once — banks, railway reservation) and supercomputer (the fastest, speed measured in FLOPS — weather forecasting, research; India’s PARAM 8000 was built by C-DAC Pune in 1991). By the signals they use, computers are analog, digital or hybrid. Generations are named by their switching technology: 1st (about 1940–56) vacuum tubes, machine language, punched cards (ENIAC, UNIVAC); 2nd (1956–63) transistors, assembly language and early high-level languages (FORTRAN, COBOL); 3rd (1964–71) integrated circuits, keyboards, monitors and operating systems (IBM 360); 4th (1971 onward) microprocessors with VLSI (Intel 4004), personal computers, GUI and networks; 5th (present and beyond) ULSI, parallel processing and artificial intelligence.

Key points & formulas

  • Internet = network of networks (TCP/IP); WWW = web pages on it, invented by Tim Berners-Lee (1989); email and FTP are other internet services
  • URL = protocol://domain/path, e.g. https://www.mahacet.org/exams/mca.html; HTTP port 80, HTTPS = HTTP + SSL/TLS, port 443
  • HTML is a markup language of tags, not a programming language; any browser on any OS can display an HTML page
  • Email address = user name @ domain name; SMTP sends, POP3 downloads to one device, IMAP keeps mail on the server; CC visible, BCC hidden
  • Software: system (OS, drivers, translators) · application (Word, Excel, browser) · utility (antivirus, compression, backup); firmware sits in ROM
  • PAN < LAN < MAN < WAN; IPv4 = 32 bits (four numbers 0–255), IPv6 = 128 bits; DNS: name → IP; modem: digital ↔ analog; router: joins networks
  • Virus needs a host file, worm spreads by itself, Trojan hides in useful-looking software; firewall filters traffic; phishing = fake message fishing for passwords/OTP
  • Size order micro < mini < mainframe < super; generations: vacuum tube → transistor → IC → microprocessor (VLSI) → AI (ULSI)

Worked example

Break the URL https://www.mahacet.org/exams/mca.html and the email address sunil.patil@gmail.com into their parts, and name the protocol used at each step when Sunil’s laptop sends a mail that his phone later reads.

Show solution
  1. URL: https is the protocol (secure HTTP, port 443); www.mahacet.org is the domain name — www the host/sub-domain, mahacet the organisation, .org the top-level domain; /exams/mca.html is the path to the file mca.html, an HTML page.
  2. The browser asks DNS for the IP address of www.mahacet.org, connects to that server, fetches mca.html over HTTPS and renders the HTML tags into a page.
  3. Email: sunil.patil is the user name (mailbox) and gmail.com is the domain name of the mail provider; the @ (“at”) separates them.
  4. Sending: the laptop’s mail program hands the message to Gmail’s server with SMTP, and SMTP also carries it on to the recipient’s server. Reading: the phone fetches it with IMAP (mail stays on the server, so both devices show it) — or POP3, which would download it to one device only.

Answer: URL = protocol + domain (host · organisation · TLD) + path/file; email = user name @ domain name; send with SMTP, receive with IMAP or POP3.

Exam shortcut

Read a URL left to right — how (protocol) → where (domain; its top-level domain is the last piece) → what (path/file). Read an email address around the @: person on the left, post office (domain) on the right. For “which protocol” questions: S in SMTP = Send; POP and IMAP = Pick up; HTTP = pages; FTP = files.

Common traps

  • The internet and the World Wide Web are not the same: the internet is the network; the web is one service on it (email is another). “Who invented the internet?” is not answered by Tim Berners-Lee — he invented the web.
  • HTML is not a programming language and a browser does not “run” it; it marks up text with tags that any browser can display. Likewise HTTP is a protocol, not a language.
  • A notebook/laptop is a kind of microcomputer, not a separate class, so in an odd-one-out with micro-, mini- and supercomputer it is the odd one. And modem ≠ router: the modem talks to the ISP’s line, the router shares the connection — a home “Wi-Fi box” just combines both.

Practice · tap an option to check

Q1. An email address such as sunil.patil@rediffmail.com is made up of which two parts, separated by the @ sign?

Q2. Which of the following is an advantage of writing a web page in HTML?

Q3. Find the odd one out.

Q4. Which protocol is used to send an email from the sender’s mail program to the mail server?

↑ Back to topic list