←
Computer Literacy and Digital Awareness · Chapter 2

Chapter 2: Hardware, Memory and Number Systems

What to remember

  • The CPU has three parts: ALU (calculations and logic), CU (control and timing) and registers (tiny, fastest storage). Memory gets faster, smaller and costlier as it comes closer to the CPU.
  • 1 byte = 8 bits; each storage unit is 1024 times the one before it (KB, MB, GB, TB). Computers store everything in binary (base 2).
  • To convert numbers: divide repeatedly for decimal to other bases; group bits (3 for octal, 4 for hex) for binary to octal or hex. Basic logic gates are AND, OR, NOT, with NAND and NOR as universal gates.

Basic hardware and the CPU

Hardware means the parts of a computer that you can touch: keyboard, mouse, monitor, CPU, printer. Software means the programs that run on it. Every computer follows the cycle of input, processing, storage and output.

The CPU (Central Processing Unit) is called the brain of the computer. It is a small chip called a microprocessor. It has three main parts.

  • ALU (Arithmetic Logic Unit): does addition, subtraction, multiplication, division and logical comparisons such as greater than or equal to.
  • CU (Control Unit): directs the flow of data and instructions. It fetches an instruction, decodes it and tells other parts what to do. It does not process data itself.
  • Registers: very small, very fast storage inside the CPU. They hold the data and instructions being used right now. Examples are the Program Counter (address of the next instruction), the Instruction Register, the Accumulator and the Memory Address Register.

The CPU works in a repeating cycle: fetch, decode, execute. Clock speed is measured in hertz (Hz), usually GHz today. A higher clock speed means more cycles per second. Modern CPUs have more than one core, such as dual-core or quad-core. Each core can run its own instructions. Cache memory sits on or near the CPU to hold often used data.

The motherboard is the main circuit board that joins the CPU, RAM, storage and other parts. The system bus carries signals. It has the data bus (carries data), the address bus (carries memory addresses) and the control bus (carries control signals). A port is a socket for connecting devices, such as USB and HDMI.

Input devices send data into the computer: keyboard, mouse, scanner, microphone, webcam, light pen, barcode reader, touch screen. Output devices give results: monitor, printer, speaker, plotter, projector. Some devices do both, such as a touch screen and a modem.

Memory and its hierarchy

Memory stores data and instructions. It is of two broad kinds: primary (main) memory and secondary memory.

Primary memory is directly connected to the CPU.

  • RAM (Random Access Memory): read and write memory. It is volatile, which means its content is lost when power goes off. It holds the programs and data in use. Two types are SRAM (static, faster, costlier, used for cache) and DRAM (dynamic, needs refreshing, cheaper, used as main memory).
  • ROM (Read Only Memory): non-volatile. It keeps its content without power. It stores the start-up (boot) instructions, called firmware or BIOS. Types are PROM (programmed once by the user), EPROM (erased by ultraviolet light and reprogrammed), EEPROM (erased by electric signal) and flash memory.

Secondary memory is permanent and large but slower. Examples are hard disk (HDD), solid state drive (SSD), CD, DVD, pen drive and memory card. HDD uses spinning magnetic platters. SSD has no moving parts, so it is faster and quieter.

Cache memory is a small, very fast memory between the CPU and RAM. It keeps copies of frequently used data. Virtual memory uses part of the hard disk as if it were extra RAM when RAM is full.

The memory hierarchy, from fastest and smallest to slowest and largest, is: registers, cache, RAM, secondary storage (SSD or HDD), and then offline storage such as optical discs. As we move down, speed and cost per byte fall, while capacity rises.

FeatureRAMROM
Full formRandom Access MemoryRead Only Memory
Volatile?YesNo
UseRunning programs and dataBoot instructions
Write accessRead and writeNormally read only
SpeedFastSlower than RAM

Storage units

The smallest unit is a bit (binary digit), which is 0 or 1. Four bits make a nibble. Eight bits make a byte, which stores one character. Larger units follow, each 1024 times the previous one.

UnitEquals
1 Byte8 bits
1 KB (Kilobyte)1024 bytes
1 MB (Megabyte)1024 KB
1 GB (Gigabyte)1024 MB
1 TB (Terabyte)1024 GB
1 PB (Petabyte)1024 TB

The order of growth is bit, nibble, byte, KB, MB, GB, TB, PB, EB, ZB, YB. A word is the number of bits the CPU handles at once, such as 32 or 64 bits. Character codes map characters to numbers. ASCII uses 7 bits (128 characters), and extended ASCII uses 8 bits (256 characters). Unicode supports characters of many languages, including Telugu, and can use 8, 16 or 32 bits.

Number systems and conversion

A number system is defined by its base (radix). The base equals the count of digits used.

