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.
Question paper
Jump to: Question paperSolutions
2025 · Q.P. Code 91
Maximum marks: 70
Section A: 1 mark each
State True or False: "A Python List must always contain all its elements of same data type."
What will be the output of print(14%3**2*4)? (A) 16 (B) 64 (C) 20 (D) 256
Identify the correct output: game="Olympic2024"; print(game.index("C")) (A) 0 (B) 6 (C) −1 (D) ValueError
Which is the correct identifier? (A) global (B) Break (C) def (D) with
Identify the invalid statement: (A) print("A",10,end="*") (B) print("A",sep="*",10) (C) print("A",10,sep="*") (D) print("A"*10)
L=['TIC','TAC']; print(L[::-1]) (A) ['CIT','CAT'] (B) ['TIC','TAC'] (C) ['CAT','CIT'] (D) ['TAC','TIC']
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
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#
While creating a table, which constraint does not allow insertion of duplicate values? (A) UNIQUE (B) DISTINCT (C) NOT NULL (D) HAVING
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$$
N='5' / try: / print('WORD' + N, end='#') / except: / print('ERROR',end='#') / finally: / print('OVER') (A) ERROR# (B) WORD5#OVER (C) WORD5# (D) ERROR#OVER
Which built-in function/method returns a dictionary? (A) dict() (B) keys() (C) values() (D) items()
Which is a DML command? (A) UPDATE (B) CREATE (C) ALTER (D) DROP
Which aggregate function displays the number of values in a column ignoring NULL values? (A) len() (B) count() (C) number() (D) num()
In MySQL, which type of value should not be enclosed within quotation marks? (A) DATE (B) VARCHAR (C) FLOAT (D) CHAR
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.
Which device is used to regenerate and transmit the weakened signal ahead? (A) Hub (B) Ethernet Card (C) Repeater (D) Modem
Correct protocol used for phone calls over the Internet? (A) PPP (B) FTP (C) HTTP (D) VoIP
Expand ARPANET.
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.
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.
Section B: 2 marks each
What does the return statement do in a function? Explain with an example.
Write one example each of (i) Syntax Error (ii) Implicit type conversion.
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.
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#
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)
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.
(a) Expand and explain the term URL. OR (b) Expand PPP. What is its use?
Section C: 3 marks each
(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.
(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'.
(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)
Section D: 4 marks each
(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".
(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;
"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.
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.
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.
Section E: 5 marks each
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.
'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.
Solutions: CBSE 2025 · 91
False. A list can hold elements of different types, e.g. [1, "a", 2.5, [3]].
(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).
(B). A positional argument (10) cannot follow a keyword argument (sep="*"); this is a SyntaxError.
(A) is, the identity operator (compares object identity, i.e. id()).
(A) UNIQUE.
(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.
(A) UPDATE.
(C) FLOAT (numeric values are written without quotes; text and dates need quotes).
(C) Repeater.
Advanced Research Projects Agency Network.
(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.
(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.
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.
(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;
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
| i | count | action | newstr |
|---|---|---|---|
| G | 0 | even → 'g' | g |
| e | 1 | odd → str(0) | g0 |
| n | 2 | even → 'n' | g0n |
| X | 3 | odd → str(2) | g0n2 |
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'}
(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
(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';
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.
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
