Docsity

A Computer Science Teaching Guide, Study Guides, Projects, Research of Computer science

Partial preview of the text

Download A Computer Science Teaching Guide and more Study Guides, Projects, Research Computer science in PDF only on Docsity!

Computer Science

Teaching Guide for Class 10

Phase 1: Computer Fundamentals | Phase 2: Python Programming

Includes theory ยท exercises ยท practical work ยท projects

Table of Contents PHASE 1 โ€” Computer Fundamentals (Weeks 1โ€“4)

Topic 1.1 โ€” Hardware Basics

Topic 1.2 โ€” Number Systems & Binary

Topic 1.3 โ€” Operating Systems

Topic 1.4 โ€” Internet & Networks

Topic 1.5 โ€” Cybersecurity Basics

PHASE 2 โ€” Python Programming (Weeks 5โ€“14)

Topic 2.1 โ€” Getting Started with Python

Topic 2.2 โ€” Variables & Data Types

Topic 2.3 โ€” Operators & Expressions

Topic 2.4 โ€” Control Flow โ€” if / elif / else

Topic 2.5 โ€” Loops โ€” for & while

Topic 2.6 โ€” Functions

Topic 2.7 โ€” Lists & Dictionaries

Topic 2.8 โ€” String Handling

Topic 2.9 โ€” File Handling

Topic 2.10 โ€” Mini-Project: Quiz Game

Microphone, Scanner Speakers, Projector

Webcam, Touchscreen Haptic feedback motors

/ Exercises 1.

  • List 5 input and 5 output devices in your home.
  • Why does RAM need to be larger than what a single program needs?
  • Compare SSD vs HDD: when would you choose each?
  • A computer has 8 GB RAM and 512 GB SSD. Which is faster to access? Why?
  • What happens to unsaved work in RAM when there is a power cut?

n Practical 1.1 โ€” Explore your machine

  • Open Task Manager (Windows) or System Monitor (Linux). Note CPU %, RAM used.
  • Run 'msinfo32' on Windows โ€” find your CPU model, RAM size, and OS version.
  • Open a terminal and type: systeminfo (Windows) or lscpu && free -h (Linux).
  • Draw a labelled diagram of a desktop PC, connecting all components.

1.2 Number Systems & Binary Why Computers Use Binary

Every piece of data inside a computer โ€” text, images, video, code โ€” is ultimately stored and processed as

sequences of 0s and 1s called bits. This is because electronic circuits have two reliable states: ON (voltage

present = 1) and OFF (no voltage = 0). Binary is Base-2: each position is a power of 2.

Decimal vs Binary vs Hexadecimal

Decimal (Base 10) Binary (Base 2) Hexadecimal (Base 16)

10 1010 A

15 1111 F

255 1111 1111 FF

How to Convert: Decimal โ†’ Binary

Repeatedly divide the number by 2 and record the remainders. Read remainders from bottom to top.

Example: convert 13 to binary:

13 รท 2 = 6 remainder 1 6 รท 2 = 3 remainder 0 3 รท 2 = 1 remainder 1 1 รท 2 = 0 remainder 1 Read remainders bottom to top: 1101 So 13 (decimal) = 1101 (binary) Bits, Bytes & Units

Unit Value Real-world example

1 bit 0 or 1 A single true/false switch

1 byte 8 bits One ASCII character (e.g. 'A')

1 Kilobyte (KB) 1,024 bytes A short text email

1 Megabyte (MB) 1,024 KB A 2-minute MP3 song

1 Gigabyte (GB) 1,024 MB ~300 MP3 songs

1 Terabyte (TB) 1,024 GB A large laptop hard drive

1.3 Operating Systems What is an Operating System?

An Operating System (OS) is the master software that manages all hardware and software resources.

Without an OS, you would have to write code that directly controls the CPU and RAM for every program โ€”

the OS abstracts all that complexity so programs can focus on their purpose.

Core Functions of an OS

  • Process management โ€” decides which program runs on the CPU at each moment (scheduling).
  • Memory management โ€” allocates RAM to programs and ensures they don't interfere with each other.
  • File system management โ€” organises storage into files and folders with permissions.
  • Device management โ€” provides drivers so software can talk to hardware (printer, USB, screen).
  • Security & access control โ€” manages user accounts, logins, and file permissions.
  • User interface โ€” provides either a CLI (Command Line Interface) or GUI (Graphical User Interface). Popular Operating Systems

OS Used On Key Trait

Windows 11 PCs, laptops Most widely used desktop OS

macOS Apple Mac computers Unix-based, polished UX

Linux (Ubuntu) Servers, dev machines Free, open source, powerful

Android Smartphones, tablets Linux-based, most mobile OS

iOS iPhone, iPad Closed ecosystem, very secure

The File System

A file system organises data on storage into a hierarchy of folders (directories). Every file has a path โ€” a

unique address. In Windows: C:\Users\Student\Documents\notes.txt. In Linux/macOS:

