Page 1
FOR CBSE CLASS 12 PREPARATION
CBSE Class 12 Sample
Paper 2027 Solution
(Marking Scheme) for
Computer Science
EXAM YEAR TYPE SUBJECT
CBSE Class 12 2027 Solutions Computer Science
Notes · Sample Papers · Previous Year Papers · Mock Tests
Page 2
m
m .co
m .co s em
se g la
a PAPER
MARKING SCHEME: SAMPLE QUESTION
Class XII Session 2026-27
COMPUTER SCIENCE (Code 083)
TIME: 3 hours MAX. MARKS: 70
General Instructions:
This question paper contains 37 questions.
All questions are compulsory. However, internal choices have been provided in some
m
m .co
questions. Attempt only one of the choices in such questions
.co m
The paper is divided into 5 Sections- A, B, C, D and E.
s e
em
Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
s
Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
g l a
l a
Section C consists of 3 questions (29 to 31). Each question carries 3 Marks. a
ag
Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
All programming questions are to be answered using Python Language only.
Q No. Section-A (21 x 1 = 21 Marks) Marks
om
1 Answer: 1
. c
[10, 15, 20, 25, 30]
e m
2
(1 mark for correct answer)
Answer:
las 1
ag
a) ['progra', '', 'ing is a', 'azing']
(1 mark for correct answer)
3 Answer: 1
d) List
(1 mark for correct answer)
4 Answer: 1
m
m .co
c) Foreign key
5 .c
o (1 mark for correct answer)
e m
em
Answer:
l as 1
l as c) Error, because a tuple cannot be concatenated with a listag
ag 6
(1 mark for correct answer)
Answer: 1
b) Scrabble@@Sudoku@@Tic-Tac-Toe@@
(1 mark for correct answer)
7 Answer: 1
a) False
(1 mark for correct answer)
m .
.co
s e m
s em l a
ag
pg. 1
g la
a For more Question Papers, Sample Papers, Notes & Syllabus visit Page 1 of 10
Page 3
8 Answer: 1
c) Radio waves
(1 mark for correct answer)
9 Answer: 1
c) SELECT * FROM Employees WHERE salary BETWEEN 90000 AND 100000;
(1 mark for correct answer)
10 Answer: 1
45.0
(1 mark for correct answer)
11 Answer: 1
b) int
(1 mark for correct answer)
12 Answer: 1
c) Physical (MAC) address
(1 mark for correct answer)
13 Answer: 1
a) Domain
(1 mark for correct answer)
14 Answer: 1
Num was 29
(1 mark for correct answer)
15 Answer: 1
b) Degree
(1 mark for correct answer)
16 Answer: 1
c) Error
(1 mark for correct answer)
17 Answer: 1
c) Circuit
(1 mark for correct answer)
18 Answer: 1
peD
(1 mark for correct answer)
19 Answer: 1
a) ALTER TABLE Student DROP COLUMN Age;
(1 mark for correct answer)
pg. 2
For more Question Papers, Sample Papers, Notes & Syllabus visit Page 2 of 10
Page 4
m
m .co
m .co s e m
se g l a
20 Answer: a 1
c) A is true, but R is false
(1 mark for correct answer)
21 Answer: 1
c) A is true, but R is false
(1 mark for correct answer)
m
m Section-B ( 7 x 2=14 Marks)
.co
.co s em
em
22 Answer: 2
s
A. Global variable: Defined outside a function; accessible anywhere in the
g l a
l a
program. a
ag
x = 10 # global
print(x)
Local variable: Defined inside a function; accessible only inside that function.
def demo():
y = 5 # local
print(y)
OR
m
B. tell(): Returns the current position of the file pointer in the file.
f = open("file.txt", "r") .co
print(f.tell()) # e.g.,0
s em
seek(offset): Moves the file g la to a specified position in the file.
f.seek(5) # moves pointerato 5th byte
pointer
(1 mark for correct difference)
(1/2 mark for each correct example)
23 Answer: 2
words=["Class Test","Term Exams","Pre-board Exam","Board Exam"]
L=len(words)
for i in range(L-1, -1, -1):
print (words[i] , end = " ")
m
.co
(1⁄2 mark each for correcting 4 mistakes)
m
.co em
24 Answer: 2
em
A.
l as
las def capitalize_words(words): #words is a list of strings
ag
g
result = [ ]
a for w in words:
result.append(w.capitalize())
print(result)
OR
B.
def sum_positive(list1): #list1 is a list of numbers
total = 0
for num in list1:
m .
if num > 0:
.co
s e m
s em l a
ag
pg. 3
g la
a For more Question Papers, Sample Papers, Notes & Syllabus visit Page 3 of 10
Page 5
total += num
print(total)
(1/2 mark for function definition)
(1 mark for the correct/similar logic)
(1/2 mark for correct print statement)
25 Answer: 2
A.
I. username.startswith("admin") (1 mark for correct answer)
II. data.count(max(data)) (1 mark for correct answer)
OR
B.
Pyth0n Pr0gramming (1 mark for correct answer)
-1 (1 mark for correct answer)
26 Answer: 2
['#', 'l', '#', 'd', 10]
(2 marks for the correct output)
27 Answer: 2
A. I. Show tables; (1 mark for correct answer)
II. Drop database CS_SP; (1 mark for correct answer)
OR
B.
ALTER UPDATE
Used to change the structure of a table. It
Used to modify the data stored in the
adds, deletes or modifies columns or
table. It changes the values in rows.
constraints.
Ex: UPDATE Employee SET salary =
Ex: ALTER TABLE Employee ADD age INT;
50000 WHERE emp_id = 10;
(1 mark for correct answer)
(1/2 mark for each correct example)
C.
28 Answer: 2
A. HTTP (Hyper Text Transfer Protocol) helps us browse web pages using internet
browsers.
Name of any one internet browser can be Chrome / Firefox / Edge / Safari / Opera.
(1 mark for correct definition)
(1 mark for any one browser name)
OR
B. Tree topology is a network topology that combines characteristics of bus and star
topologies, where groups of star-configured computers are connected to a central bus
backbone.
Limitations: Failure of the main backbone cable can bring down the entire network. It
is expensive because it requires a lot of cable and network devices.
(1 mark for correct definition)
(1 mark for any one limitation)
pg. 4
For more Question Papers, Sample Papers, Notes & Syllabus visit Page 4 of 10
Page 6
m
m .co
m .co s e m
se g l a
a
Section-C ( 3 x 3 = 9 Marks)
29 Answer: 3
A. def DisplayYearLines( ):
f = open("History.txt", "r")
for line in f:
words = line.split()
for w in words:
m
m .co
if w.isdigit() and len(w) == 4:
.co m
print(line)
s e
em
break
s
f.close()
g l a
l a
DisplayYearLines( )
a
ag
(1/2 mark for correct function header)
(1/2 mark for correctly opening the file)
(11/2 mark for correct/similar logic for displaying the desired lines)
(1/2 mark for correctly calling the function)
OR
B. def count_python():
count = 0
with open("Prog.txt", 'r') as file:
m
.co
text = file.read()
words = text.split()
e m
s
for word in words:
if word.lower() == "python":
g la
count += 1
a
print("The word Python appears", count, "times.")
(1/2 mark for correct function header)
(1/2 mark for correctly opening the file)
(1/2 mark for correctly reading from the file)
(1/2 mark for splitting the text into words)
(1/2 mark for correct use of counter variable)
(1/2 mark for displaying the result)
30 Answer: 3
m
.co
I.
m
.co m
B = [("Machine Learning Basics", 550),("World Geography", 450),("Wonder World",
m
140),("AI Revolution", 750)]
s e
s e Books = [ ]
g l a
g la def Push_element():
a
a for item in B:
if item[1] > 250:
Books.append(item)
II.
def Pop_element():
while Books:
print(Books.pop())
print("Stack Empty")
(1½ marks for each correct part)
m .
.co
s e m
s em l a
ag
pg. 5
g la
a For more Question Papers, Sample Papers, Notes & Syllabus visit Page 5 of 10
Page 7
31 Answer: 3
A.
def avg_len(words):
total = 0
count = 0
for w in words:
total += len(w)
count += 1
return total / count
my_words = ["computer", "science", "python", "data"]
print("Average word length:", avg_len(my_words))
OR
B.
pairs = ((2,5), (4,2), (9,8), (12,10))
def cnt_even(t):
c=0
for a, b in t:
if a % 2 == 0 and b % 2 == 0:
c += 1
return c
print("Number of even-even pairs:", cnt_even(pairs))
(1/2 mark for function definition)
(2 marks for the correct/similar logic)
(1/2 mark to print/return statement)
Section-D ( 4 x 4 = 16 Marks)
32 Answer: 4
A.
I. select event_name, count(*) as total_participants from tech_event_reg group by
event_name having count(*) > 1;
II. select distinct event_name from tech_event_reg;
III. select * from tech_event_reg where participant_name like '%an%';
IV. select * from tech_event_reg order by participant_name desc;
(4 x 1 mark for each correct query)
OR
B.
I.
pg. 6
For more Question Papers, Sample Papers, Notes & Syllabus visit Page 6 of 10
Page 8
m
m .co
m .co s e m
se g l a
a II.
m
m .co
.co s em
s em g l a
g l a a
III. a
m
IV.
m .co
s e
g la
a
(4 x 1 mark for each correct query output)
33 Answer: 4
import csv
m
.co
def AddRental():
m Vehicle_ID = input("Enter Vehicle ID: ")
m .co Vehicle_Type = input("Enter Vehicle Type: ")
s e m
s e
Hours_Rented = input("Enter Hours Rented: ")
g l a
la
Rate_Per_Hour = input("Enter Rate Per Hour: ")
g with open("Rentals.csv", "a") as f: a
a w = csv.writer(f)
w.writerow([Vehicle_ID, Vehicle_Type, Hours_Rented, Rate_Per_Hour])
print("Rental record added successfully.")
(1⁄2 mark for correctly taking user input)
(1⁄2 mark for opening the file in append mode)
(1⁄2 mark for correctly creating the writer object)
(1⁄2 mark for correctly using writerow() of writer object)
def CalculateTotalRent():
m .
.co
s e m
s em l a
ag
pg. 7
g la
a For more Question Papers, Sample Papers, Notes & Syllabus visit Page 7 of 10
Page 9
total = 0
f = open("Rentals.csv", "r")
r = csv.reader(f)
for row in r:
hours = int(row[2])
rate = int(row[3])
total += hours * rate
print("Total Rent Earned:", total)
f.close()
(1⁄2 mark for opening in the file in right mode)
(1⁄2 mark for correctly creating the reader object)
(1⁄2 mark for correc calculation by converting it into integers)
(1⁄2 mark for correctly displaying the total rent earned)
Note (for both parts (I) and (II)):
Ignore import csv as it may be considered the part of the complete program.
34 Answer: 4
I. UPDATE CHESS_EVENTS SET Venue = 'Multi-Purpose Hall' WHERE
Event_Name = 'Inter-School Chess Championship';
II. SELECT * FROM CHESS_EVENTS WHERE Event_Date > '2025-01-01';
III. SELECT * FROM REGISTRATIONS R JOIN CHESS_EVENTS C ON
R.Event_ID = C.Event_ID WHERE C.Venue IN ('Auditorium Hall', 'Activity
Room 3', 'Library Conference Area');
IV. A. SELECT R.Student_Name, C.Event_Name FROM REGISTRATIONS R
JOIN CHESS_EVENTS C ON R.Event_ID = C.Event_ID;
OR
B. SELECT * FROM CHESS_EVENTS, REGISTRATIONS;
(4 x 1 mark for each correct query)
35 Answer: 4
import mysql.connector
con=mysql.connector.connect(host="localhost",user="librarian",password="lib@2025",
database="LibraryDB")
cur = con.cursor()
q = "UPDATE book_records SET Book_Title='Data Structures in Python' WHERE
Book_ID=109"
cur.execute(q)
con.commit()
print("Book title updated successfully.")
cur.close()
con.close()
(1⁄2 mark for correctly importing the connector object)
(1⁄2 mark for correctly creating the connection object)
(1⁄2 mark for correctly creating the cursor object)
(1 mark for correct creation of update query)
(1 mark for correctly executing the query with commit)
(1⁄2 mark for correctly closing the connection)
pg. 8
For more Question Papers, Sample Papers, Notes & Syllabus visit Page 8 of 10
Page 10
m
m .co
m .co s e m
se g l a
a
Section-E (2 X 5 = 10 Marks)
36 Answer: 2+3
I.
def AddEnrollment():
Roll = int(input("Enter Roll No: "))
Name = input("Enter Student Name: ")
Course = input("Enter Course: ")
m
m .co
Fees = int(input("Enter Fees: "))
.co m
rec = [Roll, Name, Course, Fees] # LIST record
s e
em
with open("Enrollments.dat", "ab") as f:
s
pickle.dump(rec, f)
g l a
l a
print("Record added successfully.")
a
ag
(1/2 mark for correctly defining the function header)
(1/2 mark for correctly opening the file in append mode)
(1/2 mark for correctly taking user input)
(1/2 mark for using dump() method of the pickle module)
II.
import pickle
def UpdateFees():
updated = False
m
.co
records = []
with open("Enrollments.dat", "rb") as file:
e m
s
try:
while True:
g la
rec = pickle.load(file)
a
if rec[2] == "Data Science": # Course at index 2
rec[3] = 75000 # Fees at index 3
updated = True
records.append(rec)
except EOFError:
pass
with open("Enrollments.dat", "wb") as file:
for rec in records:
m
.co
pickle.dump(rec, file)
m
.co
if updated:
print("Fees updated for Data Science students.")
e m
e m else:
l as
las print("No student enrolled in Data Science found.")
ag
ag (1/2 mark for correctly defining the function header)
(1/2 mark for correctly opening the file)
(1 mark for using load() with while loop and try-except block)
(1 mark for checking the condition and updating the value)
Note (for both parts (I) and (II)):
Ignore import pickle as it may be considered the part of the complete program.
37 Answer: 5
I. HR Centre as it has maximum number of computers.
m .
.co
s e m
s em l a
ag
pg. 9
g la
a For more Question Papers, Sample Papers, Notes & Syllabus visit Page 9 of 10
Page 11
II. Star Topology
III. a. Repeater is to be placed between HR Center to Law Block and from HR
Center to Business Block as distance between them is more than 100 meters.
b. Switch is to be placed in all the block as network is to be formed in each
and every block.
IV. Optical Fibre
V. A. VOIP (Voice Over Internet Protocol)
OR
B. Voice over Internet Protocol (VoIP) is a technology that allows users to
make phone calls and other communications over the Internet instead of a
traditional phone line.
(5 x 1 mark for each correct part)
pg. 10
For more Question Papers, Sample Papers, Notes & Syllabus visit Page 10 of 10