English

Computer Science (Python) Board Sample Paper 2025-2026 Commerce (English Medium) Class 12 Question Paper Solution

Advertisements
Computer Science (Python) [Board Sample Paper]
Marks: 70 CBSE
Commerce (English Medium)
Science (English Medium)
Arts (English Medium)

Academic Year: 2025-2026
Date: March 2026
Advertisements

General Instructions:

  • This question paper contains 37 questions.
  • All questions are compulsory. However, internal choices have been provided in some questions. Attempt only one of the choices in such questions.
  • The paper is divided into 5 Sections- A, B, C, D and E.
  • Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
  • Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
  • Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
  • 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.
  • In - case of MCQ, text of the correct answer should also be written.

Section - A : (21 × 1 = 21 Marks)
[1]1

State if the following statement is True or False:

Using the statistics module, the output of the below statements will be 20:

import statistics

statistics.median([10, 20, 10, 30, 10, 20, 30])

Concept: undefined - undefined
Chapter:
[1]2

What will be the output of the following code?

L = ["India", "Incredible", "Bharat"]
print(L[1][0] + L[2][−1])

IT

it

It

iT

Concept: undefined - undefined
Chapter:
[1]3

Consider the given expression:

print(19<11 and 29>19 or not 75>30)

Which of the following will be the correct output of the given expression?

True

False

Null

No output

Concept: undefined - undefined
Chapter:
[1]4

In SQL, which type of Join(s) may contain duplicate column(s)?

Concept: undefined - undefined
Chapter:
[1]5

What will be the output of the following Python code?

str= "Soft Skills"
print(str[-3::-3])

lSf

Stkl

StKi

l

Concept: undefined - undefined
Chapter:
[1]6

Write the output of the following Python code:

for k in range(7,40,6):
     print ( k + '-' )
Concept: undefined - undefined
Chapter:
[1]7

What will be the output of the following Python statement:

print(10-3**2**2+144/12)
Concept: undefined - undefined
Chapter:
[1]8

Consider the given SQL Query:

SELECT department, COUNT(*) FROM employees HAVING COUNT(*) > 5 GROUP BY department;

Saanvi is executing the query but not getting the correct output. Write the correction.

Concept: undefined - undefined
Chapter:
[1]9

What will be the output of the following Python code?

try:
   x = 10 / 0
except Exception:
   print("Some other error!")
except ZeroDivisionError:
   print("Division by zero error!")

Division by zero error!

Some other error!

ZeroDivisionError

Nothing is printed

Concept: undefined - undefined
Chapter:
[1]10

What will be the output of the following Python code?

my_dict = {"name": "Alicia", "age": 27, "city": "DELHI"}
print(my_dict.get("profession", "Not Specified"))

Alicia

DELHI

None

Not Specified

Concept: undefined - undefined
Chapter:
[1]11

What possible output is expected to be displayed on the screen at the time of execution of the Python program from the following code?

import random
L=[10,30,50,70]
Lower=random.randint(2,2)
Upper=random.randint(2,3)
for K in range(Lower, Upper+1):
   print(L[K], end="@")

50@70@

90@

10@30@50@

10@30@50@70@

Concept: undefined - undefined
Chapter:
[1]12

What will be the output of the following Python code?

i = 5
print(i,end='@@')
def add():
  global i
  i = i+7
  print(i,end='##')
add()
print(i)

5@@12##15

5@@5##12

5@@12##12

12@@12##12

Concept: undefined - undefined
Chapter:
[1]13

Which SQL command can change the cardinality of an existing relation?

Insert

Delete

Both Insert & Delete

Drop

Concept: undefined - undefined
Chapter:
[1]14

What is the output of the given Python code?

