Topics Covered
CBSE Class 12 Computer Science Sample Paper for 2024-25
The CBSE Class 12 Computer Science Sample Paper for 2024-25 is now available, and it’s time for students to kick-start their exam preparation with this essential resource. CBSE releases sample papers every year to give students an understanding of the exam pattern, types of questions, and the marking scheme. The Computer Science sample paper is a vital tool for students aiming to excel in their board exams.
In this blog, we’ll break down the CBSE Class 12 Computer Science Sample Paper for 2024-25, cover the latest exam pattern, tips for preparation, and how to make the best use of this paper to score high marks.
Why is the CBSE Class 12 Computer Science Sample Paper for 2024-25 Important?
The CBSE 2024-25 sample paper for Computer Science helps students familiarize themselves with:
- Exam Pattern: Understanding how questions are structured across different sections.
- Type of Questions: Identifying important concepts and topics that carry weight.
- Time Management: Practicing under timed conditions helps develop exam discipline.
By solving the sample paper, students can assess their knowledge, identify weak areas, and improve their accuracy and speed before the final exam.
CBSE Class 12 Computer Science Exam Pattern 2024-25
For the 2024-25 session, the CBSE Computer Science exam will follow a well-structured format. Here’s an overview:
| Total Marks | 70 |
| Duration | 3 Hours |
| Total Questions | 37 |
| Total Sections | 5 (A,B,C,D,E) |
| Section A | 21 Questions of 1 Mark (MCQs, True or False, 1 word answers, 1 line answers) |
| Section B | 7 Questions of 2 Marks (Short Answer Questions) |
| Section C | 3 Questions of 3 Marks (Short Answer Questions) |
| Section D | 4 Questions of 4 Marks (Competency Based Questions) |
| Section E | 2 Questions of 5 Marks (Long Answer Questions) |
Sample Paper Analysis Question Wise
The chapters given below are taken from the Textbook of Sumita Arora Computer Science with Python Class 12.
Chapter wise weightage and Blue print
Section A – CBSE Class 12 Computer Science Sample Paper for 2024-25
[1] State True or False: The Python interpreter handles logical errors during code execution.
Ans.:False
The python interpreter not handle any logical error during code execution. Logical errors generates an incorrect output or inappropriate output as logical errors are mistakes committed by the programmers in code.
[2] Identify the output of the following code snippet:
text = "PYTHONPROGRAM"
text=text.replace('PY','#')
print(text)
(A) #THONPROGRAM
(B) ##THON#ROGRAM
(C) #THON#ROGRAM
(D) #YTHON#ROGRAM
Ans.: (A) #THONPROGRAM
The replace method ‘PY’ with ‘#’. The word PYTHONPROGRAM contains PY once and # will be replaced with that.
[3] Which of the following expressions evaluates to False?
(A) not(True) and False
(B) True or False
(C) not(False and True)
(D) True and not(False)
Ans.: (A) not(True) and False
(A) not(True) and False
not(True) – False
False and False returns False
(B) True or False – True , as the OR operator returns True if any one operand is True.
(C) not (False and True)
False and True – False
not False – True
(D) True and not(False)
not False – True
True and True – True
[4] What is the output of the expression?
str='International'
print(str.split("n"))
(A) (‘I’, ‘ter’, ‘atio’, ‘al’)
(B) [‘I’, ‘ter’, ‘atio’, ‘al’]
(C) [‘I’, ‘n’, ‘ter’, ‘n’, ‘atio’, ‘n’, ‘al’]
(D) Error
Ans.: (B) [‘I’, ‘ter’, ‘atio’, ‘al’]
The split method will split the word from the specified word or letter and returns a list of remaining words.
[5] What will be the output of the following code snippet?
str= "World Peace"
print(str[-2::-2])
Ans.: ce lo
-2 in starting position will start the slicing from second last character of string. Here the second last character is ‘c’, and the stop value is not specified, and step value is -2 so the slicing moves 2 steps from right side. So after ‘c’ it will moves to ‘e’ then space then ‘l’ then ‘o’. Hence output is ‘ce lo’.
[6] What will be the output of the following code?
tuple1 = (1, 2, 3)
tuple2 = tuple1
tuple1 += (4,)
print(tuple1 == tuple2)
(A) True
(B) False
(C) tuple1
(D) Error
Ans.: (B) False
Here
tuple2 = tuple1 is given so tuple1 is copies into tuple2. Hence tuple2=(1,2,3)
tuple1+=(4) changes into tuple1, Hence tuple1=(1,2,3,4)
Now tuple1==tuple2 which are not similar. So output is False.
[7] If my_dict is a dictionary as defined below, then which of the following statements will raise an exception?
my_dict = {‘apple’: 10, ‘banana’: 20, ‘orange’: 30}
(A) my_dict.get(‘orange’)
(B) print(my_dict[‘apple’, ‘banana’])
(C) my_dict[‘apple’]=20
(D) print(str(my_dict))
Ans.: (B) print(my_dict[‘apple’,’banana’])
(A) my_dict.get(‘orange’) will return the value of orange i.e. 30
(B) Dictionary will never access multiple keys and raise KeyError exception.
(C) This statement will change the value apple to 20
(D) This statement will print dictionary as a string.
[8] What does the list.remove(x) method do in Python?
(A) Removes the element at index x from the list
(B) Removes the first occurrence of value x from the list
(C) Removes all occurrences of value x from the list
(D) Removes the last occurrence of value x from the list
Ans.: (B) Removes the first occurrence of value x from the list
(A), (C) and (D) are not relevant
[9] Which of the following statements will cause an error?
(A) t=1,
(B) t=(1,)
(C) t=(1)
(D) t=tuple(1)
Ans.: (D) t=tuple(1)
(A) t=1, and (B) t = (1,) initialize a tuple with a single element 1
(C) t=(1) initialize t as an integer
[10] Write the missing statement to complete the following code:
file = open("example.txt", "r")
data = file.read(100)
____________________ #Move the file pointer to the beginning of the file
next_data = file.read(50)
file.close()
Ans.: file.seek(0) or file.seek(0,0)
To understand this concept, watch this video:
[11] State whether the following statement is True or False: “The finally block in Python is executed only if no exception occurs in the try block.”
Ans.: False
The finally clause always executes at the end.
[12] What will be the output of the following code?
c = 10
def add():
global c
c = c + 2
print(c,end='#')
add()
c=15
print(c,end='%')
(A) 12%15#
(B) 15#12%
(C) 12#15%
(D) 12%15#
Ans.: (C) 12#15%
c=10
In add() function c changes the value as declared as global variable, c=c+2=12.
The print() function prints 12#.
Now c=15 initialize the c as 15. Hence print() function accepts value as 15, and prints 15%.
Hence option (C) 12#15% is correct output.
[13] Which SQL command can change the degree of an existing relation?
Ans.: Alter table command
The degree of relations refers to no. of columns present in the relation.
The alter table command is used to add or remove column from the table.
[14] What will be the output of the query?
SELECT * FROM products WHERE product_name LIKE ‘App%’;
(A) Details of all products whose names start with ‘App’
(B) Details of all products whose names end with ‘App’
(C) Names of all products whose names start with ‘App’
(D) Names of all products whose names end with ‘App’
Ans.: (A) Details of all products whose names start with ‘App’
(B) To print all products whose names end with ‘App’ where condition requires product_name like ‘%App’
(C) and (D) For Names of all products requires name column in select clause
[15] In which datatype the value stored is padded with spaces to fit the specified length.
(A) DATE
(B) VARCHAR
(C) FLOAT
(D) CHAR
Ans.: (D) CHAR
(D) The DATE datatype stores the date values and its almost fixed for all values
(B) The VARCHAR data type occupies the length of values used in the field
(C) The FLOAT data type store the fractional values
[16] Which aggregate function can be used to find the cardinality of a table?
(A) sum()
(B) count()
(C) avg()
(D) max()
Ans.: (B) count()
Cardinality refers to no. of tuples or rows of table. Here the count(*) function will return number of rows present in the relation.
(A) sum() functions returns the sum of field values.
(C) avg() returns average of field values.
(D) max() returns maximum values from selected field values
[17] Which protocol is used to transfer files over the Internet?
(A) HTTP
(B) FTP
(C) PPP
(D) HTTPS
Ans.: (B) FTP
FTP stands for File Transfer Protocol
(A) HTTTP protocol is used to exchange data over the web
(C) PPP allows two routers to connect directly without any host or other networking in between.
(D) HTTPS secured version of HTTP
[18] Which network device is used to connect two networks that use different protocols?
(A) Modem
(B) Gateway
(C) Switch
(D) Repeater
Ans.: (B) Gateway
(A) Modem is used to convert analog signals to digital signals
(C) Switch two or more IT devices, such as computers, to communicate with one another
(D) Repeater is used to amplify and generate the incoming signal
[19] Which switching technique breaks data into smaller packets for transmission, allowing multiple packets to share the same network resources?
Ans.: (B) Packet Switching
– Circuit switching technique establishes a dedicated path between sender and receiver
– Message switching transfers a message as a whole unit and routed through intermediate node at which it is stored and forwarded
Q20 and Q21 are Assertion(A) and Reason(R) based questions. Mark the correct choice as:
(A) Both A and R are true and R is the correct explanation for A
(B) Both A and R are true and R is not the correct explanation for A
(C) A is True but R is False
(D) A is False but R is True
[20] Assertion (A): In the case of positional arguments, the function call and function definition statements match in terms of the number and order of arguments.
Reasoning (R): During a function call, positional arguments should precede keyword arguments in the argument list.
Ans.: (B) Both A and R are true and R is not the correct explanation for A
Positional arguments order must be followed where in keyword arguments order doesn’t matter
[21] Assertion (A): A SELECT command in SQL can have both WHERE and HAVING clauses.
Reasoning (R): WHERE and HAVING clauses are used to check conditions, therefore, these can be used interchangeably.
Ans.: (C) A is True, R is false
Where is used with select clause and having is used with group by clause.
Watch this vide for difference between where and having for more clarity:
Watch this video to understand the MCQs with explanation:
Section B – CBSE Class 12 Computer Science Sample Paper for 2024-25
[22] How is a mutable object different from an immutable object in Python? Identify one mutable object and one immutable object from the following: (1,2), [1,2], {1:1,2:2}, ‘123’
The python objects which can be changed or modified or updated in place are called mutable objects. The value of mutable objects can be modified easily. Lists, dictionaries are mutable.
Immutable objects cannot be changed or modified or updated in the program. Strings and tuples are immutable.
Mutable objects: [1,2], {1:1,2:2} (Any One)
Immutable objects: (1,2), ‘123’(Any One)
1 mark for difference , 1/2 marks for each identification of objects.
[23] Give two examples of each of the following:
(I) Arithmetic operators
(II) Relational operators
Arithmetic Operators: +, -, *, ., **, //, %
Example:
a=5
b=6
c=a + b
Relational Operators: <,<=,>,>=,==,!=
Example:
a=5
b=5
print(a==b)
1/2 mark for each correct operator
[24] If L1=[1,2,3,2,1,2,4,2, . . . ], and L2=[10,20,30, . . .], then
(I) A) Write a statement to count the occurrences of 4 in L1.
Using Count Function – L1.count(4)
Using Logic:
c=0
for i in L1:
if i==4:
c+=1
print("Total 4 in List are:", c)
1 mark for correct statement/code
OR
B) Write a statement to sort the elements of list L1 in ascending order.
Using sort function – L1.sort()
Using Sorted function – print(sorted(L1))
Using Code:
for i in range(len(L1)):
for j in range(0, len(L1) - i - 1):
if L1[j] > L1[j + 1]:
L1[j], L1[j + 1] = L1[j + 1], L1[j]
print("Sorted list:",L1)
1 mark for correct statement/code
(II) A) Write a statement to insert all the elements of L2 at the end of L1.
Using extend function: L1.extend(L2)
Using logic:
L1=L1+L2
print("Sorted list:",L1)
1 mark for correct statement/code
OR
B) Write a statement to reverse the elements of list L2.
Using reverse function: L2.reverse()
Using slicing: L2[::-1]
Using Code:
(1)
temp = []
while L2:
temp.append(L2.pop())
L2[:] = temp
print(L2)
(2)
i = 0
j = -1
for x in L2:
j+=1
while i
(3)
temp = []
for i in L2:
temp.insert(0, i)
1 mark for correct statement/code
[25] Identify the correct output(s) of the following code. Also write the minimum and the maximum possible values of the variable b.
import random
a="Wisdom"
b=random.randint(1,6)
for i in range(0,b,2):
print(a[i],end='#')
| (A) W# | (B) W#i# |
| (C) W#s# | (D) W#i#s# |
Ans.:
The random.randint() function will generate random number from 1 to 6. Hence b has any value starting from 1 to 5.
In loop the step value is: 2.
Hence the iteration starts as follows:
W>s>o>m
So any output in combination with with above letters are possible. In options there two possibilities:
(A) W# and (C) W#s#
The minimum value of variable b is: 1
The maximum value of variable b is: 6
1/2 marks for each correct output option
1/2 for correct minimum value prediction
1/2 for correct maximum value prediction
[26] Give an example of a table which has one Primary key and two alternate keys. How many Candidate keys will this table have?
Ans.: This table has one Primary key and two alternate keys:
| Empno | Ename | Phone_no | |
| 111 | Ashish Bhatt | 111111111 | a@a.com |
| 112 | Bhargav Patel | 22222222 | b@b.com |
Primary Key - Empno
Alternate Keys - Phone_no, Email
Candidate Keys: 3
Watch this video to understand keys in SQL:
[27]
(I)
A) What constraint should be applied on a table column so that duplicate values are not allowed in that column, but NULL is allowed.
Ans.: Unique Key is used to fulfil the desired condition over here. As it doesn't allow duplicate values but allows NULL at once.
1 mark for constraint name
OR
B) What constraint should be applied on a table column so that NULL is not allowed in that column, but duplicate values are allowed.
Ans.: Not null constraint is used to ignore null values but duplicate values are allowed.
1 mark for constraint name
(II)
A) Write an SQL command to remove the Primary Key constraint from a table, named MOBILE. M_ID is the primary key of the table.
Ans.: Alter table mobile drop primary key;
1 Mark for correct command
OR
B) Write an SQL command to make the column M_ID the Primary Key of an already existing table, named MOBILE.
Ans.: Alter table mobile add primary key (M_ID);
1 mark for correct command
[28] A) List one advantage and one disadvantage of star topology.
Ans.:
Advantage:
1. Easy to set up
2. A device failure doesn't affect the network
3. Prevents data collision between sites
4. Easy to add or remove any device
5. Short cable length
Disadvantage:
1. Central device failure will cause entire network failure
2. Requires more hardware
3. Cables are prone to damage
4. Low data transfer rates
1 mark for any 1 advantage
1 mark for any 1 disadvantage
OR
B) Expand the term SMTP. What is the use of SMTP?
Ans.:
SMTP - Simple Mail Transfer Protocol
It is used to send emails from client to server
Watch this video for practical understanding:
Section C - CBSE Class 12 Computer Science Sample Paper for 2024-25
[29] A) Write a Python function that displays all the words containing @cmail from a text file "Emails.txt".
Ans.:
def check_cmail():
f=open("Email.txt")
dt=f.read()
w=dt.split()
for i in w:
if '@cmail' in i:
print(i,end=' ')
f.close()
check_cmail()
(½ 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)
OR
B) Write a Python function that finds and displays all the words longer than 5 characters from a text file "Words.txt".
Ans.:
def words_gt5():
f=open("Words.txt", 'r')
dt=f.read()
w=dt.split()
for i in w:
if len(i)>5:
print(i,end=' ')
words_gt5()
(½ 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)
[30] (A) You have a stack named BooksStack that contains records of books. Each book record is represented as a list containing book_title, author_name, and publication_year.
Write the following user-defined functions in Python to perform the specified operations on the stack BooksStack:
(I) push_book(BooksStack, new_book): This function takes the stack BooksStack and a new book record new_book as arguments and pushes the new book record onto the stack.
(II) pop_book(BooksStack): This function pops the topmost book record from the stack and returns it. If the stack is already empty, the function should display "Underflow".
(III) peep(BookStack): This function displays the topmost element of the stack without deleting it. If the stack is empty, the function should display 'None'.
Ans.:
def push_book(BookStack, new_book):
BookStack.append(new_book)
def pop_book(BookStack):
if not BookStack:
print("Underflow")
else:
return BookStack.pop()
def peep(BookStack):
if not BookStack:
print("None")
else:
print(BookStack[-1])
while True:
bt=input("Enter Book Title:")
an=input("Enter Author Name:")
year=int(input("Enter Year:"))
lst=[bt,an,year]
x=input("Press X to stop:")
if x=='x':
break
stk=[]
push_book(stk,lst)
print(pop_book(stk))
peep(stk)
(3x1 mark for correct function body; No marks for any function header as it was a part of the question)
OR
B) Write a Python program to input an integer and display all its prime factors in descending order, using a stack. For example, if the input number is 2100, the output should be: 7 5 5 3 2 2 (because prime factorization of 2100 is 7x5x5x3x2x2)
Hint: Smallest factor, other than 1, of any integer is guaranteed to be prime.
Ans.:
n=int(input("Enter an integer: "))
stk=[]
f=2
while n>1:
if n%f==0:
stk.append(f)
n//=f
else:
f+=1
while stk:
print(stk.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] Consider the table ORDERS as given below, and write the following queries:
+------+----------+------------+----------+-------+
| O_Id | C_Name | Product | Quantity | Price |
+------+----------+------------+----------+-------+
| 1001 | Jitendra | Laptop | 1 | 12000 |
| 1002 | Mustafa | Smartphone | 2 | 10000 |
| 1003 | Dhwani | Headphone | 1 | 1500 |
+------+----------+------------+----------+-------+
Note: The table contains many more records than shown here.
A)
(I) To display the total Quantity for each Product, excluding Products with total Quantity less than 5.
(II) To display the orders table sorted by total price in descending order.
(III) To display the distinct customer names from the Orders table.
Ans.:
(I) select Product, sum(Quantity) from orders group by product having sum(Quantity)>=5;
OR
select Product, sum(Quantity) from orders group by product having not sum(Quantity)<=5; (II) select * from orders order by Price desc; (III) select distinct C_Name from orders; (3x 1 mark for each correct query) [/showhide]
OR
(B) (I) To display the total number of orders quantity-wise.
(II) To delete all the orders where the Product is Laptop.
(III) Display the sum of Price of all the orders for which the quantity is null.
Ans.:
(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)
Watch this video for more understanding:
Section D - CBSE Class 12 Computer Science Sample Paper for 2024-25
[32] A)
I. When is ZeroDivisionError exception raised in Python?
II. Give an example code to handle ZeroDivisionError? The code should display the message "Division by Zero is not allowed" in case of ZeroDivisionError exception, and the message "Some error occurred" in case of any other exception.
Ans.:
(I) ZeroDivisionError is raised when anyone tries to divide any number by zero. (1 Mark for correct answer)
(II)
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
B)
I. When is NameError exception raised in Python?
II. Give an example code to handle NameError? The code should display the message "Some name is not defined" in case of NameError exception, and the message "Some error occurred" in case of any other exception.
Ans.:
(I) NameError raised when an object is used before declaration or when a variable is not defined in the program but accessed in a program.
(1 Mark for correct answer)
(II)
try:
#a=int(input("Enter an integer: "))
print("Reciprocal of the number =",1/a)
except NameError:
print("a is not defied")
except:
print("Some Error Ocurred")
(3x1 Mark for each correct part – try, except, except)
[33] A csv file "Happiness.csv" contains the data of a survey. Each record of the file contains the following data:
● Name of a country
● Population of the country
● Sample Size (Number of persons who participated in the survey in that country)
● Happy (Number of persons who accepted that they were Happy)
For example, a sample record of the file may be:
Signiland, 5673000, 5000, 3426
Write the following Python functions to perform the specified operations on this file:
(I) Read all the data from the file and display all those records for which the population is more than 5000000.
(II) Count the number of records in the file.
Ans.:
(I)
def show():
import csv f=open("happiness.csv",'r')
records=csv.reader(f)
next(records, None)
#To skip the Header row
for i in records:
if int(i[1])>5000000:
print(i)
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)
(II)
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] Saman has been entrusted with the management of Law University Database. He needs to access some information from FACULTY and COURSES tables for a survey analysis. Help him extract the following information by writing the desired SQL queries as mentioned below.
Table: FACULTY
| F_ID | FName | LName | Hire_date | Salary |
| 102 | Amit | Mishra | 12-10-1998 | 12000 |
| 103 | Nitin | Vyas | 24-12-1994 | 8000 |
| 104 | Rakshit | Soni | 18-05-2001 | 14000 |
| 105 | Rashmi | Malhotra | 11-09-2004 | 11000 |
| 106 | Sulekha | Srivastava | 5-6-2006 | 10000 |
Table: COURSES
| C_ID | F_ID | CName | Fees |
| C21 | 102 | Grid Computing | 40000 |
| C22 | 106 | System Design | 16000 |
| C23 | 104 | Computer Security | 8000 |
| C24 | 106 | Human Biology | 15000 |
| C25 | 102 | Computer Network | 20000 |
| C26 | 105 | Visual Basic | 6000 |
(I) To display complete details (from both the tables) of those Faculties whose salary is less than 12000.
(II) To display the details of courses whose fees is in the range of 20000 to 50000 (both values included).
(III) To increase the fees of all courses by 500 which have "Computer" in their Course names.
(IV) (A) To display names (FName and LName) of faculty taking System Design.
OR
(B) To display the Cartesian Product of these two tables.
Ans.:
(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 Came="System Design"; OR (B) Select * from FACULTY, COURSES; (4x1 mark for each correct query) [/showhide]
[35] A table, named STATIONERY, in ITEMDB database, has the following structure:
+----------+-------------+
| Field | Type |
+----------+-------------+
| itemNo | int(11) |
| itemName | varchar(15) |
| price | float |
| qty | int(11) |
+----------+-------------+
Write the following Python function to perform the specified operation:
AddAndDisplay(): To input details of an item and store it in the table STATIONERY. The function should then retrieve and display all records from the STATIONERY table where the Price is greater than 120.
Assume the following for Python-Database connectivity:
Host: localhost, User: root, Password: Pencil
Ans.:
def Add_Item():
import mysql.connector as mycon
mydb=mycon.connect(host="localhost",user="root", passwd="Pencil",database="ITEMDB")
mycur=mydb.cursor()
no=input("Enter Item Number: ")
nm=input("Enter Item Name: ")
pr=input("Enter price: ")
qty=input("Enter qty: ")
query="INSERT INTO stationery VALUES ({},'{}',{},{})"
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)
Watch this video for more understanding:
Section E CBSE Class 12 Computer Science Sample paper 2024-25
[36] Surya is a manager working in a recruitment agency. He needs to manage the records of various candidates. For this he wants the following information of each candidate to be stored:
Candidate_ID – integer
Candidate_Name – string
Designation – string
Experience – float
You, as a programmer of the company, have been assigned to do this job for Surya. Suggest:
(I) What type of file (text file, csv file, or binary file) will you use to store this data? Give one valid reason to support your answer.
(II) Write a function to input the data of a candidate and append it in the file that you suggested in part (I) of this question.
(III) Write a function to read the data from the file that you suggested in part (I) of this question and display the data of all those candidates whose experience is more than 10.
Ans.: Note: For part (I), the student can mention any type of file with valid reason to 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.
(1 mark for correct answer)
(II)
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)
(II)
def display():
with open("Candidates.txt") as f:
for rec in f:
data=rec.split(',')
if float(data[-1])>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.
(1 mark for correct answer)
(II)
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.
(1 mark for correct answer)
(II)
def append():
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] Event Horizon Enterprises is an event planning organization. It is planning to set up its India campus in Mumbai with its head office in Delhi. The Mumbai campus will have four blocks/buildings - ADMIN, FOOD, MEDIA, DECORATORS. You, as a network expert, need to suggest the best network-related solutions for them to resolve the issues/problems mentioned in points (I) to (V), keeping in mind the distances between various blocks/buildings and other given parameters.

