Kwickprep's free CBSE Class 12 Computer Science (083) important-questions guide for the 2026-27 session: the questions that repeat every year in Python functions, file handling, stack, SQL and Python-MySQL, each with a model answer and code.
These are the questions that repeat every year in CBSE Class 12 Computer Science (083), grouped by topic, each with a model answer. They cover most of the 40-mark Unit 1 (Python) and the 20-mark Database Management unit. For the exact board questions, always cross-check with the official CBSE sample paper and marking scheme.
def change(x, lst=[]):
lst.append(x)
return lst
print(change(1))
print(change(2))Solution: The output is [1] then [1, 2]. The default list is created only once when the function is defined and is shared across every call, so the second call keeps the first call's value. This is a favourite 2-mark trap.
x = 10
def f():
x = 20
print(x)
f()
print(x)Solution: The output is 20 then 10. Assigning x = 20 inside the function creates a new local variable; the global x is unchanged. To change the global inside the function you must write global x first.
def countA():
f = open("story.txt", "r")
count = 0
for line in f:
if line[0] == 'A':
count += 1
f.close()
print(count)Solution: Open the file in read mode, loop through each line and test its first character. Text-file read/write functions are a guaranteed 3–4 mark question.
import pickle
def search(r):
f = open("stu.dat", "rb")
try:
while True:
rec = pickle.load(f)
if rec[0] == r:
print(rec)
except EOFError:
f.close()Solution: Use pickle.load() inside a loop and stop on EOFError. Binary-file search/update with pickle is a common 4–5 mark question.
import csv
def addRec(rollno, name):
f = open("data.csv", "a", newline="")
w = csv.writer(f)
w.writerow([rollno, name])
f.close()Solution: Open the file in append mode with newline="", create a csv.writer and call writerow(). The newline="" argument prevents blank rows and is often worth a mark.
def push(stk, item):
stk.append(item)
def pop(stk):
if stk == []:
return "Underflow"
return stk.pop()Solution: A stack is Last-In-First-Out. append() pushes to the top and pop() removes from the top. Always check for underflow (empty stack) before popping.
Solution: SELECT Dept, COUNT(*) FROM EMP GROUP BY Dept HAVING COUNT(*) > 2; — GROUP BY groups rows by department and HAVING filters the grouped result. WHERE cannot be used with an aggregate like COUNT; that is the trick being tested.
Solution: SELECT Name FROM EMP ORDER BY Salary DESC; — ORDER BY sorts the result; DESC makes it high-to-low (ASC or nothing is low-to-high).
import mysql.connector
con = mysql.connector.connect(host="localhost",
user="root", passwd="pw", database="school")
cur = con.cursor()
cur.execute("SELECT * FROM student")
for row in cur.fetchall():
print(row)
con.close()Solution: Connect with mysql.connector.connect(), create a cursor, run the query with execute(), then loop over fetchall(). Connectivity is a reliable 4–5 mark question in the Database unit.
Difference between a hub and a switch: a hub broadcasts incoming data to every connected device, while a switch sends it only to the specific destination device, so a switch is faster and more secure.
Difference between XML and HTML: HTML is a fixed markup language for displaying data with predefined tags; XML is extensible, has user-defined tags and is used to store and carry data.
Common expansions to memorise: URL — Uniform Resource Locator, FTP — File Transfer Protocol, SMTP — Simple Mail Transfer Protocol, VoIP — Voice over Internet Protocol, HTTP — HyperText Transfer Protocol.
See a real class free, we walk through the sample paper, the scoring topics and your weak areas with Kajal Ma'am.
Book a free demo on WhatsApp