/home/student/documents/notes.txt. Key concepts: root directory, absolute path vs relative path, file

extensions, and permissions.

Essential Terminal Commands

Navigation

cd Documents # change directory cd .. # go up one level pwd # print current directory (Linux/Mac)

Files & Folders

ls -l # list files with details (Linux) dir # list files (Windows) mkdir myfolder # create a new folder rm file.txt # delete file (Linux/Mac) copy src.txt dst.txt # copy a file (Windows)

System

ps aux # list running processes (Linux) top # live CPU/RAM usage (Linux) tasklist # running processes (Windows)

/ Exercises 1.

  • What is the difference between RAM and storage from the OS's perspective?
  • What happens when you open a program โ€” step by step inside the OS?
  • Explain: absolute path vs relative path with an example.
  • Why is Linux preferred for web servers over Windows?
  • What is a file extension? Give 5 examples and what each opens with.
  • What does 'multitasking' mean? How does an OS achieve it on a single-core CPU?

n Practical 1.3 โ€” Terminal exploration

  • Open a terminal. Navigate to your Desktop using cd.
  • Create a folder 'CS_Work', inside it create 'Phase1' and 'Phase2'.
  • Use ls -lh (Linux) or dir (Windows) to list files with sizes.
  • Open Task Manager. Kill a process (e.g. an extra browser window). Observe.
  • Find out your OS version, CPU name, and total RAM from the terminal.

1.5 Cybersecurity Basics Why Cybersecurity Matters

Every device connected to the internet is a potential target. Cybersecurity is the practice of protecting

computers, networks, and data from attack, theft, or damage. Understanding threats is the first step to

staying safe.

Common Threats

Phishing : Fake emails or websites that trick you into entering passwords or personal data.

Malware : Malicious software: viruses (self-replicating), ransomware (locks your files for money), spyware

(steals data).

Brute Force Attack : Automated guessing of passwords by trying millions of combinations per second.

Social Engineering : Manipulating people โ€” not machines โ€” into revealing sensitive information.

Man-in-the-Middle : An attacker secretly intercepts communication between two parties.

SQL Injection : Inserting malicious code into a website's database query input.

Staying Safe โ€” Best Practices

  • Use strong, unique passwords for every account (12+ characters, mix of letters, numbers, symbols).
  • Enable Two-Factor Authentication (2FA) on all important accounts.
  • Never click links in unexpected emails โ€” go directly to the website.
  • Keep your OS and software updated โ€” updates patch security vulnerabilities.
  • Use a VPN on public WiFi to encrypt your traffic.
  • Back up important data regularly โ€” the 3-2-1 rule: 3 copies, 2 media, 1 offsite. Encryption Basics

Encryption scrambles data so only authorised parties can read it. HTTPS uses TLS encryption: your browser

and the server agree on a secret key and all traffic is scrambled. Even if intercepted, it looks like random

noise to an attacker.

/ Exercises 1.

  • What makes a password strong? Create 3 strong passwords and explain why.
  • You receive an email from '[email protected]'. What are the red flags?
  • What is 2FA and how does it protect against a stolen password?
  • Explain ransomware. How would you protect yourself from it?
  • Why is public WiFi dangerous? What can an attacker see?
  • What is the 3-2-1 backup rule? Why is 1 offsite copy important?

n Practical 1.5 โ€” Security check

  • Go to haveibeenpwned.com โ€” check if your email was in a data breach.
  • Analyse a suspicious email (teacher provides example). Identify all red flags.
  • Install Bitwarden (free password manager) and set it up.
  • Enable 2FA on your Google account using the Authenticator app.
  • Check: does your school/home WiFi use WPA2 or WPA3 encryption?

/ Exercises 2.

  • Write a program that prints your name, age, and favourite subject.
  • Print the result of: 2 to the power 10 (use 2**10 in Python).
  • Print 5 lines forming a simple pattern (e.g. a triangle of asterisks).
  • What is the difference between print(5) and print('5') in Python?
  • Deliberately write a syntax error. What does Python's error message say?

n Practical 2.1 โ€” First programs

  • Create hello.py. Run it. Fix any errors until it runs perfectly.
  • Write a program that prints a simple receipt (item name, price, total).
  • Explore: what does print(1/3) show? What about print(round(1/3, 2))?

2.2 Variables & Data Types What is a Variable?

A variable is a named container that stores a value. Think of it as a labelled box. In Python, you create a

variable simply by assigning a value โ€” no need to declare a type first.

name = 'Arjun' # stores a string age = 15 # stores an integer height = 5.7 # stores a float (decimal) is_student = True # stores a boolean print(name, 'is', age, 'years old') Python's Core Data Types

Type Example Description

int 42, -7, 0 Whole numbers, positive or negative

float 3.14, -0.5, 2.0 Decimal numbers

str 'hello', "world" Text โ€” always in quotes

bool True, False Logical values โ€” capital T and F