Block to Block distances (in Mtrs.)
| From | To | Distance |
| ADMIN | FOOD | 42m |
| ADMIN | MEDIA | 96m |
| ADMIN | DECORATORS | 48m |
| FOOD | MEDIA | 58m |
| FOOD | DECORATORS | 46m |
| MEDIA | DECORATORS | 42m |
Distance of Delhi Head Office from Mumbai Campus = 1500 km Number of computers in each of the blocks/Center is as follows:
| ADMIN | 25 |
| FOOD | 18 |
| MEDIA | 30 |
| DECORATORS | 20 |
| DELHI HEAD OFFICE | 18 |
(I) Suggest the most appropriate location of the server inside the MUMBAI campus. Justify your choice.
(II) Which hardware device will you suggest to connect all the computers within each building?
(III) Draw the cable layout to efficiently connect various buildings within the MUMBAI campus. Which cable would you suggest for the most efficient data transfer over the network?
(IV) Is there a requirement of a repeater in the given cable layout? Why/ Why not?
(V) A) What would be your recommendation for enabling live visual communication between the Admin Office at the Mumbai campus and the DELHI Head Office from the following options:
a) Video Conferencing
b) Email
c) Telephony
d) Instant Messaging
OR
B) What type of network (PAN, LAN, MAN, or WAN) will be set up among the computers connected in the MUMBAI campus?
Answer:
(I) MEDIA Block as it has the maximum number of Computers. OR ADMIN Block as ADMIN block is generally the most secure.
(1 mark for correct answer)
(II) Switch
(1 mark for correct answer)
(III)