st='Waterskiing is thrilling!'
print(st.split("i"))
['Watersk', 'ng ', 's thr', 'll', ‘ng!']
['Watersk', '', 'ng ', 's thr', 'll', 'ng!']
['Watersk', 'i', 'ng ', 's thr', 'll', ‘ng!']

Error

Concept: undefined - undefined
Chapter:
[1]15

In SQL, a relation consists of 5 columns and 6 rows. If 2 columns and 3 rows are added to the existing relation, what will be the updated degree of a relation?

Degree: 7

Degree: 8

Degree: 9

Degree: 6

Concept: undefined - undefined
Chapter:
[1]16

Which SQL command is used to remove a column from a table in MySQL?

UPDATE

ALTER

DROP

DELETE

Concept: undefined - undefined
Chapter:
[1]17

______ is a protocol used for retrieving emails from a mail server.

SMTP

FTP

POP3

PPP

Concept: undefined - undefined
Chapter:
[1]18

Which of the following is correct about using a Hub and Switch in a computer network?

A hub sends data to all devices in a network, while a switch sends data to the specific device.

A hub sends data only to the devices it is connected to, while a switch sends data to all devices in a network.

A hub and switch function the same way and can be used interchangeably.

A hub and switch are both wireless networking devices.

Concept: undefined - undefined
Chapter:
[1]19

Which of the following is used to create the structure of a web page?

CSS

HTML

JavaScript

FTP

Concept: undefined - undefined
Chapter:
[1]20 | Q20 and Q21 are Assertion(A) and Reason(R) based questions. Mark the correct choice as:

Assertion (A): The expression (1, 2, 3, 4).append(5) in Python will modify the original sequence datatype.

Reason (R): The append() method adds an element to the end of a list and modifies the list in place.

Both A and R are True and R is the correct explanation for A.

Both A and R are True and R is not the correct explanation for A.

A is True but R is False.

A is False but R is True.

Concept: undefined - undefined
Chapter:
[1]21

Assertion (A): A primary key must be unique and cannot have NULL values.

Reasoning (R): The primary key uniquely identifies each row in the table.

Both A and R are True and R is the correct explanation for A.

Both A and R are True and R is not the correct explanation for A.

A is True but R is False.

A is False but R is True.

Concept: undefined - undefined
Chapter:
Section - B : ( 7 × 2=14 Marks)
[2]22
[2]22.A

Explain the difference between explicit and implicit type conversion in Python with a suitable example.

Concept: undefined - undefined
Chapter:
Advertisements
OR
[2]22.B

Explain the difference between break and continue statements in Python with a suitable example.

Concept: undefined - undefined
Chapter:
[2]23

The code provided below is intended to remove the first and last characters of a given string and return the resulting string. However, there are syntax and logical errors in the code.

Rewrite it after removing all the errors. Also, underline all the corrections made.

define remove_first_last(str):
   if len(str)<2:
      return str
   new_str = str[1:-2]
   return new_str
result = remove_first_last("Hello")
Print("Resulting string:"result)
Concept: undefined - undefined
Chapter:
[2]24
[2]24.A
[1]24.A.i

Answer using Python built-in method/function only:

Write a statement to find the index of the first occurrence of the substring “good” in a string named review.

Concept: undefined - undefined
Chapter:
[1]24.A.ii

Answer using Python built-in method/function only:

Write a statement to sort the elements of list L1 in descending order.

Concept: undefined - undefined
Chapter:
OR
[2]24.B

Predict the output of the following Python code:

text="Learn Python with fun and practice"
print(text.partition("with"))
print(text.count("a"))
Concept: undefined - undefined
Chapter:
[2]25
[2]25.A

Write a function remove_element() in Python that accepts a list L and a number n. If the number n exists in the list, it should be removed. If it does not exist, print a message saying “Element not found”.

Concept: undefined - undefined
Chapter:
OR
[2]25.B

Write a Python function add_contact() that accepts a dictionary phone_book, a name, and a phone number. The function should add the name and phone number to the dictionary. If the name already exists, print “Contact already exists” instead of updating it.

Concept: undefined - undefined
Chapter:
[2]26

Predict the output of the Python code given below:

emp = {"Arv": (85000,90000),"Ria": (78000,88000),"Jay": (72000,80000),"Tia":
 (80000,70000)}
selected = [ ]
for name in emp:
   salary = emp[name]
   average = (salary[0] + salary[1])/2
   if average > 80000:
      selected.append(name)
print(selected)
Concept: undefined - undefined
Chapter:
[2]27
[2]27.A
[1]27.A.i

Write a suitable command to do the following in MySQL.

View the table structure.

Concept: undefined - undefined
Chapter:
[1]27.A.ii

Write a suitable command to do the following in MySQL.

Create a database named SQP.

Concept: undefined - undefined
Chapter:
OR
[2]27.B

Differentiate between drop and delete query in SQL with a suitable example.

Concept: undefined - undefined
Chapter:
[2]28
[2]28.A
[1]28.A.i

Define the following term:

Modem

Concept: undefined - undefined
Chapter:
[1]28.A.ii

Define the following term:

Gateway

Concept: undefined - undefined
Chapter:
OR
[2]28.B
[1]28.B.i
[0.5]28.B.i.1

Expand HTTP.

Concept: undefined - undefined
Chapter: [11] Data Communication
Advertisements
[0.5]28.B.i.2

Expand FTP.

Concept: undefined - undefined
Chapter: [11] Data Communication
[1]28.B.ii

How is web server different from web browser?

Concept: undefined - undefined
Chapter:
Section - C : (3 × 3 = 9 Marks)
[3]29
[3]29.A

Write a Python function that displays the number of times the word “Python” appears in a text file named “Prog.txt”. 

Concept: undefined - undefined
Chapter:
OR
[3]29.B

Write and call a Python function to read lines from a text file STORIES.TXT and display those lines which doesn’t start with a vowel (A, E, I, O, U) irrespective of their case.

Concept: undefined - undefined
Chapter:
[3]30
[1.5]30.A

A list containing records of products as 

L = [("Laptop", 90000), ("Mobile", 30000), ("Pen", 50), ("Headphones", 1500)]

Write the following user-defined function to perform an operation on a stack named Product to:

Push_element() – To push an item containing the product name and price of products costing more than 50 into the stack.

Output:

('Laptop', 90000), 
('Mobile', 30000),
('Headphones', 1500)
Concept: undefined - undefined
Chapter:
[1.5]30.B

A list containing records of products as 

L = [("Laptop", 90000), ("Mobile", 30000), ("Pen", 50), ("Headphones", 1500)]

Write the following user-defined function to perform an operation on a stack named Product to:

Pop_element() – To pop the items from the stack and display them. Also, display "Stack Empty" when there are no elements in the stack.

Output: 

('Headphones', 1500) 
('Mobile', 30000) 
('Laptop', 90000) 
Stack Emply
Concept: undefined - undefined
Chapter:
[3]31
[3]31.A

Predict the output of the following Python code:

s1="SQP−25"
s2=""
i=0
while i<len(s1):
  if s1[i]>='0' and s1[i]<='9':
     Num=int(s1[i])
     Num−=1
     s2=s2+str(Num)
  elif s1[i]>='A' and s1[i]<='Z':
     s2=s2+s1[i+1]
  else:
     s2=s2+'^'
    i+=1
print(s2)
Concept: undefined - undefined
Chapter:
OR
[3]31.B

Predict the output of the following Python code:

wildlife_sanctuary = ["Kaziranga", "Ranthambhore", "Jim Corbett", "Sundarbans",
"Periyar", "Gir", "Bandipur"]
output = [ ]
for sanctuary in wildlife_sanctuary:
   if sanctuary[−1] in 'aeiou':
      output.append(sanctuary[0].upper())
print(output)
Concept: undefined - undefined
Chapter:
Section - D : (4 × 4 = 16 Marks)
[4]32
[4]32.A

Consider the table SALES as given below:

Write the following queries:

  1. To display the total quantity sold for each product whose total quantity sold exceeds 12.
  2. To display the records of SALES table sorted by Product name in descending order.
  3. To display the distinct Product names from the SALES table.
  4. To display the records of customers whose names end with the letter ‘e’.
Concept: undefined - undefined
Chapter:
OR
[4]32.B
[1]32.B.i

Predict the output of the following:

SELECT * FROM Sales where product='Tablet';
Concept: undefined - undefined
Chapter:
[1]32.B.ii

Predict the output of the following:

SELECT sales_id, customer_name FROM Sales WHERE product LIKE 'S%';
Concept: undefined - undefined
Chapter:
[1]32.B.iii

Predict the output of the following:

SELECT COUNT(*) FROM Sales WHERE product in ('Laptop', 'Tablet');
Concept: undefined - undefined
Chapter:
[1]32.B.iv

Predict the output of the following:

SELECT AVG(price) FROM Sales where product='Tablet';
Concept: undefined - undefined
Chapter:
[4]33

Raj is the manager of a medical store. To keep track of sales records, he has created a CSV file named Sales.csv, which stores the details of each sale.

The columns of the CSV file are: Product_ID, Product_Name, Quantity_Sold and Price_Per_Unit.

Help him to efficiently maintain the data by creating the following user-defined functions:

  1. Accept() – to accept a sales record from the user and add it to the file Sales.csv.
  2. CalculateTotalSales() – to calculate and return the total sales based on the Quantity_Sold and Price_Per_Unit.
Concept: undefined - undefined
Chapter:
[4]34

Pranav is managing a Travel Database and needs to access certain information from the Hotels and Bookings tables for an upcoming tourism survey. Help him extract the required information by writing the appropriate SQL queries as per the tasks mentioned below: 

  1. To display a list of customer names who have bookings in any hotel of 'Delhi' city.
  2. To display the booking details for customers who have booked hotels in 'Mumbai', 'Chennai', or 'Kolkata'.
  3. To delete all bookings where the check-in date is before 2024-12-03.
  4. A. To display the Cartesian Product of the two tables.
                                         OR
    B. To display the customer’s name along with their booked hotel’s name.
Concept: undefined - undefined
Chapter:
[4]35

MySQL database named WarehouseDB has a product_inventory table in MySQL which contains the following attributes:

  • Item_code: Item code (Integer)
  • Product_name: Name of product (String)
  • Quantity: Quantity of product (Integer)
  • Cost: Cost of product (Integer)

Consider the following details to establish Python-MySQL connectivity:

  • Username: admin_user
  • Password: warehouse2024
  • Host: localhost

Write a Python program to change the quantity of the product to 91 whose Item_code is 208 in the product_inventory table.

Concept: undefined - undefined
Chapter:
SECTION - E : (2 × 5 = 10 Marks)
[5]36
[2]36.A

Mr. Ravi, a manager at a tech company, needs to maintain records of employees. Each record should include: Employee_ID, Employee_Name, Department and Salary. Write the Python function to input employee data and append it to a binary file.

Concept: undefined - undefined
Chapter:
[3]36.B

Mr. Ravi, a manager at a tech company, needs to maintain records of employees. Each record should include: Employee ID, Employee_Name, Department and Salary. Write the Python functions to update the salary of employees in the "IT" department to 200000.

Concept: undefined - undefined
Chapter:
[5]37

XYZNova Inc. is planning a new campus in Hyderabad while maintaining its headquarters in Bengaluru. The campus will have four buildings: HR, Finance, IT, and Logistics. As a network expert, you are tasked with proposing the best network solutions for their needs based on the following:

From To Distance (in meters)
HR Finance 50
HR IT 175
HR Logistics 90
Finance IT 60
Finance Logistics 70
IT Logistics 60

Number of Computers in Each Block:

Block Number of Computers
HR 60
Finance 40
IT 90
Logistics 35
  1. Suggest the best location for the server in the Hyderabad campus and explain your reasoning.
  2. Suggest the placement of the following devices:
    1. Repeater
    2. Switch
  3. Suggest and draw a cable layout of connections between the buildings inside the campus.
  4. The organisation plans to provide a high-speed link with its head office using a wired connection. Which of the cables will be most suitable for this job?
    1. What is the use of VoIP?
                                   OR
    2. Which type of network (PAN, LAN, MAN, or WAN) will be formed while connecting the Hyderabad campus to Bengaluru Headquarters?
Concept: undefined - undefined
Chapter:

Other Solutions



































Video TutorialsVIEW ALL [2]

Submit Question Paper

Help us maintain new question papers on Shaalaa.com, so we can continue to help students




only jpg, png and pdf files

CBSE previous year question papers Class 12 Computer Science (Python) with solutions 2025 - 2026

     CBSE Class 12 Computer Science (Python) question paper solution is key to score more marks in final exams. Students who have used our past year paper solution have significantly improved in speed and boosted their confidence to solve any question in the examination. Our CBSE Class 12 Computer Science (Python) question paper 2026 serve as a catalyst to prepare for your Computer Science (Python) board examination.
     Previous year Question paper for CBSE Class 12 Computer Science (Python)-2026 is solved by experts. Solved question papers gives you the chance to check yourself after your mock test.
     By referring the question paper Solutions for Computer Science (Python), you can scale your preparation level and work on your weak areas. It will also help the candidates in developing the time-management skills. Practice makes perfect, and there is no better way to practice than to attempt previous year question paper solutions of CBSE Class 12.

How CBSE Class 12 Question Paper solutions Help Students ?
• Question paper solutions for Computer Science (Python) will helps students to prepare for exam.
• Question paper with answer will boost students confidence in exam time and also give you an idea About the important questions and topics to be prepared for the board exam.
• For finding solution of question papers no need to refer so multiple sources like textbook or guides.
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×