SystemBaseDigits used
Binary20, 1
Octal80 to 7
Decimal100 to 9
Hexadecimal160 to 9 and A to F

In hexadecimal, A=10, B=11, C=12, D=13, E=14, F=15.

Decimal to binary: divide by 2 again and again and note the remainders. Read the remainders from bottom to top. Example: 13 gives remainders 1, 0, 1, 1 (from top), so 13 = 1101 in binary.

Binary to decimal: multiply each bit by a power of 2 (from the right, 1, 2, 4, 8 and so on) and add. Example: 1011 = 8 + 0 + 2 + 1 = 11.

Binary to octal: group bits in threes from the right. Example: 101 110 = 5 and 6, so 56 in octal.

Binary to hexadecimal: group bits in fours from the right. Example: 1111 0101 = F and 5, so F5 in hexadecimal.

Octal or hex to binary: write each digit as 3 bits (octal) or 4 bits (hex). Example: hex 2B = 0010 1011.

Octal or hex to decimal: multiply each digit by a power of the base and add. Example: octal 17 = 1 x 8 + 7 = 15; hex 1A = 16 + 10 = 26.

Binary addition rules: 0+0=0, 0+1=1, 1+1=10 (write 0, carry 1), 1+1+1=11. Negative numbers are stored using 1's complement (flip all bits) and 2's complement (flip all bits and add 1).

Logic gates basics

A logic gate is a tiny circuit that takes one or more binary inputs and gives one binary output. Gates are the building blocks of the CPU.

GateRuleOutput is 1 when
ANDOutput 1 only if all inputs are 1Both inputs are 1
OROutput 1 if any input is 1At least one input is 1
NOTReverses the inputInput is 0
NANDNOT of ANDNot both inputs are 1
NORNOT of ORBoth inputs are 0
XOROutput 1 if inputs differInputs are different
XNORNOT of XORInputs are same

NOT has only one input. NAND and NOR are called universal gates, because any other gate can be built from either one. Truth table of AND for inputs (0,0), (0,1), (1,0), (1,1) gives 0, 0, 0, 1. Truth table of OR gives 0, 1, 1, 1.

Exam traps

  • RAM is volatile; ROM is non-volatile. Do not swap them.
  • The ALU does calculation; the CU only controls and directs. The CU does not do arithmetic.
  • Cache is faster than RAM; RAM is faster than the hard disk. Registers are the fastest of all.
  • 1 KB is 1024 bytes, not 1000 bytes. A kilobyte is not a "thousand bits".
  • A bit is the smallest unit; a nibble (4 bits) is not a byte (8 bits).
  • Binary has base 2, octal base 8, hex base 16. Hex digit F equals 15, not 16.
  • NAND and NOR are universal gates; XOR is not.
  • SRAM is faster and costlier (used for cache); DRAM is slower and cheaper (used as main memory).
  • ASCII is 7 bits (128 characters); extended ASCII is 8 bits (256).

One-liners

  • 1. The CPU is the brain of the computer and is built on a microprocessor chip.
  • 2. ALU stands for Arithmetic Logic Unit.
  • 3. Registers are the fastest memory in the computer.
  • 4. RAM loses its data when power is switched off.
  • 5. BIOS and boot instructions are stored in ROM.
  • 6. EPROM is erased by ultraviolet light; EEPROM by electric signal.
  • 7. SSD has no moving parts; HDD has spinning platters.
  • 8. 1 byte = 8 bits; 1 GB = 1024 MB.
  • 9. Hexadecimal uses digits 0 to 9 and letters A to F.
  • 10. Decimal 10 is 1010 in binary.
  • 11. The NOT gate has a single input and inverts it.
  • 12. Clock speed is measured in hertz (GHz for modern CPUs).