(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.
(1 mark for correct answer)
(V) (A) a) Video Conferencing
OR
(B) LAN
(1 mark for correct answer)
Watch this video for answering this type of questions:
Watch this video to understand the questions 36 and 37 practically:
Download the Official Sample Paper from CBSE Website
Download other question papers
| Source | Link to download |
| KV Jaipur | Download PDF |
| 20 Sets | Download PDF |
How to Make the Best Use of CBSE Class 12 Computer Science Sample Paper 2024-25
1. Understand the Paper Structure
Before you begin solving, familiarize yourself with the layout of the sample paper. Know how much time to allocate to each section based on your strengths and weaknesses.
2. Focus on Python Programming
Python programming is central to the exam. Ensure that you are confident in concepts like object-oriented programming, file handling, and data structures (stacks, queues). Practice coding questions daily.
3. Master SQL Queries
SQL is a scoring area. Practice writing SQL queries for retrieving, manipulating, and updating data in databases.
4. Tackle Networking with Confidence
Networking concepts like protocols, Internet basics, and cybersecurity are easy to grasp with regular revision. Make sure you understand network models and topologies well.
5. Attempt Case Study Questions Smartly
Case study/competency based questions test your ability to apply theoretical knowledge to real-world scenarios. Read the case carefully and ensure that you understand the problem before attempting to answer.
6. Solve the Sample Paper Under Exam Conditions
Time management is key in the CBSE board exams. Practice solving the sample paper in 3 hours to simulate real exam conditions and improve speed and accuracy.
Tips for Scoring High in CBSE Class 12 Computer Science Exam 2024-25
- Understand Concepts Deeply: Avoid rote learning. Focus on understanding the logic behind programming, databases, and networks to answer application-based questions effectively.
- Practice Regularly: The more you practice, the more confident you will be. Regularly solve previous years’ question papers and sample papers to improve problem-solving skills.
- Revise Thoroughly: Don’t skip revision. Use flowcharts, diagrams, and notes to revise key topics in Python, SQL, and networking.
- Focus on Case Studies: Be well-prepared for case study questions as they test your ability to apply theoretical knowledge practically.
- Time Management: Allocate time to each section during your preparation and avoid spending too much time on one question during the actual exam.
The CBSE Class 12 Computer Science Sample Paper for 2024-25 is an indispensable tool for exam preparation. By solving the sample paper and following a systematic study plan, you can significantly improve your chances of scoring well in the board exams. Focus on mastering Python, SQL, and networking concepts, and regularly practice to boost your confidence. With the right strategy, you can ace the CBSE Class 12 Computer Science exam!
Prepare well, stay consistent, and you’ll be ready to tackle the board exam with confidence.
If you are looking for previous question papers, follow this link: