Class 12 Informatics Practices — Tamil Nadu State Board
Total Marks: Theory 70 + Practical 30 = 100
Syllabus Overview
| Unit | Topic | Key Content |
|---|---|---|
| 1 | Python Revision | Functions, modules, file handling |
| 2 | Data Handling — Pandas I | Series, DataFrame, operations |
| 3 | Data Handling — Pandas II | Merging, groupby, pivot |
| 4 | Data Visualisation | Matplotlib — line, bar, histogram, pie |
| 5 | Database Concepts | DBMS, relational model, keys |
| 6 | SQL | DDL, DML, aggregate functions, joins |
| 7 | Computer Networks | Types, topology, protocols |
| 8 | Cybersecurity | Threats, safety practices |
Unit 1 — Python Revision
Key Concepts
Functions:
def greet(name):
return "Hello, " + name
result = greet("Tamil")
print(result)
File Handling:
# Writing to file
f = open("data.txt", "w")
f.write("Hello")
f.close()
# Reading from file
f = open("data.txt", "r")
print(f.read())
f.close()
Modules:
import math— mathematical functionsimport random— random numbersimport datetime— date/time
List Comprehension:
squares = [x**2 for x in range(1, 6)]
# Output: [1, 4, 9, 16, 25]
Unit 2 — Data Handling with Pandas I
Series
A one-dimensional labelled array.
import pandas as pd
s = pd.Series([10, 20, 30, 40], index=['a', 'b', 'c', 'd'])
print(s)
print(s['b']) # Access by label: 20
print(s[1]) # Access by position: 20
DataFrame
A two-dimensional labelled data structure.
data = {
'Name': ['Anitha', 'Bala', 'Chitra'],
'Marks': [85, 92, 78],
'City': ['Chennai', 'Madurai', 'Coimbatore']
}
df = pd.DataFrame(data)
print(df)
print(df['Name']) # Column access
print(df.iloc[1]) # Row by position
print(df.loc[0, 'Marks']) # Specific cell
DataFrame Operations
df.head() # First 5 rows
df.tail() # Last 5 rows
df.shape # (rows, columns)
df.info() # Column types
df.describe() # Statistics
df.isnull().sum() # Count missing values
df.dropna() # Remove missing rows
df.fillna(0) # Fill missing with 0
Filtering
# Rows where Marks > 80
filtered = df[df['Marks'] > 80]
# Multiple conditions
filtered = df[(df['Marks'] > 80) & (df['City'] == 'Chennai')]
Unit 3 — Data Handling with Pandas II
Groupby
# Average marks by city
grouped = df.groupby('City')['Marks'].mean()
print(grouped)
# Multiple aggregations
result = df.groupby('City')['Marks'].agg(['mean', 'max', 'min'])
Merging DataFrames
df1 = pd.DataFrame({'ID': [1, 2, 3], 'Name': ['A', 'B', 'C']})
df2 = pd.DataFrame({'ID': [1, 2, 4], 'Score': [90, 85, 70]})
# Inner join (common rows)
merged = pd.merge(df1, df2, on='ID', how='inner')
# Left join (all from left)
merged = pd.merge(df1, df2, on='ID', how='left')
Sorting
df.sort_values('Marks', ascending=False) # Descending
df.sort_values(['City', 'Marks']) # Multiple columns
Unit 4 — Data Visualisation with Matplotlib
import matplotlib.pyplot as plt
Line Chart
x = [1, 2, 3, 4, 5]
y = [10, 25, 15, 30, 20]
plt.plot(x, y, color='blue', marker='o', linestyle='--')
plt.title("Sales Trend")
plt.xlabel("Month")
plt.ylabel("Sales")
plt.show()
Bar Chart
subjects = ['Tamil', 'English', 'Maths', 'Science']
marks = [85, 78, 92, 88]
plt.bar(subjects, marks, color='green')
plt.title("Student Marks")
plt.show()
Histogram
data = [55, 60, 65, 70, 75, 80, 85, 90]
plt.hist(data, bins=5, color='orange', edgecolor='black')
plt.title("Marks Distribution")
plt.show()
Pie Chart
sizes = [30, 20, 25, 25]
labels = ['Tamil', 'English', 'Maths', 'Science']
plt.pie(sizes, labels=labels, autopct='%1.1f%%')
plt.title("Subject Marks Share")
plt.show()
Unit 5 — Database Concepts
Key Terms
| Term | Definition |
|---|---|
| DBMS | Database Management System — software to store, retrieve, manage data |
| Relation | Table in a relational database |
| Tuple | Row in a table |
| Attribute | Column in a table |
| Domain | Set of valid values for an attribute |
| Primary Key | Unique identifier for each row — not null, unique |
| Foreign Key | Links to primary key of another table |
| Candidate Key | All minimal superkeys |
| Composite Key | Primary key made of two or more attributes |
Relational Model Concepts
- Entity: Real-world object (Student, Book)
- Entity-Relationship (ER) Diagram: Visual representation of entities and relationships
- Normalisation: Reducing redundancy — 1NF, 2NF, 3NF
- ACID properties: Atomicity, Consistency, Isolation, Durability
Unit 6 — SQL
DDL Commands (Data Definition Language)
-- Create table
CREATE TABLE Student (
Roll_No INT PRIMARY KEY,
Name VARCHAR(50),
Marks INT,
City VARCHAR(30)
);
-- Add column
ALTER TABLE Student ADD Grade CHAR(2);
-- Remove column
ALTER TABLE Student DROP COLUMN Grade;
-- Delete table structure
DROP TABLE Student;
-- Remove all records (keep structure)
TRUNCATE TABLE Student;
DML Commands (Data Manipulation Language)
-- Insert data
INSERT INTO Student VALUES (101, 'Anitha', 85, 'Chennai');
-- Update data
UPDATE Student SET Marks = 90 WHERE Roll_No = 101;
-- Delete rows
DELETE FROM Student WHERE Marks < 40;
-- Select all
SELECT * FROM Student;
-- Select specific columns
SELECT Name, Marks FROM Student;
-- Condition
SELECT * FROM Student WHERE City = 'Chennai';
-- Sorting
SELECT * FROM Student ORDER BY Marks DESC;
-- Pattern matching
SELECT * FROM Student WHERE Name LIKE 'A%';
Aggregate Functions
SELECT COUNT(*) FROM Student; -- Number of rows
SELECT SUM(Marks) FROM Student; -- Total marks
SELECT AVG(Marks) FROM Student; -- Average
SELECT MAX(Marks) FROM Student; -- Highest mark
SELECT MIN(Marks) FROM Student; -- Lowest mark
-- Group by city
SELECT City, AVG(Marks) FROM Student GROUP BY City;
-- Having (filter after GROUP BY)
SELECT City, AVG(Marks) FROM Student
GROUP BY City HAVING AVG(Marks) > 75;
Joins
-- INNER JOIN (matching rows only)
SELECT S.Name, C.Course_Name
FROM Student S
INNER JOIN Course C ON S.Roll_No = C.Roll_No;
-- LEFT JOIN (all from left, matching from right)
SELECT S.Name, C.Course_Name
FROM Student S
LEFT JOIN Course C ON S.Roll_No = C.Roll_No;
Unit 7 — Computer Networks
Types of Networks
| Type | Full Form | Range |
|---|---|---|
| LAN | Local Area Network | Building/campus |
| MAN | Metropolitan Area Network | City |
| WAN | Wide Area Network | Country/global |
| PAN | Personal Area Network | ~10 metres |
Network Topologies
- Bus: All connected to one cable. Simple, single point of failure.
- Star: All connected to central hub/switch. Most common. Hub failure = network down.
- Ring: Each device connected to two others in loop. Token passing.
- Mesh: Every device connected to every other. Highly reliable, costly.
Protocols
| Protocol | Purpose |
|---|---|
| HTTP/HTTPS | Web browsing |
| FTP | File transfer |
| SMTP | Sending email |
| POP3/IMAP | Receiving email |
| DNS | Domain name to IP resolution |
| DHCP | Automatic IP assignment |
| TCP/IP | Core internet protocol |
Network Devices
- Hub: Broadcasts to all — obsolete
- Switch: Sends to specific device — efficient
- Router: Connects different networks, routes packets
- Modem: Converts digital ↔ analogue
Unit 8 — Cybersecurity
Common Threats
| Threat | Description |
|---|---|
| Malware | Software designed to damage (virus, worm, trojan, spyware) |
| Phishing | Fake emails/sites to steal credentials |
| Ransomware | Encrypts files, demands payment |
| DoS/DDoS | Overwhelming a server with traffic |
| SQL Injection | Inserting malicious SQL in input fields |
| Man-in-the-Middle | Intercepting communication |
| Keylogger | Records keystrokes to steal passwords |
Safety Practices
- Use strong passwords (8+ chars, upper/lower/numbers/symbols)
- Enable two-factor authentication (2FA)
- Keep software updated (patches fix vulnerabilities)
- Use antivirus and firewall
- Avoid clicking unknown links (phishing)
- Use HTTPS websites only for sensitive data
- Regular data backup
- Use VPN on public networks
Cybersecurity Laws in India
- IT Act 2000: First cyber law — data protection, hacking penalty
- IT Amendment Act 2008: Cyberterrorism, identity theft provisions
- CERT-In: Indian Computer Emergency Response Team
Exam Tips
- SQL questions: Always write column names correctly; semicolon at end; use caps for SQL keywords
- Pandas questions: Show imports (
import pandas as pd); print output where asked - Matplotlib: Always include
plt.show()at end - Theory questions: Use table format for comparisons (types of networks, SQL commands)
- Practical exam: Practice at least 10 complete programs before exam day
Frequently Asked Questions
Python programming review, Data handling with Pandas, Data Visualisation with Matplotlib, Database concepts and SQL, Networking basics, and Cybersecurity are the main topics.
