CBSE Class 12 Computer Science Question Paper 2025 (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 2025

CBSE Class 12 Computer Science Question Paper 2025 (91) with Solutions

The complete CBSE Class 12 Computer Science board paper of 2025, 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

2025 · Q.P. Code 91

Time: 3 hours
Maximum marks: 70

Section A: 1 mark each

1.

State True or False: "A Python List must always contain all its elements of same data type."

1
2.

What will be the output of print(14%3**2*4)? (A) 16 (B) 64 (C) 20 (D) 256

1
3.

Identify the correct output: game="Olympic2024"; print(game.index("C")) (A) 0 (B) 6 (C) −1 (D) ValueError

1
4.

Which is the correct identifier? (A) global (B) Break (C) def (D) with

1
5.

Identify the invalid statement: (A) print("A",10,end="*") (B) print("A",sep="*",10) (C) print("A",10,sep="*") (D) print("A"*10)

1
6.

L=['TIC','TAC']; print(L[::-1]) (A) ['CIT','CAT'] (B) ['TIC','TAC'] (C) ['CAT','CIT'] (D) ['TAC','TIC']

1
7.

Which operator evaluates to True if the variables on either side point to the same memory location? (A) is (B) is not (C) and (D) or

1
8.

D={'S01':95,'S02':96}
for I in D: print(I,end='#') (A) S01#S02# (B) 95#96# (C) S01,95#S02,96# (D) S01#95#S02#96#

1
9.

While creating a table, which constraint does not allow insertion of duplicate values? (A) UNIQUE (B) DISTINCT (C) NOT NULL (D) HAVING

1
10.

def Change(N): /  N=N+10 /  print(N,end='$$') / N=15 / Change(N) / print(N) (A) 25$$15 (B) 15$$25 (C) 25$$25 (D) 2525$$

1
11.

N='5' / try: /  print('WORD' + N, end='#') / except: /  print('ERROR',end='#') / finally: /  print('OVER') (A) ERROR# (B) WORD5#OVER (C) WORD5# (D) ERROR#OVER

1
12.

Which built-in function/method returns a dictionary? (A) dict() (B) keys() (C) values() (D) items()

1
13.

Which is a DML command? (A) UPDATE (B) CREATE (C) ALTER (D) DROP

1
14.

Which aggregate function displays the number of values in a column ignoring NULL values? (A) len() (B) count() (C) number() (D) num()

1
15.

In MySQL, which type of value should not be enclosed within quotation marks? (A) DATE (B) VARCHAR (C) FLOAT (D) CHAR

1
16.

True or False: If table A has 6 rows and 3 columns and table B has 5 rows and 2 columns, the Cartesian product of A and B will have 30 rows and 5 columns.

1
17.

Which device is used to regenerate and transmit the weakened signal ahead? (A) Hub (B) Ethernet Card (C) Repeater (D) Modem

1
18.

Correct protocol used for phone calls over the Internet? (A) PPP (B) FTP (C) HTTP (D) VoIP

1
19.

Expand ARPANET.

1
20.

A–R. (A): For a binary file opened using 'rb' mode, pickle.dump() will display an error. (R): pickle.dump() is used to read from a binary file.

1
21.

A–R. (A): We can retrieve records from more than one table in MySQL. (R): Foreign key is used to establish a relationship between two tables.

1

Section B: 2 marks each

22.

What does the return statement do in a function? Explain with an example.

2
23.

Write one example each of (i) Syntax Error (ii) Implicit type conversion.

2
24.

D={"Suman":40, "Raj":55, "Raman":60}; D1={"Aditi":30, "Amit":90, "Raj":20} (built-in functions only).
(i)(a) Display the value for key "Raj" in D. OR (b) Display the length of D1.
(ii)(a) Append all pairs of D to D1. OR (b) Delete the item with key "Amit" from D1.

2
25.

Possible output? Cards=["Heart","Spade","Club","Diamond"] / for i in range(2): /  print(Cards[random.randint(1,i+2)],end="#") (A) Spade#Diamond# (B) Spade#Heart# (C) Diamond#Club# (D) Heart#Spade#

2
26.

Rewrite after removing errors: def Sum(N) / for I in range(N): / S=S+I / return S / print(Sum(10) (sum of integers 1 to N)

2
27.

Table EMPLOYEES(EMPNO, NAME, DEPARTMENT, BASICSAL); two employees can have the same name. (i)(a) Which attribute should be the PRIMARY KEY? Justify. OR (b) Constraint so that NAME cannot be NULL but can have duplicates. (ii)(a) SQL to change BASICSAL to allow a maximum of 99999.99. OR (b) SQL to delete the table EMPLOYEES.

2
28.

(a) Expand and explain the term URL. OR (b) Expand PPP. What is its use?

2

Section C: 3 marks each

29.

(a) Write a function that displays all lines containing the word 'vote' from "Elections.txt". OR (b) Display all words starting and ending with a vowel from "Report.txt", separated by a space.

3
30.

(a) ClrStack holds records (ColorName, RED, GREEN, BLUE), e.g. ('Yellow', 237, 250, 68). Write (i) push_Clr(ClrStack, new_Clr) (ii) pop_Clr(ClrStack): pop and return the top record, or display "Underflow" (iii) isEmpty(ClrStack): return True if empty, else False.
OR (b) OR: (i) push_trail(N, myStack): push the last 5 elements of list N ([1..7] → stack [3,4,5,6,7]); (ii) pop_one(myStack): pop and return an element, or display 'Stack Underflow' and return None; (iii) display_all(myStack): display all elements without deleting, or 'Empty Stack'.

3
31.

(a) Predict the output: def ExamOn(mystr): /  newstr=""; count=0 /  for i in mystr: /   if count%2!=0: newstr=newstr+str(count-1) /   else: newstr=newstr+i.lower() /   count+=1 /  newstr=newstr+mystr[:2] /  print("The new string is:",newstr) / ExamOn("GenX")
OR (b) OR: def Change(X): /  for K,V in X.items(): /   L1.append(K); L2.append(V) / D={1:"ONE",2:"TWO",3:"THREE"}; L1=[]; L2=[] / Change(D); print(L1); print(L2); print(D)

3

Section D: 4 marks each

32.

(A) Table WORKER (above): (i) names and wages of workers with wages between 800 and 1500; (ii) records of workers whose SITEID is not known; (iii) WNAME, WAGE, HOURS of 'Skilled' workers; (iv) change WAGE to 1200 for TYPE "Semiskilled".

4
OR

(B) Table WORKER (Chapter 12): outputs of (i) SELECT WNAME, WAGE*HOURS FROM WORKER WHERE SITEID = 103; (ii) SELECT COUNT(DISTINCT TYPE) FROM WORKER; (iii) SELECT MAX(WAGE), MIN(WAGE), TYPE FROM WORKER GROUP BY TYPE; (iv) SELECT WNAME, SITEID FROM WORKER WHERE TYPE="Unskilled" ORDER BY HOURS;

4
33.

"P_record.csv" records: [Name, Disease, Days admitted, Amount], e.g. ["Gunjan","Jaundice",4,15000]. Write (i) read_data() to display the details of all 'Cancer' patients; (ii) count_rec() to count and return the number of records.

4
34.

Creative Art Gallery: Articles(Code, A_Code, Article, DOC, Price) and Artists(A_Code, Name, Phone, Email, DOB). Write queries: (i) all records of Articles in descending order of price; (ii) Articles created in the year 2020; (iii) structure of Artists; (iv)(a) names of all Artists whose Article is Painting through Equi Join, OR (b) through Natural Join.

4
35.

Table THEATRE in database CINEMA: Th_ID char(5), Name varchar(15), City varchar(15), Location varchar(15), Seats int. Write Delete_Theatre() to input Th_ID from the user and permanently delete that record. Host localhost, user root, password Ex2025.

4

Section E: 5 marks each

36.

PASSENGERS.DAT stores [PNR, PName, BRDSTN, DESTN, FARE]. Write: (i) Create() to input data and write it; (ii) SearchDestn(D) to display passengers whose DESTN is D; (iii) UpdateFare() to increase all fares by 5% and rewrite the file.

5
37.

'Swabhaav' NGO (Head Office Nagpur) sets up a Vijayawada centre with blocks ADMIN (16 computers), PSYCHIATRY (40), PSYCHOLOGY (19), ICU (20). Distances: ADMIN to each of the others 65 m; PSYCHIATRY–PSYCHOLOGY 100 m; PSYCHIATRY–ICU 50 m; PSYCHOLOGY–ICU 50 m; Nagpur–Vijayawada 700 km. (i) Server location with justification. (ii) Device to connect all computers within each block. (iii) Cable layout. (iv) Where to place the router? (v)(a) Protocol for the Nagpur manager to remotely access a computer in ADMIN, OR (b) type of network among the computers of the Vijayawada centre.

5

Solutions: CBSE 2025 · 91

Q1

False. A list can hold elements of different types, e.g. [1, "a", 2.5, [3]].

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

(D) ValueError. There is a lowercase "c" at index 6 but no uppercase "C"; index() raises ValueError when the substring is absent (find() would return −1).

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

(B). A positional argument (10) cannot follow a keyword argument (sep="*"); this is a SyntaxError.

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

(A) is, the identity operator (compares object identity, i.e. id()).

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

(A) UNIQUE.

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

(B) WORD5#OVER. N is the string '5', so 'WORD' + '5' = 'WORD5' works; no exception, so except is skipped; finally always runs and prints OVER.

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

(A) UPDATE.

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

(C) FLOAT (numeric values are written without quotes; text and dates need quotes).

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

(C) Repeater.

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

Advanced Research Projects Agency Network.

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

(B) Both true. Records from several tables are retrieved by a join (or cartesian product), which works even without a foreign key, so R does not explain A.

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

(i) print(2 ; 5) or if x>5 print(x) (missing colon): the program does not run.
(ii) x = 10; y = 20.5; print(x + y) → 30.5: the int 10 is converted to float automatically.

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

i = 0: randint(1, 2) → index 1 or 2 → Spade or Club. i = 1: randint(1, 3) → Spade, Club or Diamond. Heart (index 0) can never appear; Diamond cannot come first. Only (A) Spade#Diamond# is possible.

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

(i)(a) EMPNO: every employee's identification number is unique and not null, while names, departments and salaries can repeat. (b) NOT NULL.
(ii)(a) ALTER TABLE EMPLOYEES MODIFY COLUMN BASICSAL FLOAT(7,2); (or DECIMAL(7,2): 7 digits in all, 2 after the point). (b) DROP TABLE EMPLOYEES;

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

def PrintVote():
with open("Elections.txt") as F:
for Line in F:
if "vote" in Line.split(): # whole word only
print(Line, end="")

For the sample file it prints lines 1 and 3; "votes" and "voting" in lines 2 and 4 are not the word "vote", which is why split() is used instead of "vote" in Line.

def vowels():
with open("Report.txt") as F:
for W in F.read().split():
if W[0] in "aeiouAEIOU" and W[-1] in "aeiouAEIOU":
print(W, end=" ")

Once a a awesome able

Q30
Solution in the PYQ book (₹99).
Q31
icountactionnewstr
G0even → 'g'g
e1odd → str(0)g0
n2even → 'n'g0n
X3odd → str(2)g0n2
Then mystr[:2] = "Ge" is added.
The new string is: g0n2Ge

OR L1 and L2 are global lists changed in place by append (no global keyword needed for that).
[1, 2, 3]
['ONE', 'TWO', 'THREE']
{1: 'ONE', 2: 'TWO', 3: 'THREE'}
Q32(A)
Solution in the PYQ book (₹99).
Q32(B)

(i) Site 103: Ahmed J 1500 × 200, Anju S 1200 × 130.

Ahmed J  300000
Anju S 156000

(ii) Types: Unskilled, Skilled, Semiskilled.

3

(iii)

1500  780  Unskilled
1200 520 Skilled
560 560 Semiskilled

(iv) Unskilled: Jacob B (95 h), Ahmed J (200 h).

Jacob B  101
Ahmed J 103

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

(i)   SELECT * FROM Articles ORDER BY Price DESC;
(ii) SELECT * FROM Articles WHERE DOC LIKE '2020%';
-- or WHERE DOC BETWEEN '2020-01-01' AND '2020-12-31'
(iii) DESC Artists;
(iv)(a) SELECT Name FROM Articles A1, Artists A2
WHERE A1.A_Code = A2.A_Code AND Article = 'Painting';
(iv)(b) SELECT Name FROM Articles NATURAL JOIN Artists
WHERE Article = 'Painting';

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

Assumption: the file holds one list of all passenger records.

import pickle
def Create():
Rec = []
while True:
PNR = input("PNR No: ")
PName = input("Name: ")
BRDSTN = input("Boarding at: ")
DESTN = input("Destination: ")
FARE = float(input("Fare: "))
Rec.append([PNR, PName, BRDSTN, DESTN, FARE])
if input("More (Y/N)? ") in "Nn":
break
with open("PASSENGERS.DAT", "wb") as F:
pickle.dump(Rec, F)

def SearchDestn(D):
with open("PASSENGERS.DAT", "rb") as F:
Rec = pickle.load(F)
for R in Rec:
if R[3] == D:
print(R)

def UpdateFare():
with open("PASSENGERS.DAT", "rb") as F:
Rec = pickle.load(F)
for R in Rec:
R[4] = R[4] + R[4] * 0.05 # or R[4] *= 1.05
with open("PASSENGERS.DAT", "wb") as F:
pickle.dump(Rec, F)
print("Updation Done!")

Fares 1000.0 and 2000.0 become 1050.0 and 2100.0. Marks: (i) 1½ (ii) 1½ (iii) 2.

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
← Board Paper 2026 Set 91 with Solutions Board Paper 2024 Set 91 with Solutions →

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