Practice questions

  1. Which part of the CPU performs arithmetic and logical operations?

    1. Cache
    2. CU
    3. Register
    4. ALU
    Answer

    D. ALU

    The Arithmetic Logic Unit does calculations and comparisons.

  2. Which part of the CPU directs the flow of data and instructions?

    1. ALU
    2. Monitor
    3. Control Unit
    4. Hard disk
    Answer

    C. Control Unit

    The CU fetches, decodes and controls but does not calculate.

  3. Which is the fastest memory in a computer?

    1. Hard disk
    2. RAM
    3. DVD
    4. Registers
    Answer

    D. Registers

    Registers are inside the CPU and are the fastest.

  4. RAM is called volatile memory because

    1. its contents stay forever
    2. it can only be read
    3. it is used only for booting
    4. its contents are lost when power is off
    Answer

    D. its contents are lost when power is off

    Volatile means data disappears without power.

  5. Boot-up instructions of a computer are stored in

    1. RAM
    2. Registers
    3. ROM
    4. Cache
    Answer

    C. ROM

    ROM is non-volatile and holds the start-up firmware.

  6. How many bits make one byte?

    1. 4
    2. 8
    3. 16
    4. 10
    Answer

    B. 8

    1 byte = 8 bits.

  7. 1 Kilobyte (KB) is equal to

    1. 1000 bytes
    2. 512 bytes
    3. 1024 bytes
    4. 1024 bits
    Answer

    C. 1024 bytes

    Each storage unit is 1024 times the previous unit.

  8. 1 Gigabyte (GB) is equal to

    1. 100 MB
    2. 1024 TB
    3. 1000 KB
    4. 1024 MB
    Answer

    D. 1024 MB

    1 GB = 1024 MB.

  9. The smallest unit of data in a computer is

    1. nibble
    2. bit
    3. byte
    4. word
    Answer

    B. bit

    A bit is a single binary digit, 0 or 1.

  10. The base of the hexadecimal number system is

    1. 8
    2. 16
    3. 10
    4. 2
    Answer

    B. 16

    Hexadecimal uses 16 symbols, 0-9 and A-F.

  11. The decimal number 13 in binary is

    1. 1011
    2. 1110
    3. 1101
    4. 1001
    Answer

    C. 1101

    13 = 8 + 4 + 1, so 1101.

  12. Which gate gives output 1 only when all its inputs are 1?

    1. AND
    2. OR
    3. XOR
    4. NOR
    Answer

    A. AND

    AND needs every input to be 1.

  13. Which logic gate has only one input?

    1. AND
    2. NAND
    3. XOR
    4. NOT
    Answer

    D. NOT

    NOT inverts a single input.

  14. A hard disk is an example of

    1. secondary memory
    2. register
    3. cache memory
    4. primary memory
    Answer

    A. secondary memory

    HDD gives large permanent storage and is secondary memory.

  15. Which storage device has no moving parts?

    1. HDD
    2. Floppy disk
    3. SSD
    4. CD-ROM
    Answer

    C. SSD

    SSD uses flash chips; HDD has spinning platters.

  16. Which of the following is an input device?

    1. Printer
    2. Projector
    3. Scanner
    4. Speaker
    Answer

    C. Scanner

    A scanner sends data into the computer.

  17. Which of the following is an output device?

    1. Light pen
    2. Plotter
    3. Microphone
    4. Mouse
    Answer

    B. Plotter

    A plotter produces printed drawings as output.

  18. A small, very fast memory placed between the CPU and RAM is called

    1. virtual memory
    2. flash memory
    3. ROM
    4. cache memory
    Answer

    D. cache memory

    Cache holds frequently used data close to the CPU.

  19. Which memory type can be erased by ultraviolet light and reprogrammed?

    1. EPROM
    2. PROM
    3. EEPROM
    4. DRAM
    Answer

    A. EPROM

    EPROM uses UV light; EEPROM uses an electric signal.

  20. The binary number 1011 equals which decimal number?

    1. 9
    2. 11
    3. 13
    4. 10
    Answer

    B. 11

    8 + 0 + 2 + 1 = 11.

  21. The binary number 101110 in octal is

    1. 56
    2. 46
    3. 65
    4. 35
    Answer

    A. 56

    Group in threes: 101 = 5, 110 = 6.

  22. The binary number 11110101 in hexadecimal is

    1. D5
    2. 5F
    3. E5
    4. F5
    Answer

    D. F5

    1111 = F and 0101 = 5.

  23. The hexadecimal number 1A in decimal is

    1. 16
    2. 31
    3. 26
    4. 21
    Answer

    C. 26

    1 x 16 + 10 = 26.

  24. The octal number 17 in decimal is

    1. 8
    2. 15
    3. 14
    4. 17
    Answer

    B. 15

    1 x 8 + 7 = 15.

  25. Which pair of gates are called universal gates?

    1. NAND and NOR
    2. XOR and XNOR
    3. NOT and AND
    4. AND and OR
    Answer

    A. NAND and NOR

    Any gate can be built using only NAND or only NOR.

  26. The output of a NOR gate is 1 only when

    1. both inputs are 1
    2. both inputs are 0
    3. inputs differ
    4. any input is 1
    Answer

    B. both inputs are 0

    NOR is NOT of OR, so it is 1 only if all inputs are 0.

  27. The XOR gate gives output 1 when

    1. the two inputs are same
    2. both inputs are 1
    3. the two inputs are different
    4. both inputs are 0
    Answer

    C. the two inputs are different

    XOR means exclusive OR: inputs must differ.

  28. The bus that carries memory locations from the CPU is the

    1. control bus
    2. data bus
    3. power bus
    4. address bus
    Answer

    D. address bus

    The address bus carries memory addresses.

  29. Which register holds the address of the next instruction to be run?

    1. Memory Data Register
    2. Instruction Register
    3. Accumulator
    4. Program Counter
    Answer

    D. Program Counter

    The Program Counter points to the next instruction.

  30. Extended ASCII can represent how many characters?

    1. 512
    2. 65536
    3. 256
    4. 128
    Answer

    C. 256

    Extended ASCII uses 8 bits, so 2^8 = 256.

  31. Which memory is used as cache because it is faster though costlier?

    1. SRAM
    2. EEPROM
    3. PROM
    4. DRAM
    Answer

    A. SRAM

    SRAM is faster and costlier than DRAM.

  32. The correct order of memory from fastest to slowest is

    1. Register, Cache, RAM, Hard disk
    2. Cache, Register, RAM, Hard disk
    3. Register, RAM, Cache, Hard disk
    4. RAM, Cache, Register, Hard disk
    Answer

    A. Register, Cache, RAM, Hard disk

    Speed falls as we move away from the CPU.

  33. Part of the hard disk used as if it were extra RAM is called

    1. flash memory
    2. virtual memory
    3. buffer
    4. cache memory
    Answer

    B. virtual memory

    Virtual memory extends RAM using disk space.

  34. The complement method that flips all bits and then adds 1 is

    1. 9's complement
    2. 10's complement
    3. 2's complement
    4. 1's complement
    Answer

    C. 2's complement

    2's complement = invert bits, then add 1.

  35. In binary addition, 1 + 1 + 1 gives

    1. 10
    2. 111
    3. 11
    4. 3
    Answer

    C. 11

    Sum is 1 with a carry of 1, written 11.

  36. Which Unicode feature is most useful for storing Telugu text?

    1. Uses only 7 bits
    2. Supports only English letters
    3. Has only 128 characters
    4. Supports characters of many languages
    Answer

    D. Supports characters of many languages

    Unicode covers scripts of many languages including Telugu.

  37. Hexadecimal digit E stands for which decimal value?

    1. 14
    2. 16
    3. 15
    4. 13
    Answer

    A. 14

    A=10, B=11, C=12, D=13, E=14, F=15.

  38. The truth table output of an OR gate for inputs (0,0), (0,1), (1,0), (1,1) is

    1. 1, 1, 1, 0
    2. 0, 0, 0, 1
    3. 1, 0, 0, 0
    4. 0, 1, 1, 1
    Answer

    D. 0, 1, 1, 1

    OR is 1 if any input is 1.

  39. Statements: 1. RAM is volatile. 2. ROM is volatile. Which is/are correct?

    1. 1 only
    2. 2 only
    3. Both 1 and 2
    4. Neither 1 nor 2
    Answer

    A. 1 only

    RAM loses data without power; ROM keeps it.

  40. Statements: 1. The CU performs arithmetic operations. 2. The ALU performs logical comparisons. Which is/are correct?

    1. 1 only
    2. 2 only
    3. Both 1 and 2
    4. Neither 1 nor 2
    Answer

    B. 2 only

    Arithmetic and logic are done by the ALU; the CU only controls.

  41. Statements: 1. 1 byte = 8 bits. 2. 1 KB = 1024 bytes. Which is/are correct?

    1. 1 only
    2. 2 only
    3. Both 1 and 2
    4. Neither 1 nor 2
    Answer

    C. Both 1 and 2

    Both are standard storage unit definitions.

  42. Statements: 1. NAND is a universal gate. 2. XOR is a universal gate. Which is/are correct?

    1. 1 only
    2. 2 only
    3. Both 1 and 2
    4. Neither 1 nor 2
    Answer

    A. 1 only

    Only NAND and NOR are universal gates.

  43. Statements: 1. Octal uses digits 0 to 7. 2. Hexadecimal uses digits 0 to 9 only. Which is/are correct?

    1. 1 only
    2. 2 only
    3. Both 1 and 2
    4. Neither 1 nor 2
    Answer

    A. 1 only

    Hex also uses the letters A to F.

  44. Statements: 1. SSD has spinning platters. 2. HDD uses magnetic platters. Which is/are correct?

    1. 1 only
    2. 2 only
    3. Both 1 and 2
    4. Neither 1 nor 2
    Answer

    B. 2 only

    SSD has no moving parts; HDD uses magnetic spinning platters.

  45. Match the pair: which pair is correct?

    1. PROM - erased by ultraviolet light
    2. SRAM - needs constant refreshing
    3. DRAM - used as cache
    4. EEPROM - erased by electric signal
    Answer

    D. EEPROM - erased by electric signal

    EEPROM is electrically erasable; SRAM does not need refreshing, DRAM does.

Page 1 of 1
‹
›