Class 12 Computer Science - Python
Detailed Notes as per CBSE Syllabus 2025-26
Unit 1: Computational Thinking and Programming - 2
1. Revision of Python Basics (Class 11)
Tokens: Keywords, Identifiers, Literals, Operators, Punctuators
Data Types: int, float, string, list, tuple, dictionary
Mutable vs Immutable: Lists/dicts are mutable; strings/tuples are not
Expressions, Evaluation, Precedence of operators
Input/Output: input(), print() with sep and end parameters
Type conversion: int(), float(), str(), list(), tuple()
Errors: Syntax, Logical, Runtime
2. Functions
Need for functions, User-defined functions
def keyword, function definition, function call
Parameters: Formal vs Actual parameters
Types of arguments: Positional, Default, Keyword, Variable length *args
return statement, void functions vs fruitful functions
Scope of variables: Local and Global, global keyword
Passing mutable/immutable objects to functions
Python standard library: math, random, statistics modules
Example:
def factorial(n):
if n == 0: return 1
else: return n * factorial(n-1)
3. File Handling
Need for data files
Types of files: Text files, Binary files, CSV files
Text file operations: open(), close(), read(), readline(), readlines(), write(), writelines()
File modes: r, w, a, r+, w+, a+, t, b
with statement for automatic file closing
Binary files: pickle module - dump() and load()
CSV files: csv module - reader(), writer(), DictReader(), DictWriter()
Standard streams: stdin, stdout, stderr
Example:
import csv
with open("[Link]","r") as f:
reader = [Link](f)
for row in reader:
print(row)
4. Data Structures
Stack: LIFO structure
- Operations: push, pop, peek, isEmpty
- Implementation using list
Queue: FIFO structure
- Operations: enqueue, dequeue, isEmpty
- Implementation using list
Unit 2: Computer Networks
1. Evolution of Networking
ARPANET, Internet, Interspace
Switching techniques: Circuit switching, Packet switching
2. Data Communication Terminologies
Concept of channel, bandwidth, data transfer rate
Transmission media: Wired - Twisted pair, Co-axial, Optical fiber
Wireless: Radio waves, Microwaves, Infrared
3. Network Devices
Modem, RJ45, RJ11, Ethernet Card, NIC, Hub, Switch, Repeater, Router, Gateway, WIFI
card
4. Network Topologies and Types
Bus, Star, Tree topologies
Types: PAN, LAN, MAN, WAN
5. Network Protocol
TCP/IP, File Transfer Protocol FTP, PPP
Remote Login: TELNET
SMTP, POP3, HTTPS, VoIP, NFC
6. Web Services
WWW, HTML, XML, Domain names, URL
Website, Web browser, Web Server, Web Hosting, Web Scripting - Client side vs Server
side
Unit 3: Database Management
1. Database Concepts
Introduction to database concepts and its need
Relational data model: Relation, Attribute, Tuple, Domain, Degree, Cardinality, Keys
2. Structured Query Language SQL
DDL Commands: CREATE TABLE, DROP TABLE, ALTER TABLE
DML Commands: INSERT, DELETE, UPDATE, SELECT
SQL Functions: Single row functions - Numeric, String, Date functions
Aggregate functions: SUM(), AVG(), COUNT(), MAX(), MIN()
Clauses: DISTINCT, WHERE, ORDER BY, GROUP BY, HAVING
Joins: Cartesian product, Equi-join
Example:
SELECT STREAM, COUNT(*) FROM STUDENT
GROUP BY STREAM HAVING COUNT(*) > 5;
3. Interface of Python with MySQL
Connecting SQL with Python: [Link]
Creating database connectivity applications
Performing insert, update, delete, select operations
Example:
import [Link]
con = [Link](host="localhost", user="root", passwd="pass",
database="school")
cursor = [Link]()
[Link]("SELECT * FROM student")
for row in cursor:
print(row)
Key Points for Board Exam
Practice writing code on paper - CBSE expects handwritten syntax.
Remember file modes and differences between text/binary/CSV.
Revise SQL queries with GROUP BY and HAVING - frequently asked.
Stack and Queue programs using list are important for 3-4 marks.
Python-MySQL connectivity code with exception handling.
Draw network topologies and label devices for 2-mark questions.
Competency-based questions now include case studies on real data.