CBSE Class 12 Computer Science Question Paper 2026 (91) with Solutions
The complete CBSE Class 12 Computer Science board paper of 2026, Q.P. code 91: all 37 questions exactly as set, with marks. 19 solutions are free below. The Class 12 Computer Science PYQ Book: Solved Board Papers 2024-2026 (CBSE) solves all 3 papers in full and sorts every question chapter-wise.
Question paper
Jump to: Question paperSolutions
2026 · Q.P. Code 91
Maximum marks: 70
Section A: 1 mark each
State True or False: In Python, data type of 74 is same as the data type of 74.0.
s = "the Truth"; print(s.capitalize()) (A) The truth (B) THE TRUTH (C) The Truth (D) the Truth
Which expression evaluates to True? (A) 2>3 and 2<3 (B) 3>1 and 2 (C) 3>1 and 3>2 (D) 3>1 and 3<2
s='War and Peace by Leo Tolstoy'; print(s.partition("by"))
What will be the output of print("PythonProgram"[-1:2:-2])?
t = tuple('tuple'); t2 = t[2],; t += t2; print(t)
True about dictionaries: (A) a sequence type (B) cannot have two elements with same key (C) cannot have two elements with same value (D) key and value cannot be the same
If L has 6 elements, which raises an exception? (A) L.pop(1) (B) L.pop(6) (C) L.insert(1,6) (D) L.insert(6,1)
def f1(a,b=1): / print(a+b,end='-') / c=f1(1,2) / print(c,sep='*') (A) 3-2 (B) 3-2* (C) 3-None (D) 3*None-
f1 = open("pqr.dat", "____"): correct mode to open in read only mode? (A) a (B) rb (C) r+ (D) rb+
State True or False: In Python, logical errors can be handled using try...except...finally statement.
A table has two candidate keys, one of which is chosen as the primary key. How many alternate keys? (A) 0 (B) 1 (C) 2 (D) 3
Which SQL command can change the degree of an existing relation? (A) DROP TABLE (B) ALTER TABLE (C) UPDATE…SET (D) DELETE
Output of SELECT MACHINE_ID, MACHINE_NAME FROM INVENTORY WHERE QUANTITY <= 100; (A) all columns, quantity > 100 (B) ID and name, quantity < 100 (C) all columns, quantity ≥ 100 (D) ID and name of machines with quantity less than or equal to 100
A relation has 2 tuples and 3 attributes. If 2 attributes are deleted and 4 tuples are added, what is the cardinality? (A) 4 (B) 5 (C) 6 (D) 7
Which aggregate function returns the smallest value from a column? (A) MIN() (B) MAX() (C) SMALL() (D) LOWER()
Correct expanded form of RJ 45? (A) Radio Jockey 45 (B) Registered Jockey 45 (C) Radio Jack 45 (D) Registered Jack 45
Which device serves as the entry and exit point of a network, as all data coming in or going out must first pass through it? (A) Modem (B) Gateway (C) Switch (D) Repeater
Expand the term XML.
A–R. (A): [1,2,3]+'123' is invalid. (R): a list cannot be concatenated with a string.
A–R. (A): The PRIMARY KEY constraint ensures each value in the column(s) is unique and cannot be NULL. (R): Candidate keys are not eligible to become a primary key.
Section B: 2 marks each
Difference between default parameters and positional parameters; give a header that uses both.
Write a statement (built-in functions/methods only): (i) to create a new list L1 with the elements of L in ascending order, without modifying L; (ii) to check whether the character ch is an alphabet or a number.
Assuming D1 is a dictionary: (i)(a) Expression to check if key 'RNo' is present. OR (b) Check if any key in D1 has value 12. (ii)(a) A single built-in statement to add 'RNo':12 if 'RNo' is absent, but return its value if present. OR (b) Delete all elements of D1.
Which output(s) will NOT be displayed? How many times does the loop run? a=[1,2,3,4,5,6] / for i in range(4): / j=random.randrange(i,5) / print(a[j],end='-') (A) 3-4-5-4- (B) 2-2-4-5- (C) 4-3-3-5- (D) 5-1-2-4-
Rewrite after removing errors (count vowels): def CountVowels(s): / c=0 / for ch in range(s): / if 'aeiouAEIOU' in ch: / c=+1 / return(ch)
Table W_STOCK: W_Code CHAR(5), W_Description VARCHAR(20), B_Qty INTEGER, U_Price FLOAT. (i)(a) Create the table with W_Code as primary key. OR (b) Can U_Price be the primary key? Justify. (ii)(a) Add attribute E_Date (DATE). OR (b) Remove column B_Qty.
(A) List one advantage and one disadvantage of Bus topology.
(B) What is protocol in the context of computer networks? Which protocol is used to transmit hypertext across the web?
Section C: 3 marks each
(a) Write a function that counts and returns the number of digits in "Space.txt" (sample returns 11). OR (b) Display the words in which lowercase 'e' appears at least twice in 'Space.txt'.
(a) FruitStack holds dictionaries {'Name', 'Origin', 'Price', 'Expiry'}. Write (i) push_fruit(FruitStack, Fruit): push if Price < 100; (ii) pop_fruit(FruitStack): pop and return, or display "UNDERFLOW"; (iii) display(FruitStack): from the top, or 'EMPTY STACK'.
OR (b) OR: accept 10 integers; push three-digit even ones; then pop all and display. Input 12, 31, 320, 457, 6, 92, 924, 220, 1, 218 → output 218 220 924 320.
(a) Output: def Exam2026(given): / new=[] / for ch in given[1:-1]: / if ch.isupper(): new.reverse() / elif ch not in new: new.append(ch) / elif ch in new: new.pop() / print(new) / Exam2026("Gold-24Medals")
OR (b) OR: def Exam2026(given): / new=0 / while given: / if new%2: new+=given%10 / else: new+=given%5 / print(new,end='-') / given//=10 / Exam2026(123456)
Section D: 4 marks each
Table STOCK (13.1). (a) Write queries: (i) Type and maximum Price for each Type; (ii) increase Price by 0.5 where Type is 'F'; (iii) total value of stock (total of Qty × Price); (iv) details of records where Code starts with 'A'.
OR (b) OR, outputs: (i) SELECT Volume, Qty, Price FROM STOCK WHERE Type IN ('F','D'); (ii) SELECT Code, Qty FROM STOCK WHERE Price BETWEEN 30 AND 50; (iii) SELECT DISTINCT Type FROM STOCK; (iv) SELECT Volume, count(*) FROM STOCK GROUP BY Volume;
"States.csv" (with a header row) has [State, Capital, Population, Language], e.g. ['Andhra Pradesh','Amaravati',52221000,'Telugu']. Write a program that appends all records with population more than 10000000 to 'More.csv' (do not copy the header).
CUSTOMERS and LOANS (13.4). Write queries for: (i) number of LOANS records with RoI above 7.0; (ii) names of customers whose L_Amt is above 1000000; (iii) C_ID, C_Name and Terms of records with L_Date after 31 December 2024; (iv)(a) details of all loans in descending order of RoI, OR (b) C_ID and average term for each C_ID from LOANS.
Table Account in MySQL database SCHOOL: Stud_id int, Sname, Class, Fees float. Display records of students whose fees is less than 5000. Username admin, password root, host localhost.
Section E: 5 marks each
RESOURCES.DAT stores tuples (R_ID, R_Name, R_Expertise, Charges), e.g. (12,'P. Velusami','Machine Learning',5000). Write (i) Append() to input a resource person's data and write it; (ii) Update() to increase the Charges of each person by 500. (2+3)
Sanjeevani group (Head Office Hyderabad) sets up a University in Amritsar with blocks ADMIN (25 computers), ACADEMIC (600), HOSTEL (120), SPORTS (50). Distances: ADMIN–ACADEMIC 60 m, ADMIN–HOSTEL 160 m, ADMIN–SPORTS 80 m, ACADEMIC–HOSTEL 40 m, ACADEMIC–SPORTS 120 m, HOSTEL–SPORTS 150 m; Hyderabad–Amritsar 2000 km. (i) Server location with justification. (ii) Cable layout. (iii) Two wired media for computers inside a block. (iv) Medium used by an FM channel: (A) Radio (B) Micro (C) Infrared waves. (v)(a) Full name of the protocol for online audio-visual sessions, OR (b) where to install a repeater, with justification.
Solutions: CBSE 2026 · 91
False. type(74) is int; type(74.0) is float.
(C). True and True → True. (A) and (D) give False; (B) gives 2 (and returns its last operand), which is truthy but not the value True, so the scheme also accepted (B).
Step −2 from index −1 (= 12, 'm') down to index 3 (excluded): indices 12, 10, 8, 6, 4 → 'm','r','o','P','o'. Output: mroPo.
(B). Keys are unique (assigning to an existing key overwrites it). Values may repeat; a dictionary is a mapping, not a sequence.
(C) 3-None. f1 prints 1+2 = 3 followed by '-'. f1 has no return, so c = None; printing a single value ignores sep.
False. A logical error produces a wrong result without raising any exception, so there is nothing for except to catch; only run-time errors (exceptions) can be handled.
(B) ALTER TABLE: adding or dropping a column changes the number of attributes (degree).
(C) 6. Cardinality counts rows: 2 + 4 = 6. Deleting attributes changes only the degree (3 − 2 = 1).
(D) Registered Jack 45.
eXtensible Markup Language.
(C) A is true; R is false: the primary key is always chosen from the candidate keys.
(i) L1 = sorted(L) (sorted returns a new list; L.sort() would change L). (ii) ch.isalnum() (or ch.isalpha() or ch.isdigit()).
j ranges: i=0 → 0–4 (values 1–5); i=1 → 1–4 (2–5); i=2 → 2–4 (3–5); i=3 → 3–4 (4–5). In (D) the second value 1 is impossible (minimum is 2). (A), (B), (C) fit. Answer: (D) 5-1-2-4- will not be displayed; the loop runs 4 times.
(i)(a) CREATE TABLE W_STOCK(i)(b) No: U_Price may contain duplicate (two items with the same price) and NULL values, so it cannot uniquely identify records.
( W_Code CHAR(5) PRIMARY KEY,
W_Description VARCHAR(20),
B_Qty INTEGER,
U_Price FLOAT );
(ii)(a) ALTER TABLE W_STOCK ADD COLUMN E_Date DATE;
(ii)(b) ALTER TABLE W_STOCK DROP COLUMN B_Qty;
A protocol is a set of rules that need to be followed by communicating devices in order to have successful and reliable data communication. Hypertext is transmitted using HTTP (HyperText Transfer Protocol).
def push_fruit(FruitStack, Fruit):
if Fruit['Price'] < 100:
FruitStack.append(Fruit)
def pop_fruit(FruitStack):
if FruitStack == []:
print('UNDERFLOW')
else:
return FruitStack.pop()
def display(FruitStack):
if FruitStack == []:
print('EMPTY STACK')
else:
for ele in FruitStack[::-1]:
print(ele)
OR
Stack = []
for C in range(10):
Num = int(input("Integer: "))
if 100 <= Num <= 999 and Num % 2 == 0:
Stack.append(Num)
while Stack:
print(Stack.pop(), end=' ')
218 220 924 320
(i) SELECT Type, MAX(Price) FROM STOCK GROUP BY Type;
(ii) UPDATE STOCK SET Price = Price + 0.5 WHERE Type = 'F';
(iii) SELECT SUM(Qty * Price) FROM STOCK; -- 41665.00
(iv) SELECT * FROM STOCK WHERE Code LIKE 'A%'; -- AF0.5, AT1.0
OR
(i) 0.5 300 38.00(ii) BETWEEN is inclusive, so PT0.5 at exactly 30.00 is included.
0.5 250 36.50
1.0 50 52.00
(ii) AF0.5 300
MF0.5 250
PT0.5 78
(iii) F
T
D
(iv) 0.5 3
1.0 3
(i) SELECT COUNT(*) FROM LOANS WHERE RoI > 7.0; -- 3(iii) gives 00003 David Xavier 60; 00001 Raj Malhotra 48; 00003 David Xavier 36; 00004 Damini Iyer 60. Write C.C_ID (not just C_ID) in a join, or MySQL reports an ambiguous column.
(ii) SELECT C_Name FROM CUSTOMERS, LOANS
WHERE CUSTOMERS.C_ID = LOANS.C_ID AND L_Amt > 1000000; -- Abdul
(iii) SELECT C.C_ID, C_Name, Terms FROM CUSTOMERS C, LOANS L
WHERE C.C_ID = L.C_ID AND L_Date > '2024-12-31';
(iv)(a) SELECT * FROM LOANS ORDER BY RoI DESC;
(iv)(b) SELECT C_ID, AVG(Terms) FROM LOANS GROUP BY C_ID;
Assumption: each tuple dumped separately.
import pickle
def Append():
F = open("RESOURCES.DAT", "ab")
R_ID = int(input("Resource Person ID: "))
R_Name = input("Resource Person Name: ")
R_Expertise = input("Area of Expertise: ")
Charges = int(input("Hourly Charges: "))
pickle.dump((R_ID, R_Name, R_Expertise, Charges), F)
F.close()
def Update():
F = open("RESOURCES.DAT", "rb+")
try:
while True:
Pos = F.tell()
Rec = pickle.load(F)
Newrec = list(Rec) # tuples are immutable
Newrec[3] += 500
F.seek(Pos)
pickle.dump(tuple(Newrec), F)
except EOFError:
F.close()
(12, 'P. Velusami', 'Machine Learning', 5000) becomes (…, 5500). A tuple cannot be changed, so it is converted to a list, modified and converted back. Reading everything with 'rb' and rewriting with 'wb' is also accepted.
Get every solution for all 3 papers
- Every board question of every chapter, each fully solved the way the board gives marks
- 3 complete board papers, each followed by its solutions
- Weightage and most-asked topics for every chapter
- Instant PDF download, colour and black & white print copies
Revising the chapter first? Complete Computer Science Notes for Class 12 (CBSE 083, 2026-27) →
What you get in the pack
- CBSE Class 12 Computer Science board papers 2024 to 2026 (3 full board papers)
- All 14 chapters and 3 board papers complete
- Part A: all 14 chapters, questions sorted chapter-wise and by marks
- Year-wise weightage table and most-asked topics for every chapter
- Part B: each full board paper followed by its complete solutions
- Full programs; every output traced and verified by running the code
- Only the current syllabus in Part A
All chapters in this pack
- PYQ Ch 1 Python Revision Tour
- PYQ Ch 2 Functions
- PYQ Ch 3 Exception Handling
- PYQ Ch 4 Text Files
- PYQ Ch 5 Binary Files
- PYQ Ch 6 CSV Files
- PYQ Ch 7 Stack
- PYQ Ch 8 Computer Networks I: Evolution and Data Communication
- PYQ Ch 9 Computer Networks II: Devices, Topologies and Types
- PYQ Ch 10 Network Protocols and Web Services
- PYQ Ch 11 Database Concepts
- PYQ Ch 12 SQL: DDL, DML and Queries
- PYQ Ch 13 SQL: Aggregates, Grouping and Joins
- PYQ Ch 14 Interface of Python with MySQL
- Board Paper 2026 Set 91 with Solutions
- Board Paper 2025 Set 91 with Solutions
- Board Paper 2024 Set 91 with Solutions
