CBSE Class 12 Computer Science Question Paper 2026 (91) with Solutions Skip to content
Smart Notes for Every Exam · instant PDF download after payment +91 92520 37565
Class 12 · Computer Science · Board Paper 2026

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.

Cover of Class 12 Computer Science PYQ Book: Solved Board Papers 2024-2026 (CBSE)
Class 12 Computer Science PYQ book: every chapter + 3 board papers, all solved
₹99₹14934% off
Free sample

Question paper

Jump to: Question paperSolutions

CBSE Board Paper

2026 · Q.P. Code 91

Time: 3 hours
Maximum marks: 70

Section A: 1 mark each

1.

State True or False: In Python, data type of 74 is same as the data type of 74.0.

1
2.

s = "the Truth"; print(s.capitalize()) (A) The truth (B) THE TRUTH (C) The Truth (D) the Truth

1
3.

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

1
4.

s='War and Peace by Leo Tolstoy'; print(s.partition("by"))

1
5.

What will be the output of print("PythonProgram"[-1:2:-2])?

1
6.

t = tuple('tuple'); t2 = t[2],; t += t2; print(t)

1
7.

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

1
8.

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)

1
9.

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-

1
10.

f1 = open("pqr.dat", "____"): correct mode to open in read only mode? (A) a (B) rb (C) r+ (D) rb+

1
11.

State True or False: In Python, logical errors can be handled using try...except...finally statement.

1
12.

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

1
13.

Which SQL command can change the degree of an existing relation? (A) DROP TABLE (B) ALTER TABLE (C) UPDATE…SET (D) DELETE

1
14.

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

1
15.

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

1
16.

Which aggregate function returns the smallest value from a column? (A) MIN() (B) MAX() (C) SMALL() (D) LOWER()

1
17.

Correct expanded form of RJ 45? (A) Radio Jockey 45 (B) Registered Jockey 45 (C) Radio Jack 45 (D) Registered Jack 45

1
18.

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

1
19.

Expand the term XML.

1
20.

A–R. (A): [1,2,3]+'123' is invalid. (R): a list cannot be concatenated with a string.

1
21.

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.

1

Section B: 2 marks each

22.

Difference between default parameters and positional parameters; give a header that uses both.

2
23.

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.

2
24.

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.

2
25.

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-

2
26.

Rewrite after removing errors (count vowels): def CountVowels(s): /  c=0 /  for ch in range(s): /   if 'aeiouAEIOU' in ch: /    c=+1 /  return(ch)

2
27.

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.

2
28.

(A) List one advantage and one disadvantage of Bus topology.

2
OR

(B) What is protocol in the context of computer networks? Which protocol is used to transmit hypertext across the web?

2

Section C: 3 marks each

29.

(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'.

3
30.

(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.

3
31.

(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)

3

Section D: 4 marks each

32.

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;

4
33.

"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).

4
34.

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.

4
35.

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.

4

Section E: 5 marks each

36.

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)

5
37.

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.

5

Solutions: CBSE 2026 · 91

Q1

False. type(74) is int; type(74.0) is float.

Q2
Solution in the PYQ book (₹99).
Q3

(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).

Q4
Solution in the PYQ book (₹99).
Q5

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.

Q6
Solution in the PYQ book (₹99).
Q7

(B). Keys are unique (assigning to an existing key overwrites it). Values may repeat; a dictionary is a mapping, not a sequence.

Q8
Solution in the PYQ book (₹99).
Q9

(C) 3-None. f1 prints 1+2 = 3 followed by '-'. f1 has no return, so c = None; printing a single value ignores sep.

Q10
Solution in the PYQ book (₹99).
Q11

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.

Q12
Solution in the PYQ book (₹99).
Q13

(B) ALTER TABLE: adding or dropping a column changes the number of attributes (degree).

Q14
Solution in the PYQ book (₹99).
Q15

(C) 6. Cardinality counts rows: 2 + 4 = 6. Deleting attributes changes only the degree (3 − 2 = 1).

Q16
Solution in the PYQ book (₹99).
Q17

(D) Registered Jack 45.

Q18
Solution in the PYQ book (₹99).
Q19

eXtensible Markup Language.

Q20
Solution in the PYQ book (₹99).
Q21

(C) A is true; R is false: the primary key is always chosen from the candidate keys.

Q22
Solution in the PYQ book (₹99).
Q23

(i) L1 = sorted(L) (sorted returns a new list; L.sort() would change L). (ii) ch.isalnum() (or ch.isalpha() or ch.isdigit()).

Q24
Solution in the PYQ book (₹99).
Q25

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.

Q26
Solution in the PYQ book (₹99).
Q27

(i)(a) CREATE TABLE W_STOCK
( 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;
(i)(b) No: U_Price may contain duplicate (two items with the same price) and NULL values, so it cannot uniquely identify records.

Q28(A)
Solution in the PYQ book (₹99).
Q28(B)

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).

Q29
Solution in the PYQ book (₹99).
Q30

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

Q31
Solution in the PYQ book (₹99).
Q32

(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
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
(ii) BETWEEN is inclusive, so PT0.5 at exactly 30.00 is included.

Q33
Solution in the PYQ book (₹99).
Q34

(i)   SELECT COUNT(*) FROM LOANS WHERE RoI > 7.0;            -- 3
(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;
(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.

Q35
Solution in the PYQ book (₹99).
Q36

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.

Q37
Solution in the PYQ book (₹99).

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
See real pages (free sample)

Revising the chapter first? Complete Computer Science Notes for Class 12 (CBSE 083, 2026-27) →

What you get in the pack

All chapters in this pack

  1. PYQ Ch 1 Python Revision Tour
  2. PYQ Ch 2 Functions
  3. PYQ Ch 3 Exception Handling
  4. PYQ Ch 4 Text Files
  5. PYQ Ch 5 Binary Files
  6. PYQ Ch 6 CSV Files
  7. PYQ Ch 7 Stack
  8. PYQ Ch 8 Computer Networks I: Evolution and Data Communication
  9. PYQ Ch 9 Computer Networks II: Devices, Topologies and Types
  10. PYQ Ch 10 Network Protocols and Web Services
  11. PYQ Ch 11 Database Concepts
  12. PYQ Ch 12 SQL: DDL, DML and Queries
  13. PYQ Ch 13 SQL: Aggregates, Grouping and Joins
  14. PYQ Ch 14 Interface of Python with MySQL
  15. Board Paper 2026 Set 91 with Solutions
  16. Board Paper 2025 Set 91 with Solutions
  17. Board Paper 2024 Set 91 with Solutions
← PYQ Ch 14 Interface of Python with MySQL Board Paper 2025 Set 91 with Solutions →

Prices shown in Indian rupees. Show prices in: ₹ INR · US$ USD