You're offline — cached pages and worlds still work
Drishti Innovations logo
Drishti Innovations
Syllabus /School /Class 9 /cs /Computer Systems

Computer Systems

Computer Systems — notes and practice.

What you'll learn

  • The four number systems (binary, octal, decimal, hexadecimal) and how to convert between them
  • Boolean logic gates with truth tables (AND, OR, NOT, NAND, NOR)
  • The memory hierarchy from registers to optical storage
  • Python fundamentals — variables, data types, input/output, conditionals, and loops

Key concepts

1. Number Systems

Computers use different number systems. The base of a number system tells you how many digits it uses.

SystemBaseDigits usedPrefix (in code)
Binary20, 10b (e.g. 0b1010)
Octal80–70o (e.g. 0o12)
Decimal100–9None
Hexadecimal160–9, A–F0x (e.g. 0xA)

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

Decimal to Binary (Divide by 2 method)

Divide the number by 2 repeatedly, record remainders, read them bottom-up.

Example: Convert 25 to binary

DivisionQuotientRemainder
25 ÷ 2121
12 ÷ 260
6 ÷ 230
3 ÷ 211
1 ÷ 201

Read remainders bottom to top: 25 in decimal = 11001 in binary

Binary to Decimal (Positional value method)

Multiply each bit by its positional value (powers of 2), then add.

Example: Convert 11001 to decimal

1×2⁴ + 1×2³ + 0×2² + 0×2¹ + 1×2⁰
= 16 + 8 + 0 + 0 + 1
= 25

Decimal to Hexadecimal (Divide by 16 method)

Example: Convert 255 to hexadecimal

DivisionQuotientRemainder
255 ÷ 161515 → F
15 ÷ 16015 → F

Read bottom to top: 255 in decimal = FF in hexadecimal

Quick conversion reference:

DecimalBinaryOctalHexadecimal
0000000
5010155
10101012A
15111117F
16100002010
25511111111377FF

2. Boolean Logic

Boolean logic deals with values that are either True (1) or False (0). It is the foundation of all digital circuits and computer decision-making.

AND Gate

Output is 1 only if both inputs are 1.

ABA AND B
000
010
100
111

OR Gate

Output is 1 if at least one input is 1.

ABA OR B
000
011
101
111

NOT Gate

Output is the opposite of the input. (Also called an inverter.)

ANOT A
01
10

NAND Gate (NOT + AND)

Output is 0 only if both inputs are 1. (Opposite of AND.)

ABA NAND B
001
011
101
110

NOR Gate (NOT + OR)

Output is 1 only if both inputs are 0. (Opposite of OR.)

ABA NOR B
001
010
100
110

NAND and NOR are called universal gates because you can build any other gate (AND, OR, NOT) using only NAND or only NOR gates.


3. Memory Hierarchy

Computer memory is organised in a hierarchy — faster memory is more expensive and smaller; slower memory is cheaper and larger. Data moves up the hierarchy when needed and down when stored.

Fastest / Most Expensive / Smallest
         ↑
    [Registers]
    [Cache (L1/L2/L3)]
    [RAM (Main Memory)]
    [SSD / HDD (Secondary Storage)]
    [Optical Disc / USB (Removable)]
         ↓
Slowest / Least Expensive / Largest
LevelTypeSpeedSizeVolatilityExample
1RegistersExtremely fastVery small (bytes)VolatileCPU registers (EAX, EBX)
2CacheVery fastSmall (KB–MB)VolatileL1, L2, L3 cache on CPU
3RAMFastMedium (4–64 GB)VolatileDDR4, DDR5 RAM
4SSD / HDDModerate / SlowLarge (256 GB–8 TB)Non-volatileNVMe SSD, SATA HDD
5Optical / USBSlowestVariableNon-volatileDVD, Blu-ray, USB flash drive

Volatile vs Non-volatile:

  • Volatile: Data is lost when power is switched off (Registers, Cache, RAM)
  • Non-volatile: Data is retained even without power (SSD, HDD, optical, USB)

4. Python Basics

Python is a beginner-friendly, high-level programming language widely used in data science, AI, and web development.

Variables and Data Types

A variable stores a value under a name.

name = "Arjun"          # str (string — text)
age = 15                # int (integer — whole number)
marks = 92.5            # float (decimal number)
is_passed = True        # bool (True or False)
Data typePython keywordExampleNotes
Stringstr"Hello"Text in quotes
Integerint42Whole number
Floatfloat3.14Decimal number
BooleanboolTrue / FalseMust be capitalised

Input and Output

# Output
print("Hello, World!")
print("My name is", name)

# Input
name = input("Enter your name: ")
age = int(input("Enter your age: "))   # input() always returns a string; int() converts it
print("Hello,", name, "! You are", age, "years old.")

if-else (Conditional statements)

marks = int(input("Enter your marks: "))

if marks >= 90:
    print("Grade: A+")
elif marks >= 75:
    print("Grade: A")
elif marks >= 60:
    print("Grade: B")
elif marks >= 40:
    print("Grade: C")
else:
    print("Grade: F — Please study harder!")

if-else structure:

if <condition>:
    <code to run if condition is True>
elif <another condition>:
    <code to run if this condition is True>
else:
    <code to run if none of the above are True>

Python uses indentation (4 spaces or 1 tab) instead of curly braces {} to define code blocks. Indentation errors are very common — be careful!

for loop

Used to repeat a block of code a fixed number of times, or to iterate over a sequence.

# Print numbers 1 to 5
for i in range(1, 6):
    print(i)

# Output: 1  2  3  4  5
# Sum of first 10 natural numbers
total = 0
for i in range(1, 11):
    total = total + i
print("Sum:", total)

# Output: Sum: 55
# Loop through a list
fruits = ["apple", "banana", "mango"]
for fruit in fruits:
    print(fruit)

# Output:
# apple
# banana
# mango

range() function:

CallProduces
range(5)0, 1, 2, 3, 4
range(1, 6)1, 2, 3, 4, 5
range(0, 10, 2)0, 2, 4, 6, 8

Complete mini program — Multiplication table:

n = int(input("Enter a number: "))
print("Multiplication table of", n)
for i in range(1, 11):
    print(n, "x", i, "=", n * i)

Output if user enters 5:

Multiplication table of 5
5 x 1 = 5
5 x 2 = 10
...
5 x 10 = 50

Quick check

  1. Convert the decimal number 45 to binary using the divide-by-2 method. Show your working.

  2. Complete the truth table for the NAND gate with inputs A=1, B=1. What is the output, and why?

  3. Which level of the memory hierarchy is the fastest? Which is the largest in capacity?

  4. What will the following Python code print?

    for i in range(2, 10, 3):
        print(i)
    
  5. Write a Python program that asks the user for a number and prints whether it is positive, negative, or zero.


Open the Practice tab for graded questions on Computer Systems.

0 topics • Notes • Practice • AI explanations available

For generative engines & students

Every topic page delivers structured HTML (headings, lists, tables, takeaways) in the first response. Perfect for citations in AI overviews and fast scanning by students and parents.