Page 1
Central Board of Secondary Education
SAMPLE PAPER
Class 12
2025
Solutions
Page 2
MARKING SCHEME
Class: XII Session: 2024-25
Computer Science (083)
Time allowed: 3 Hours Maximum Marks: 70
Q No. SECTION A (21X1=21) Marks
1. False (1)
2. (A) #THONPROGRAM
(1)
3. (A) not (True) and False
(1)
4. (B) ['I', 'ter', 'atio', 'al']
(1)
5. ce lo
(1)
6. (B) False
(1)
7. (B) print(my_dict['apple', 'banana'])
(1)
8. (B) Removes the first occurrence of value x from the list
(1)
9. (D) t=tuple(1)
(1)
10. file.seek(0) ( OR file.seek(0,0) )
(1)
11. False
(1)
12. (C) 12#15%
(1)
13. Alter (or Alter Table)
(1)
14. (A) Details of all products whose names start with 'App' (1)
Page: 1/11
Page 3
15. (D) CHAR
(1)
16. (B) count()
(1)
17. (B) FTP
(1)
18. (B) Gateway
(1)
19. (B) Packet Switching
(1)
20. (B) Both A and R are true and R is not the correct explanation for A.
(1)
21. (C) A is True but R is False.
(1)
Q No. SECTION B (7 X 2 =14) Marks
22. A mutable object can be updated whereas an immutable object cannot be
updated.
Mutable object: [1,2] or {1:1,2:2} (Any one)
(2)
Immutable object: (1,2) or ‘123’ (Any one)
(1 mark for correct difference)
(½ x 2 = 1 Mark for selecting correct objects)
23. (I) Arithmetic operators: +,-
(II) Relational operators: >, >= (2)
(½ x 4 = 2 Marks for each correct operator)
24. (I)
A) L1.count(4)
OR
B) L1.sort()
(2)
A) L1.extend(L2)
Page: 2/11
Page 4
OR
B) L2.reverse()
25. (A), (C)
(½ x 2 = 1 Mark)
(2)
Minimum and maximum possible values of the variable b: 1,6
(½ x 2 = 1 Mark)
26. Table: Student
ADMN RollNo Name PhoneNo
124 1 Chavi 989899
235 2 Arpita 931124
276 3 Chavi 972457 (2)
Primary key: ADMN
Alternate keys: RollNo, PhoneNo
Total Candidate keys: 3
(1 mark for the correct table)
(1 mark for number of candidate keys)
27. (I)
A) UNIQUE
OR
B) NOT NULL
(2)
A) ALTER TABLE MOBILE DROP PRIMARY KEY;
OR
B) ALTER TABLE MOBILE ADD PRIMARY KEY (M_ID);
28. A) Advantage: Network extension is easy.
Disadvantage: Failure of switch/hub results in failure of the network.
(1 mark for correct Advantage)
(2)
(1 mark for correct Disadvantage)
OR
B) SMTP: Simple Mail Transfer Protocol.
Page: 3/11
Page 5
SMTP is used for sending e-mails from client to server.
(1 mark for correct expansion)
(1 mark for correct usage)
Q No. SECTION C (3 X 3 = 9) Marks
29. (A)
def show():
f=open("Email.txt",'r')
data=f.read()
words=data.split()
for word in words:
if '@cmail' in word:
print(word,end=' ')
f.close()
(½ mark for correct function header)
(½ mark for correctly opening the file)
(½ mark for correctly reading from the file)
(½ mark for splitting the text into words)
(1 mark for correctly displaying the desired words)
(3)
OR
(B)
def display_long_words():
with open("Words.txt", 'r') as file:
data=file.read()
words=data.split()
for word in words:
if len(word)>5:
print(word,end=' ')
(½ mark for correct function header)
(½ mark for correctly opening the file)
(½ mark for correctly reading from the file)
( ½ mark for splitting the text into words)
(1 mark for correctly displaying the desired words)
Page: 4/11
Page 6
30. (A)
(I)
def push_book(BooksStack, new_book):
BooksStack.append(new_book)
def pop_book(BooksStack):
if not BooksStack:
print("Underflow")
else:
return(BookStack.pop())
(III)
def peep(BooksStack):
if not BooksStack:
print("None")
else:
print(BookStack[-1])
(3x1 mark for correct function body; No marks for any function header as it
was a part of the question) (3)
OR
(B)
n=int(input("Enter an integer: "))
s=[] #stack
f=2
while n>1:
if n%f==0:
s.append(f)
n//=f
else: f+=1
while s:
print(s.pop(),end=' ')
(½ mark for correct input)
(½ mark for correctly declaring an empty stack)
(1 mark for correctly pushing the factors on the stack)
(1 mark for correctly popping and displaying the factors)
31. (A)
(I) select Product, sum(Quantity) from orders
group by product having sum(Quantity)>=5;
(3)
(II) select * from orders order by Price desc;
(III) select distinct C_Name from orders;
(3x 1 mark for each correct query)
Page: 5/11
Page 7
OR
(B)
(I) select quantity, count(*) from orders group by quantity;
(II) delete from orders where product = "Laptop";
(III) select sum(price) from orders where quantity is null;
(3x 1 mark for each correct query)
Q No. SECTION D (4 X 4 = 16) Marks
32. (A)
(I) ZeroDivisionError is raised when a statement tries to divide a number
by zero. (1 Mark for correct answer)
try:
a=int(input("Enter an integer: "))
print("Reciprocal of the number =",1/a)
except ZeroDivisionError:
print("Division by Zero is not allowed")
except:
print("Some Error Ocurred")
(3x 1 mark for each correct part – try, except, except)
OR (4)
(B)
(I) NameError is raised when an undefined identifier is used in the program.
(1 Mark for correct answer)
try:
a=eval(input("Enter an integer: "))
print("Reciprocal of the number =",1/a)
except NameError:
print("Some name is not defined")
except:
print("Some Error Ocurred")
(3x1 Mark for each correct part – try, except, except)
33. (I)
def show():
import csv
f=open("happiness.csv",'r')
records=csv.reader(f) (4)
next(records, None) #To skip the Header row
for i in records:
if int(i[1])>5000000:
print(i)
Page: 6/11
Page 8
f.close()
(½ mark for opening in the file in right mode)
(½ mark for correctly creating the reader object)
(½ mark for correctly checking the condition)
(½ mark for correctly displaying the records)
def Count_records():
import csv
f=open("happiness.csv",'r')
records=csv.reader(f)
next(records, None) #To skip the Header row
count=0
for i in records:
count+=1
print(count)
f.close()
(½ mark for opening in the file in right mode)
(½ mark for correctly creating the reader object)
(½ mark for correct use of counter)
(½ mark for correctly displaying the counter)
Note (for both parts (I) and (II)):
(i) Ignore import csv as it may be considered the part of the
complete program, and there is no need to import it in individual
functions.
(ii) Ignore next(records, None) as the file may or may not have the
Header Row.
34. (I) Select * from FACULTY natural join COURSES where Salary<12000;
(II) Select * from courses where fees between 20000 and 50000;
(III) Update courses set fees=fees+500 where CName like
'%Computer%';
(IV) (A) Select FName, LName from faculty natural join courses where (4)
Came="System Design";
OR
(B) Select * from FACULTY, COURSES;
(4x1 mark for each correct query)
35. def Add_Item():
import mysql.connector as mycon
mydb=mycon.connect(host="localhost",user="root",
passwd="Pencil",database="ITEMDB")
mycur=mydb.cursor()
(4)
no=input("Enter Item Number: ")
nm=input("Enter Item Name: ")
pr=input("Enter price: ")
qty=input("Enter qty: ")
query="INSERT INTO stationery VALUES ({},'{}',{},{})"
Page: 7/11
Page 9
query=query.format(no,nm,pr,qty)
mycur.execute(query)
mydb.commit()
mycur.execute("select * from stationery where price>120")
for rec in mycur:
print(rec)
(½ mark for correctly importing the connector object)
(½ mark for correctly creating the connection object)
(½ mark for correctly creating the cursor object)
(½ mark for correctly inputting the data)
(½ mark for correct creation of first query)
(½ mark for correctly executing the first query with commit)
(½ mark for correctly executing the second query)
(½ mark for correctly displaying the data)
Q No. SECTION E (2 X 5 = 10) Marks
36. Note: For part (I), the student can mention any type of file with valid reason to (5)
support the choice. Answer with valid supporting reason should be considered
Correct, and without a valid reason should be considered incorrect.
(I) Text file: A text file allows for easy maintenance of data, as it can be
opened and manipulated with any text editor also.
def append():
with open("Candidates.txt",'a') as f:
C_id=input("Enter Candidate ID: ")
C_nm=input("Enter Candidate name: ")
C_dg=input("Enter Designation: ")
C_ex=input("Enter Experience: ")
rec=C_id+','+C_nm+','+C_dg+','+C_ex+'\n'
f.write(rec)
(½ mark for opening in the file in right mode)
(½ mark for correctly inputting the data)
(½ mark for correctly writing the record in the file)
(½ mark for correctly closing the file, or ½ mark if the file was opened using
with)
def display():
with open("Candidates.txt") as f:
for rec in f:
data=rec.split(',')
if float(data[-1])>10:
Page: 8/11
Page 10
print(rec.strip()) #OR print(rec)
(½ mark for opening the file in right mode)
(½ mark for correctly reading the data)
(½ mark for correctly checking the condition)
(½ mark for correctly displaying the records)
OR
(I) CSV File: A CSV file allows for easy maintenance of data, as it can be
opened and manipulated with any spreadsheet application also.
def append():
with open("Candidates.csv",'a',newline='') as f:
C_id=input("Enter Candidate ID: ")
C_nm=input("Enter Candidate name: ")
C_dg=input("Enter Designation: ")
C_ex=input("Enter Experience: ")
rec=[C_id,C_nm,C_dg,C_ex]
w=csv.writer(f)
w.writerow(rec)
(½ mark for opening in the file in right mode)
(½ mark for correctly inputting the data)
(½ mark for correctly writing the record in the file)
(½ mark for correctly closing the file, or ½ mark if the file was opened using
with)
(III)
def display():
with open("Candidates.csv") as f:
r=csv.reader(f)
for rec in r:
if float(rec[-1])>10:
print(rec)
(½ mark for opening the file in right mode)
(½ mark for correctly reading the data)
(½ mark for correctly checking the condition)
(½ mark for correctly displaying the records)
OR
(I) Binary File: A binary file cannot be opened and manipulated with any
general purpose application, and hence, it prevents any unintentional
change in the data.
def append():
Page: 9/11
Page 11
with open("Candidates.dat",'ab') as f:
C_id=int(input("Enter Candidate ID: "))
C_nm=input("Enter Candidate name: ")
C_dg=input("Enter Designation: ")
C_ex=float(input("Enter Experience: "))
rec=[C_id,C_nm,C_dg,C_ex]
pickle.dump(rec,f)
(½ mark for opening in the file in right mode)
(½ mark for correctly inputting the data)
(½ mark for correctly writing the record in the file)
(½ mark for correctly closing the file, or ½ mark if the file was opened using
with)
(III)
def display():
with open("Candidates.dat",'rb') as f:
while True:
try:
rec=pickle.load(f)
if rec[-1]>10:
print(rec)
except EOFError:
break
(½ mark for opening the file in right mode)
(½ mark for correctly reading the data)
(½ mark for correctly checking the condition)
(½ mark for correctly displaying the records)
37. (I) MEDIA Block as it has the maximum number of Computers. (5)
OR
ADMIN Block as ADMIN block is generally the most secure.
(II) Switch
(III)
Page: 10/11
Page 12
(or Any other correct layout)
Cable: Optical Fibre
(½ mark for correct layout + ½ mark for correct table type)
(IV) There is no requirement of the Repeat as the optical fibre cable used for
the network can carry the data to much longer distances than within the
campus.
(V) (A) a) Video Conferencing
OR
(B) LAN
Page: 11/11
Page 13
CBSE STUDY MATERIAL
CBSE Board
INFORMATION CLASS STUDY MATERIAL
1 Time Table 09 Sample Paper
10 Sample Paper
2 Result
11 Sample Paper
3 Syllabus 12 Sample Paper
OTHER RESOURCES
09 Question Paper
Maps of India, Maps of World
Writing Skill Formats 10 Question Paper
Periodic Table 11 Question Paper
12 Question Paper
Class 9 Notes
Class 10 Notes
NCERT Book
Class 11 Notes
Class 12 Notes NCERT Solutions
ENTRANCE EXAMS
JEE Main CLAT CUET UG
JEE Advanced NEET UG Fashion & Design