What you'll learn
Quick Answer
File handling, SQL and data structures carry the most reliable marks, and they are the most practisable. Write code by hand on paper during revision — most lost marks come from small syntax and logic slips that only appear when you cannot run the program.
Where the marks actually are
The paper is not evenly difficult. Some topics are almost mechanical once practised, and some are genuinely conceptual. If your revision time is limited, spend it in this order:
- File handling — text, binary and CSV. Highly predictable question patterns, and almost entirely practisable.
- SQL — queries and output prediction. Short questions, quick marks, very little ambiguity.
- Data structures (stack and queue) — implemented with lists. A small number of standard operations that recur every year.
- Python fundamentals — functions, scope, and predicting the output of a given snippet.
- Networking and databases theory — worth revising, but the questions are more variable.
The single highest-return revision habit is writing code on paper. In the exam you cannot run anything, and the errors you make on paper are different from the ones you make with an interpreter catching you. Most lost marks in this paper are not conceptual — they are a missing colon, a wrong indent, or a variable used before it exists.
Stacks: the empty check is where marks are lost
The stack question appears in some form almost every year, implemented on a Python list. The operations are simple. The mark scheme is not lenient about the underflow case.
def push(stack, item):
stack.append(item)
def pop(stack):
if not stack: # check FIRST
return "Underflow"
return stack.pop()
s = []
push(s, 10); push(s, 20); push(s, 30)
print(s) # [10, 20, 30]
print(pop(s)) # 30
print(s) # [10, 20]
print(pop([])) # Underflow
The trap is writing stack.pop() before checking whether the stack is empty. On an empty list that raises IndexError, and a function that crashes instead of returning "Underflow" does not get the mark even though the logic is otherwise right.
Remember that a stack is last-in first-out, so the element you pop is the one you pushed most recently — 30 above, not 10. A queue is the opposite, and mixing them up in a hurry is common.
File handling: count things carefully
The standard question gives you a text file and asks you to count something — lines, words, or lines beginning with a particular letter. Given a file containing these three lines:
Arrays store items together
Every stack has a top
Queues remove from the front
with open("notes.txt", "r") as f:
lines = f.readlines()
vowel_lines = [ln for ln in lines if ln[0].upper() in "AEIOU"]
words = sum(len(ln.split()) for ln in lines)
print(len(lines)) # 3
print(words) # 14
print(len(vowel_lines)) # 2
Two things cost marks here. First, readlines() keeps the newline character on each line, so if you are counting characters your answer will be off by one per line. Second, "words" means split() on whitespace — do not try to be clever about punctuation unless the question asks.
For CSV, the mistake is forgetting the header row:
import csv
with open("marks.csv", "r", newline="") as f:
r = csv.reader(f)
next(r) # skip the header
toppers = [row for row in r if int(row[2]) > 80]
Note the int(). Everything read from a CSV is a string, and "87" > 80 raises a TypeError in Python 3. Comparing a string to a number is one of the most common slips in this section.
SQL: know exactly what COUNT does
SQL questions are usually short and ask you to write a query or predict its output. Take a STUDENT table with Asha (Science, 87), Ravi (Commerce, 62), Meera (Science, 91) and Zoya (Commerce, 78).
SELECT Stream, COUNT(*), MAX(Marks)
FROM STUDENT
GROUP BY Stream;
gives two rows — Commerce with 2 students and a maximum of 78, Science with 2 students and a maximum of 91. And:
SELECT Name FROM STUDENT
WHERE Marks > 80
ORDER BY Marks DESC;
gives Meera then Asha, in that order.
Now the distinction that is asked about constantly and answered wrongly constantly. Add a fifth student, Iqbal, whose Marks is NULL:
SELECT COUNT(*), COUNT(Marks) FROM STUDENT;
-- returns 5, 4
COUNT(*) counts rows. COUNT(column) counts non-NULL values in that column. This is the reason NULL gets so much attention in the syllabus, and it extends further: NULL is not equal to anything, including itself, so WHERE Marks = NULL returns nothing at all. You must write WHERE Marks IS NULL.
Output-prediction questions: the mutable default trap
"Predict the output" questions target places where Python behaves in a way that looks wrong until you know the rule. The most-asked one involves a default argument:
def add_topic(topic, revised=[]):
revised.append(topic)
return revised
print(add_topic("Stacks")) # ['Stacks']
print(add_topic("Queues")) # ['Stacks', 'Queues'] <-- surprising
The default list is created once, when the function is defined — not each time it is called. So every call that relies on the default shares the same list, and data from a previous call leaks into the next one.
def add_topic(topic, revised=None):
if revised is None:
revised = []
revised.append(topic)
return revised
print(add_topic("Stacks")) # ['Stacks']
print(add_topic("Queues")) # ['Queues']
Related favourites: the difference between is and ==, what a global variable does inside a function without the global keyword, and the fact that assigning one list to another name does not copy it.
A four-week plan that works
If you have roughly a month, this ordering keeps you productive rather than anxious:
- Week 1 — File handling, all three types. Write every program by hand at least once.
- Week 2 — SQL and database theory. Do output-prediction questions in bulk; they are fast and they compound.
- Week 3 — Stacks, queues and Python fundamentals, including output-prediction snippets.
- Week 4 — Networking theory, then full papers under timed conditions. Do not start full papers earlier; they are a diagnostic, and they are demoralising before you have revised.
Mark every question you got wrong with why — concept, syntax, or misread the question. After two papers the pattern is usually obvious, and it is almost never "I do not understand the topic". It is usually the third category.
If you need the chapters themselves, our free Class 12 Computer Science material covers the syllabus with worked answers and practice questions, and the whole of Priodemy for School is free with no account.
