Class 12 Computer ScienceChapter Notes
4 chapters · Definitions, key points, formulas & exam tips · Updated 2025-26
Python — Exception Handling and File Handling
Key Definitions
Key Points to Remember
- →Exception hierarchy: BaseException → Exception → specific exceptions (ValueError, ZeroDivisionError, FileNotFoundError).
- →try block: code that may raise exception. except: handles it. else: runs if no exception. finally: always runs.
- →File modes: 'r' (read), 'w' (write — creates/overwrites), 'a' (append), 'r+' (read+write), 'rb'/'wb' (binary).
- →Reading methods: read() — entire file as string, readline() — one line, readlines() — list of lines.
- →Writing: write(string) — no newline added automatically. writelines(list) — no newlines added.
- →Always close files: f.close() or use 'with open() as f:' context manager (auto-closes).
- →seek(n): move file pointer to position n. tell(): return current pointer position.
Formulas & Equations
Exam Tips
Output questions on file handling: trace what's written to the file step by step.
Binary files use pickle module: pickle.dump(obj, file) and pickle.load(file).
CSV files: use csv.reader() and csv.writer() from the csv module.
Pandas — Series and DataFrame
Key Definitions
Key Points to Remember
- →Create Series: pd.Series(data, index=[]). Create DataFrame: pd.DataFrame({'col': [values]}).
- →Importing CSV: df = pd.read_csv('file.csv'). Key params: sep, header, index_col, usecols.
- →Selection: df['col'] or df[['col1','col2']] for columns. df.loc[label] for row by label. df.iloc[n] for row by position.
- →Boolean filtering: df[df['marks'] > 80].
- →Missing values: df.isnull() to check, fillna(value) to fill, dropna() to remove rows with NaN.
- →Aggregation: df['col'].sum(), mean(), max(), min(), count().
- →Grouping: df.groupby('col').agg({'col2': 'sum'}).
- →Key info methods: df.head(n), df.tail(n), df.describe(), df.info(), df.shape, df.dtypes.
Exam Tips
loc uses labels; iloc uses integer positions — very common exam distinction.
df.shape returns (rows, columns) as a tuple.
For MCQs on Pandas: pd.read_csv returns a DataFrame; pd.Series creates a Series.
Computer Networks
Key Definitions
Key Points to Remember
- →OSI model layers (bottom to top): Physical → Data Link → Network → Transport → Session → Presentation → Application.
- →TCP/IP model (4 layers): Network Access → Internet → Transport → Application.
- →Physical layer: actual bits transmitted. Data Link: frames, MAC address. Network: routing, IP address. Transport: TCP (reliable) / UDP (fast).
- →Network devices: Hub (broadcasts to all ports, layer 1), Switch (uses MAC address, layer 2, smarter), Router (connects different networks, layer 3, uses IP).
- →Common protocols: HTTP (web), HTTPS (secure web), FTP (file transfer), SMTP (send email), POP3/IMAP (receive email), DNS (name resolution), DHCP (auto IP assignment).
- →Packet switching: data broken into packets, each routed independently. More efficient than circuit switching.
- →Network types by coverage: PAN (personal) < LAN (building) < MAN (city) < WAN (country/world).
Exam Tips
OSI model question: name all 7 layers in order — bottom to top (Physical to Application).
Hub vs Switch vs Router: Hub = dumb (broadcasts), Switch = smart (MAC-based), Router = connects networks.
TCP = reliable, connection-oriented (used for web, email). UDP = fast, connectionless (used for video streaming, DNS).
Database Concepts and SQL
Key Definitions
Key Points to Remember
- →RDBMS stores data in tables (relations). Each row = record, each column = field/attribute.
- →Candidate key: any minimal set that can uniquely identify rows. Primary key is chosen from candidate keys.
- →SELECT syntax: SELECT col FROM table WHERE condition GROUP BY col HAVING condition ORDER BY col ASC/DESC.
- →Aggregate functions: COUNT(*) — total rows, SUM(col) — total, AVG(col) — average, MAX/MIN(col).
- →WHERE filters before aggregation; HAVING filters after GROUP BY.
- →JOIN: INNER JOIN returns matching rows from both tables. LEFT JOIN returns all rows from left + matching from right.
- →NULL handling: IS NULL / IS NOT NULL (not = NULL or != NULL).
- →ALTER TABLE: ADD COLUMN, MODIFY COLUMN, DROP COLUMN. DROP TABLE: deletes entire table.
Formulas & Equations
Exam Tips
WHERE vs HAVING: WHERE filters rows (before grouping), HAVING filters groups (after GROUP BY).
For JOIN questions: write the ON condition carefully — match primary key to foreign key.
DISTINCT keyword: SELECT DISTINCT col — removes duplicate values from output.
Frequently Asked Questions
Are these notes based on 2025-26 CBSE syllabus for Class 12 Computer Science?
Yes. All chapter notes here are based on the latest 2025-26 CBSE syllabus for Class 12 Computer Science. Deleted topics are clearly marked so you focus only on what will be tested in your board exam.
How to study Class 12 Computer Science notes effectively for board exams?
Read each chapter's notes once to build understanding. Then close the notes and try to recall every key point, definition, and formula from memory. Anything you miss is your weak area — revisit only those points. This active recall method takes less time and retains far more than re-reading.
What is the difference between NCERT notes and chapter summaries?
Chapter notes contain detailed definitions, key terms, formulas, and concept breakdowns — they're for learning and understanding. Chapter summaries are shorter paragraph-style overviews — they're for quick revision. Use notes when you're studying a chapter for the first time; use summaries the night before the exam.
Do I need to memorise formulas for Class 12 Computer Science CBSE board exam?
Yes. Formulas listed in these notes must be memorised precisely — CBSE doesn't give formula sheets during exams. Write each formula 5–10 times, then recall it without looking. In the exam, write the formula first, then substitute values — this helps you earn partial marks even if the final answer has a calculation error.