NoneType None Represents 'nothing' or 'no value'

Type Conversion

Converting between types

age_str = input("Enter your age: ") # input() always returns str age_int = int(age_str) # convert string to integer age_float = float(age_str) # convert to float print(type(age_str)) # print(type(age_int)) #

Useful type checks

print(type(3.14)) # print(str(100)) # "100" Taking User Input name = input("What is your name? ") age = int(input("How old are you? ")) print("Hello,", name, "! Next year you will be", age + 1) Variable Naming Rules

  • Must start with a letter or underscore (_), not a number.
  • Can contain letters, numbers, and underscores only (no spaces, no hyphens).
  • Case-sensitive: 'name', 'Name', and 'NAME' are three different variables.

2.3 Operators & Expressions Arithmetic Operators a, b = 17, 5 print(a + b) # 22 โ€” addition print(a - b) # 12 โ€” subtraction print(a * b) # 85 โ€” multiplication print(a / b) # 3.4 โ€” true division (always float) print(a // b) # 3 โ€” floor division (integer result) print(a % b) # 2 โ€” modulo (remainder) print(a ** b) # 1419857 โ€” exponentiation (17 to the power 5) Comparison Operators

These return True or False and are used in conditions.

print(10 == 10) # True โ€” equal print(10 != 5) # True โ€” not equal print(10 > 5) # True โ€” greater than print(10 < 5) # False โ€” less than print(10 >= 10) # True โ€” greater than or equal print(10 <= 9) # False โ€” less than or equal Logical Operators age = 16 has_id = True print(age >= 18 and has_id) # False โ€” both must be True print(age >= 18 or has_id) # True โ€” at least one is True print(not has_id) # False โ€” reverses the boolean

/ Exercises 2.

  • What does 17 % 3 equal? When is the % operator useful in real programming?
  • Write expressions using comparison operators for: checking if a number is even, checking if age >= 18.
  • A cinema allows entry if age >= 12 OR accompanied by a parent. Write the logic.
  • Calculate: area of a circle with radius 7 (use 3.14159). Print to 2 decimal places.
  • What is the result of: True and False, True or False, not True and not False?

2.4 Control Flow โ€” if / elif / else Making Decisions in Code

Programs rarely run the same way every time โ€” they need to make decisions based on data. The if

statement lets Python choose which code to run.

marks = int(input('Enter marks: ')) if marks >= 90: print('Grade: A+') elif marks >= 75: print('Grade: A') elif marks >= 60: print('Grade: B') elif marks >= 45: print('Grade: C') else: print('Grade: Fail') Indentation is Everything

Python uses indentation (4 spaces) to define code blocks โ€” NOT curly braces like many other languages.

Wrong indentation = wrong logic or a SyntaxError. Always use consistent 4-space indentation.

# CORRECT

if True: print('Inside if block') # 4 spaces print('Outside if block') # no indent

WRONG โ€” IndentationError

if True: print('This will crash') Nested if Statements age = int(input('Age: ')) citizen = input('Citizen? (yes/no): ') if age >= 18: if citizen == 'yes': print('You can vote') else: print('Age ok, but not a citizen') else: print('Too young to vote')

2.5 Loops โ€” for & while The for Loop

Use for when you know exactly how many times to repeat.

Loop 5 times

for i in range(5): print('Step', i)

range(start, stop, step)

for i in range(1, 11): print(i, 'x 5 =', i * 5) # Multiplication table

Loop through a list

fruits = ['apple', 'banana', 'mango'] for fruit in fruits: print('I like', fruit) The while Loop

Use while when you don't know in advance how many times to repeat.

Count down from 10

n = 10 while n > 0: print(n) n -= 1 # n = n - 1 print('Blast off!')

Repeat until valid input

password = '' while password != 'secret123': password = input('Enter password: ') print('Access granted!') break and continue

break โ€” exit loop immediately

for i in range(10): if i == 5: break # stops at 5 print(i)

continue โ€” skip current iteration

for i in range(10): if i % 2 == 0: continue # skip even numbers print(i) # prints only odd numbers Nested Loops

Multiplication table grid

for i in range(1, 4): for j in range(1, 4): print(i * j, end=' ') print() # new line after each row

/ Exercises 2.

  • Print all even numbers from 2 to 50 using a for loop.
  • Calculate the sum of numbers 1 to 100 using a while loop.
  • Print a right-angle triangle pattern of stars (5 rows).
  • Find all numbers between 1 and 200 divisible by both 3 and 7.
  • Use a loop to find the factorial of a number entered by the user.
  • Write a number guessing game: computer picks 1-100, user guesses, print 'Higher/Lower/Correct'.

n Practical 2.5 โ€” Table & pattern generator

  • Print the full multiplication table (1x1 to 12x12) in a grid format.
  • Print patterns: pyramid, diamond, and hollow square of stars.
  • Build the number guessing game from Exercise 6 โ€” count attempts taken.