0% found this document useful (0 votes)
26 views23 pages

Python and SQL Practice Exam Paper

The document is a board practice paper consisting of 37 questions divided into five sections, covering various topics in Python programming and SQL. Each section has a specific mark distribution, with Section A containing multiple-choice and short answer questions, while Sections B, C, D, and E include more detailed programming tasks and SQL queries. The paper emphasizes the use of Python for programming questions and includes internal choices for some questions.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views23 pages

Python and SQL Practice Exam Paper

The document is a board practice paper consisting of 37 questions divided into five sections, covering various topics in Python programming and SQL. Each section has a specific mark distribution, with Section A containing multiple-choice and short answer questions, while Sections B, C, D, and E include more detailed programming tasks and SQL queries. The paper emphasizes the use of Python for programming questions and includes internal choices for some questions.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

BOARD PRACTICE PAPER

Time Allowed: 3 Hrs. Maximum Marks: 70

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.

Q No. Section-A (21 x 1 = 21 Marks) Marks


1 State if the following statement is True or False: 1
Using the statistics module, the output of the below statements will be 20:
import statistics
[Link]([10, 20, 10, 30, 10, 20, 30])

2 What will be the output of the following code? 1


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

a) IT b) it c) It d) iT
3 Consider the given expression: 1
print(19<11 and 29>19 or not 75>30)
Which of the following will be the correct output of the given expression?
a) True b) False c) Null d) No output
4 In SQL, which type of Join(s) may contain duplicate column(s)? 1
5 What will be the output of the following Python code? 1
str= "Soft Skills"
print(str[-3::-3])
a) lSf b) Stkl c) StKi d) l
6 Write the output of the following Python code : 1
for k in range(7,40,6):
print ( k + '-' )
7 What will be the output of the following Python statement: 1
print(10-3**2**2+144/12)
8 Consider the given SQL Query: 1
SELECT department, COUNT(*) FROM employees HAVING COUNT(*) > 5 GROUP
BY department;

Page 1
Saanvi is executing the query but not getting the correct output. Write the correction.
9 What will be the output of the following Python code? 1
try:
x = 10 / 0
except Exception:
print("Some other error!")
except ZeroDivisionError:
print("Division by zero error!")
a) Division by zero error! b) Some other error!
c) ZeroDivisionError d) Nothing is printed
10 What will be the output of the following Python code? 1
my_dict = {"name": "Alicia", "age": 27, "city": "DELHI"}
print(my_dict.get("profession", "Not Specified"))
a) Alicia b)DELHI c)None d)Not Specified
11 What possible output is expected to be displayed on the screen at the time of execution 1
of the Python program from the following code?

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

a) 50@70@ b) 90@ c) 10@30@50@ d) 10@30@50@70@


12 What will be the output of the following Python code? 1
i=5
print(i,end='@@')
def add():
global i
i = i+7
print(i,end='##')
add()
print(i)
a) 5@@12##15 b) 5@@5##12 c) 5@@12##12 d)12@@12##12
13 Which SQL command can change the cardinality of an existing relation? 1
a) Insert b) Delete c) Both a) & b) d) Drop
14 What is the output of the given Python code? 1
st='Waterskiing is thrilling!'
print([Link]("i"))
a) ['Watersk', 'ng ', 's thr', 'll', ‘ng!'] b) ['Watersk', '', 'ng ', 's thr', 'll', 'ng!']
c) ['Watersk', 'i', 'ng ', 's thr', 'll', ‘ng!'] d) Error
15 In SQL, a relation consists of 5 columns and 6 rows. If 2 columns and 3 rows are added 1
to the existing relation, what will be the updated degree of a relation?
a) Degree: 7 b) Degree: 8
c) Degree: 9 d) Degree: 6
16 Which SQL command is used to remove a column from a table in MySQL? 1
a) UPDATE b) ALTER c) DROP d) DELETE

Page 2
17 _________ is a protocol used for retrieving emails from a mail server. 1
a) SMTP b) FTP c) POP3 d) PPP
18 Which of the following is correct about using a Hub and Switch in a computer network? 1
a) A hub sends data to all devices in a network, while a switch sends data to the
specific device.
b) A hub sends data only to the devices it is connected to, while a switch sends data to
all devices in a network.
c) A hub and switch function the same way and can be used interchangeably.
d) A hub and switch are both wireless networking devices.
19 Which of the following is used to create the structure of a web page? 1
a) CSS b) HTML c) JavaScript d) FTP
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): The expression (1, 2, 3, 4).append(5) in Python will modify the original 1
sequence datatype.
Reason (R): The append() method adds an element to the end of a list and modifies the
list in place.
21 Assertion (A): A primary key must be unique and cannot have NULL values. 1
Reasoning (R): The primary key uniquely identifies each row in the table.

Q No. Section-B ( 7 x 2=14 Marks) Marks


22 A. Explain the difference between explicit and implicit type conversion in Python with a 2
suitable example.
OR
B. Explain the difference between break and continue statements in Python with a
suitable example.
23 The code provided below is intended to remove the first and last characters of a 2
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)

24 A. (Answer using Python built-in methods/functions only): 2

I. Write a statement to find the index of the first occurrence of the substring
"good" in a string named review.
II. Write a statement to sort the elements of list L1 in descending order.

Page 3
OR
B. Predict the output of the following Python code:
text="Learn Python with fun and practice"
print([Link]("with"))
print([Link]("a"))

25 A. Write a function remove_element() in Python that accepts a list L and a number n. If 2


the number n exists in the list, it should be removed. If it does not exist, print a
message saying "Element not found".
OR
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.
26 Predict the output of the Python code given below : 2
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:
[Link](name)
print(selected)
27 A. Write suitable commands to do the following in MySQL. 2
I. View the table structure.
II. Create a database named SQP
OR
B. Differentiate between drop and delete query in SQL with a suitable example.
28 A. Define the following terms: 2
I. Modem
II. Gateway
OR
B.
I. Expand the following terms: HTTP and FTP
II. Differentiate between web server and web browser.
Q No. Section-C ( 3 x 3 = 9 Marks) Marks
29 A. Write a Python function that displays the number of times the word "Python" 3
appears in a text file named "[Link]".
OR
B. Write and call a Python function to read lines from a text file [Link] and
display those lines which doesn’t start with a vowel (A, E, I, O, U) irrespective of
their case.
30 A list containing records of products as 3
L = [("Laptop", 90000), ("Mobile", 30000), ("Pen", 50), ("Headphones", 1500)]
Write the following user-defined functions to perform operations on a stack named
Product to:

Page 4
I. 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)]
II. 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
31 A. Predict the output of the following Python code: 3
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)
OR
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':
[Link](sanctuary[0].upper())
print(output)
Q No. Section-D ( 4 x 4 = 16 Marks) Marks
32 Consider the table SALES as given below: 4

A. Write the following queries:


I. To display the total quantity sold for each product whose total quantity sold
exceeds 12.
II. To display the records of SALES table sorted by Product name in descending
order.

Page 5
III. To display the distinct Product names from the SALES table.
IV. To display the records of customers whose names end with the letter 'e'.
OR
B. Predict the output of the following:
I. SELECT * FROM Sales where product='Tablet';
II. SELECT sales_id, customer_name FROM Sales WHERE product LIKE 'S%';
III. SELECT COUNT(*) FROM Sales WHERE product in ('Laptop', 'Tablet');
IV. SELECT AVG(price) FROM Sales where product='Tablet';
33 Raj is the manager of a medical store. To keep track of sales records, he has created a 4
CSV file named [Link], 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:

I. Accept() – to accept a sales record from the user and add it to the file [Link].

II. CalculateTotalSales() – to calculate and return the total sales based on the
Quantity_Sold and Price_Per_Unit.

34 Pranav is managing a Travel Database and needs to access certain information from the 4
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:
Table: Hotels

Table: Bookings

Page 6
I. To display a list of customer names who have bookings in any hotel of 'Delhi'
city.
II. To display the booking details for customers who have booked hotels in
'Mumbai', 'Chennai', or 'Kolkata'.
III. To delete all bookings where the check-in date is before 2024-12-03.
IV. 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.

35 MySQL database named WarehouseDB has a product_inventory table in MySQL which 4


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.
Q No. Section-E (2 X 5 = 10 Marks) Marks
36 Mr. Ravi, a manager at a tech company, needs to maintain records of employees. Each 2+3
record should include: Employee_ID, Employee_Name, Department and Salary.
Write the Python functions to:
I. Input employee data and append it to a binary file.
II. Update the salary of employees in the "IT" department to 200000.
37 XYZNova Inc. is planning a new campus in Hyderabad while maintaining its headquarters 5
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

Page 7
Logistics 35
I. Suggest the best location for the server in the Hyderabad campus and explain
your reasoning.
II. Suggest the placement of the following devices:
a) Repeater b) Switch
III. Suggest and draw a cable layout of connections between the buildings inside the
campus.
IV. 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?
V. A. What is the use of VoIP?
OR
B. Which type of network (PAN, LAN, MAN, or WAN) will be formed while
connecting the Hyderabad campus to Bengaluru Headquarters?

Page 8
BOARD PRACTICE PAPER

GENERAL INSTRUCTIONS:

1. This question paper contains 37 questions.


2. All questions are compulsory. However, internal choices have been provided
in some questions. Attempt only one of the choices in such questions.
3. The question paper is divided into 5 Sections – A, B, C, D and E.
4. Section A consists of 21 questions (1 to 21). Each question carries 1 mark.
5. Section B consists of 7 questions (22 to 28). Each question carries 2 marks.
6. Section C consists of 3 questions (29 to 31). Each question carries 3 marks.
7. Section D consists of 4 questions (32 to 35). Each question carries 4 marks.
8. Section E consists of 2 questions (36 and 37). Each question carries 5 marks.
9. All programming questions are to be answered using Python only.
10. In case of MCQs, write the option (A/B/C/D) and also write the text of the
correct answer.

SECTION A

Q1. State True or False:


Logical errors in a Python program do not generate any error message, but produce
incorrect results.

Q2. What will be the output of the following code?


s = "COMPUTER"
print(s[1:6:2])
(A) OPU (B) OMT (C) OPE (D) OPT

Q3. Which of the following expressions evaluates to True in Python?


(A) not (5 > 2 and 3 < 1) (B) 5 < 2 and 3 > 1
(C) not (4 != 4) (D) 3 > 5 or 2 > 7

Q4. Consider the dictionary:


D = {"A":10, "B":20, "C":30}
Which statement will raise an error?
(A) D["B"] = 25 (B) print([Link]("D"))
(C) print(D["D"]) (D) print(len(D))

Q5. What will be the output of the following?


L = [2, 4, 6, 8, 10]
print(L[-4:-1])

Q6. Tuples in Python are:


(A) Mutable sequences (B) Immutable sequences
(C) Unordered and mutable (D) Unordered and immutable
Q7. Name the exception class raised when we try to access a list element using an
index which is out of range.

Q8. Which one of the following is immutable?


(A) List (B) Dictionary (C) Set (D) Tuple

Q9. In a table, one attribute is chosen as the Primary Key and there are two more
attributes which can also uniquely identify the records. How many candidate keys
does the table have in total?
(A) 1 (B) 2 (C) 3 (D) 4

Q10. Fill in the blank to reposition the file pointer to the beginning of the file:
f = open("[Link]", "r")
content = [Link](20)
_______________________
content2 = [Link](10)
[Link]( )

Q11. State True or False:


In Python, a variable declared inside a function is local to that function by default.

Q12. Predict the output of the following code:


x=5
def change( ):
global x
x=x+3
print(x, end="@")
change( )
print(x, end="#")
(A) 8@8# (B) 5@8# (C) 8@5# (D) 5@5#

Q13. Which SQL command is used to change the structure of an existing table (e.g.,
to add a new column)?

Q14. What will be the result of the following SQL query?


SELECT name FROM STUDENT
WHERE name LIKE '%an';
(A) Names starting with "an" (B) Names ending with "an"
(C) Names containing "an" anywhere (D) Names having exactly two characters
"an"

Q15. In MySQL, which datatype stores fixed-length character strings, padding extra
spaces to the specified length if needed?
(A) VARCHAR
(B) CHAR
(C) FLOAT
(D) DATE
Q16. Which aggregate function is used in SQL to find the number of rows in a table?
(A) SUM()
(B) COUNT()
(C) MAX()
(D) AVG()

Q17. Which protocol is commonly used to send e-mails over the Internet?
(A) HTTP
(B) SMTP
(C) FTP
(D) POP3

Q18. Name the network device that connects multiple networks using different
protocols and performs protocol conversion if required.

Q19. Which switching technique divides data into small units called packets that are
routed independently through the network?

Q20–21 are Assertion–Reason type questions.


Choose the correct option:
(A) Both A and R are true and R is the correct explanation of A.
(B) Both A and R are true but R is not the correct explanation of A.
(C) A is true but R is false.
(D) A is false but R is true.

Q20.
Assertion (A): Default arguments in Python functions must always appear after all
non-default (positional) arguments in the function header.
Reason (R): Python assigns default values to arguments based on their position
from right to left in the parameter list.

Q21.
Assertion (A): In SQL, the WHERE clause can be used with the GROUP BY clause.
Reason (R): The WHERE clause is used to filter rows before grouping, whereas
HAVING is used to filter groups after grouping.

SECTION B

Q22.
(a) Differentiate between mutable and immutable data types in Python.
(b) From the following, identify one mutable and one immutable type:
(10, 20), [10, 20], {"A":1}, "CS"

Q23.
Write the differences between the following pairs (any one pair):
(a)
(i) break statement
(ii) continue statement
OR,
(b)
(i) append( ) method of list
(ii) extend( ) method of list
(Explain with one example each.)

Q24.
Given the lists:
L1 = [5, 3, 5, 7, 9, 5, 4]
L2 = [100, 200, 300]
Answer using built-in list methods only:
(I) A) Write a statement to count total occurrences of 5 in L1.
OR,
B) Write a statement to remove the first occurrence of 7 from L1.
(II) A) Write a statement to add all elements of L2 at the end of L1.
OR,
B) Write a statement to reverse the elements of list L2.
Q25.
Consider the following code:
import random
s = "PYTHON"
n = [Link](1,4)
for i in range(0, n):
print(s[i], end="$")
(i) Write any two possible outputs of this code.
(ii) What is the minimum and maximum number of characters that can be printed?

Q26.
The following Python function is intended to return the sum of all even numbers
from a list. The code has errors. Rewrite the corrected code and underline all
changes made.
def even_sum(L
total = 0
for x in L:
if x%2 = 0:
total = total + x
return total

nums = [3,4,6,7]
print(even_sum nums)

Q27.

(I)
A) Which constraint should be applied on a column so that its values must be
unique, but NULL values are allowed?
OR,
B) Which constraint should be applied on a column so that NULL is not allowed, but
duplicate values are allowed?
(II)
A) Write an SQL command to add a column EMAIL of type VARCHAR(40) to an
already existing table EMP.
OR,
B) Write an SQL command to remove the column PHONE from the table EMP.

Q28.

A) Write any one advantage and one disadvantage of star topology.


OR,
B) Expand the following:
(i) URL
(ii) VoIP

SECTION C

Q29.

A) Write a Python function DisplayLines( ) that opens a text file "[Link]" and
prints all lines that start with the letter 'P' (uppercase only).
OR,
B) Write a Python function CountWord( ) that opens a text file "[Link]" and counts
how many times the word "data" (in any case: DATA, Data, data, etc.) appears in the
file. Display the count.

Q30.

A) A stack named NumStack is implemented using a Python list. Write user-defined


functions to perform the following operations:
1. PUSH(NumStack, item) – to push an element item onto the stack.
2. POP(NumStack) – to pop and return the top element from the stack. If the
stack is empty, display "Underflow" and return None.
3. DISPLAY(NumStack) – to display all elements of the stack without removing
them. If the stack is empty, display "Empty Stack".

Q31.

A) Predict the output of the following Python code:


D = {"CS": 91, "IP": 93, "Maths": 88}
s = ""
for k in sorted(D):
s = s + k + ":" + str(D[k]) + "|"
print(s[:-1])
OR,

B) Predict the output of the following code:


L = [3, 6, 9]
for i in range(len(L)):
for j in range(1, L[i]//3 + 1):
print(j, end="#")
print( )
SECTION D

Q32.
Consider the following table PRODUCTS:

PID PName Category Price Stock

101 Pen Stationery 15 200

102 Notebook Stationery 45 120

103 Pendrive Electronics 500 40

104 Mouse Electronics 350 60

(Assume the table has more records.)

Write SQL queries for the following:

A) Display the Category and total Stock for each category where total stock is
greater than 150.
B) Display PName and Price of all products in descending order of Price.
C) Display the distinct categories available in the table.
D) Display the sum of Price of all products whose Stock is less than 50.

OR,

Write the output of the following SQL statements (based on the above table):

(i) SELECT Category, COUNT(*) FROM PRODUCTS GROUP BY Category;


(ii) SELECT PName, Price FROM PRODUCTS WHERE Price BETWEEN 100 AND 400;
(iii) SELECT PName, Price*Stock FROM PRODUCTS WHERE Category='Electronics';
(iv) SELECT MAX(Price) FROM PRODUCTS;

Q33.
A CSV file "[Link]" contains student data with the following fields:
• RollNo
• Name
• Class
• TotalMarks
For example: 1001, "Riya", 12, 468
Write Python functions to:
(I) Read all records from "[Link]" and display the details of students having
TotalMarks greater than or equal to 450.
(II) Count and display the total number of records in the file.
(Use the csv module.)
Q34.
Consider the following tables:
Table: TEACHER
TID TName Subject Salary

1 Anjali Rao CS 65000

2 Mohan Singh Maths 58000

3 Priya Desai Physics 60000

4 Rohan Gupta CS 70000

Table: CLASSALLOT

CID TID Class Section

C1 1 12 A

C2 3 12 B

C3 4 11 A

C4 2 10 C

Write SQL queries for:


A) Display the names of all teachers who teach CS and have Salary more than 65000.
B) Display Class, Section and TName of all classes taken by teachers having subject
"Physics".
C) Increase the Salary by 2000 for all teachers whose subject is "Maths".
D)
(i) Display the Cartesian product of TEACHER and CLASSALLOT.
OR,
(ii) Display the TName, Subject, Class, Section by performing an appropriate join
between the two tables.

Q35.
A table LIBRARY in database SchoolDB has the structure:
• BookID INT (Primary Key)
• Title VARCHAR(40)
• Author VARCHAR(30)
• Price FLOAT
Write a Python function AddAndShow() using MySQL–Python connectivity that:
1. Accepts details of a new book from the user and inserts it into the table
LIBRARY.
2. Retrieves and displays all records where Price is greater than 500.
Assume:
host = "localhost", user = "root", password = "admin123", database = "SchoolDB"
(You need not write code for creating database or table.)
SECTION E

Q36.
A company wants to maintain details of its employees in a binary file "[Link]"
using the pickle module. Each record will store:
• EmpID (integer)
• EmpName (string)
• Dept (string)
• Salary (float)
Write Python functions for the following:
(I) AppendEmp( ) – To input details of an employee from the user and append the
record to "[Link]".
(II) UpdateSalary( ) – To increase the salary by 10% for all employees whose
department is "IT". After modification, the updated data should be written back to
"[Link]".
(Do not write the full menu-driven program; only the two functions are required.)

Q37.
An educational trust is setting up a campus network with the following blocks:
• ADMIN Block – 30 computers
• SCIENCE Block – 60 computers
• COMMERCE Block – 45 computers
• LIBRARY Block – 20 computers
The distances between the blocks are as follows:
• ADMIN to SCIENCE: 60 m
• SCIENCE to COMMERCE: 80 m
• COMMERCE to LIBRARY: 50 m
• ADMIN to LIBRARY: 120 m
The trust also has a head office in another city, which must be connected to this
campus network.
Answer the following:
(i) Which block should house the server? Give a reason.
(ii) Suggest a suitable topology for connecting the computers within each block.
(iii) Suggest a suitable wired transmission medium for connecting the blocks,
considering the distances and need for high speed.
(iv) Name any two network devices (other than computers) that will be required to
connect all blocks in the campus network.
(v) Which type of network (LAN/MAN/WAN) will be formed between the campus
and head office? Justify your answer.

************
BOARD PRACTICE PAPER

GENERAL INSTRUCTIONS:

1. This question paper contains 37 questions.

2. All questions are compulsory. However, internal choices have been provided in some
questions. Attempt only one of the choices in such questions.

3. The question paper is divided into 5 Sections – A, B, C, D and E.

4. Section A consists of 21 questions (1 to 21). Each question carries 1 mark.

5. Section B consists of 7 questions (22 to 28). Each question carries 2 marks.

6. Section C consists of 3 questions (29 to 31). Each question carries 3 marks.

7. Section D consists of 4 questions (32 to 35). Each question carries 4 marks.

8. Section E consists of 2 questions (36 and 37). Each question carries 5 marks.

9. All programming questions are to be answered using Python only.

10. In case of MCQs, write the option (A/B/C/D) and also write the text of the correct
answer.

SECTION A

Q1. State True or False:


The statement `del L[2]` removes the element at index 2 from list L.

Q2. What will be the output of the following code?


s = "INFORMATION"
print(s[-5:-1])
(A) MATI (B) ATIO (C) TION (D) IONA

Q3. Which of the following will create a dictionary with keys 1 and 2 having values 10 and
20?
(A) D = {1:10, 2:20} (B) D = (1:10, 2:20)
(C) D = dict([1,10],[2,20]) (D) D = {[1,10],[2,20]}

Q4. Identify the output:


L = [1, 3, 5]
[Link](1, 9)
print(L)
(A) [1, 9, 3, 5] (B) [9, 1, 3, 5] (C) [1, 3, 9, 5] (D) Error

Q5. What will be printed by the following?


t = (4, 8, 12)
print(t*2)

Q6. Which of these is the correct way to open a text file for appending in Python?
(A) open('[Link]','r') (B) open('[Link]','w') (C) open('[Link]','a') (D) open('[Link]','rb')

Q7. Name the built‑in Python function that returns the number of items in an iterable.

Q8. The default value of file pointer after opening a file in read mode is at:
(A) End of file (B) Beginning of file (C) Random position (D) After first line

Q9. If a table has 3 candidate keys, how many choices are there for selecting the primary
key?
(A) 1 (B) 2 (C) 3 (D) 4

Q10. Fill in the blank to read one entire line from a file:
line = f.________________

Q11. State True or False:


A function without a return statement returns `None` by default.

Q12. Predict the output of the code:


a=7
def g(a):
a=a+5
return a
print(g(a), a)
(A) 12 7 (B) 7 12 (C) 12 12 (D) Error

Q13. Which SQL command is used to remove all records from a table, but keep its structure
intact?

Q14. What does this SQL query return?


SELECT * FROM STUDENT WHERE Marks NOT BETWEEN 40 AND 60;
(A) Marks between 40 and 60
(B) Marks less than 40 or greater than 60
(C) Marks exactly 40 and 60
(D) All records

Q15. In MySQL, which operator is used for pattern matching?


(A) IN (B) LIKE (C) BETWEEN (D) IS
Q16. Which function rounds a numeric value to 2 decimal places in SQL?
(A) ROUND(x,2) (B) FLOOR(x,2) (C) TRUNC(x,2) (D) ABS(x,2)

Q17. Expand: FTP.

Q18. Which network device broadcasts data to all connected nodes and works at Physical
Layer?
(A) Switch (B) Router (C) Hub (D) Repeater

Q19. Name the cable type that uses light signals to transmit data.

Q20–21 are Assertion–Reason type questions.


Choose the correct option:
(A) Both A and R are true and R is the correct explanation of A.
(B) Both A and R are true but R is not the correct explanation of A.
(C) A is true but R is false.
(D) A is false but R is true.

Q20.
Assertion (A): In Python, sets cannot store duplicate elements.
Reason (R): Elements of a set are stored using hashing, so each element is unique.

Q21.
Assertion (A): `ORDER BY` clause is executed after `WHERE` in SQL.
Reason (R): `WHERE` filters rows before sorting them.

SECTION B

Q22.
(a) Define a nested list.
(b) Write one example of a nested list containing student marks in three subjects.

Q23.
Write the output of the following Python code:
st = "SCHOOL"
print([Link]('O'), [Link]('O'))

Q24.
Given the list:
A = [12, 5, 18, 5, 20, 5]
(I) A) Write a statement to replace the last occurrence of 5 with 50.
OR,
B) Write a statement to delete all occurrences of 5 from A.
(II) A) Write a statement to sort A in descending order.
OR,
B) Write a statement to create a new list B containing only even numbers from A.
Q25.
Consider the following code:
import random
x = [Link]([2,4,6,8])
y = [Link](1,5)
print(x**y)
(i) Write any two possible outputs.
(ii) Write the maximum possible value printed.

Q26.
The following function is meant to return the average of numbers in a list. It contains errors.
Rewrite the corrected code and underline the changes.

def avg_num(L):
total = 0
for i in L
total = total + i
return total/len

print(avg_num([10,20,30]))

Q27.
(I)
A) Write the full form of DDL.
OR,
B) Write the full form of DML.

(II)
A) Write an SQL command to rename table STAFF to EMPLOYEE.
OR,
B) Write an SQL command to display all columns of table EMPLOYEE.

Q28.
A) State any two advantages of optical fibre cable.
OR,
B) What is an IP address? Write its two main versions used on the Internet.

SECTION C

Q29.
A) Write a Python function CountVowels() that reads a text file "[Link]" and counts the
total number of vowels (a, e, i, o, u) present in the file. Display the count.
OR,
B) Write a Python function CopyOddLines() that copies all odd‑numbered lines from
"[Link]" to another file "[Link]".

Q30.
A) Implement a linear search function LinearSearch(L, key) that returns the index of key in
list L, or -1 if not found.
OR,
B) Write functions to implement a circular queue using list CQ with size 5:
ENQUEUE(CQ,item), DEQUEUE(CQ) and DISPLAY(CQ).

Q31.
A) Find the output:
def fun(n):
if n == 0:
return 1
else:
return n * fun(n-1)
print(fun(4))
OR,
B) Find the output:
S = {"CS","Maths","Bio"}
[Link]("Physics")
[Link]("Bio")
print(len(S), sorted(S))

SECTION D

Q32.
Consider the following table SALES:
SID Item City Qty Amount
1 Laptop Delhi 3 180000
2 Printer Raipur 2 24000
3 Laptop Raipur 1 60000
4 Scanner Delhi 4 32000
(Assume more records.)
Write SQL queries for:
A) Display Item and total Qty sold for each Item.
B) Display details where City is 'Raipur' and Qty >= 2.
C) Display the highest Amount from the table.
D) Display distinct City names.
OR,
Write the output of the following queries:
(i) SELECT City, COUNT(*) FROM SALES GROUP BY City;
(ii) SELECT Item FROM SALES WHERE Item LIKE 'L%';
(iii) SELECT SUM(Amount) FROM SALES WHERE City='Delhi';
(iv) SELECT Item, Amount/Qty FROM SALES;

Q33.
A binary file "[Link]" stores student records as dictionaries with keys: Roll, Name,
Stream, Percent.
Write Python functions to:
(I) Display records of students whose Stream is "Science".
(II) Count and display number of students scoring more than 85 percent.
(Use pickle module.)

Q34.
Consider the tables:
Table: CUSTOMER(CID, CName, City)
Table: ORDERS(OID, CID, OrderDate, Total)
Write SQL queries for:
A) Display CName and City for customers who live in 'Bilaspur'.
B) Display OID and Total for orders placed after '2025-10-01'.
C) Display CName, OID and Total using an appropriate JOIN.
D) Set Total = Total + 500 for all orders whose Total < 5000.
OR,
Write any four differences between PRIMARY KEY and FOREIGN KEY.

Q35.
A MySQL table RESULT has fields: AdmNo INT, Name VARCHAR(30), Class INT, Marks INT.
Write a Python function TopperList() using MySQL‑Python connectivity to:
1. Accept a class number from user and display Name, Marks of students of that class
ordered by Marks (descending).
2. Display the count of students in that class.
Assume connection parameters are already available.

SECTION E

Q36.
A text file "[Link]" contains login records in the form:
"userid, date, status"
Example: "u105, 12-09-2025, SUCCESS"
Write Python functions to:
(I) CountSuccess() – count and display total number of SUCCESS logins.
(II) SearchUser(uid) – display all records of a given userid uid.
(Use text file handling.)
Q37.
A school plans a network with the following locations:
- PRIMARY Block : 40 computers
- SECONDARY Block : 55 computers
- SENIOR Block : 35 computers
- OFFICE Block : 15 computers
Distances:
- PRIMARY to SECONDARY: 70 m
- SECONDARY to SENIOR: 90 m
- SENIOR to OFFICE: 30 m
- PRIMARY to OFFICE: 140 m
Internet connection is required and a CCTV monitoring server must be centrally placed.
Answer:
(i) Which block is best for placing the server? Give one reason.
(ii) Suggest a suitable topology for connecting blocks in campus.
(iii) Suggest the best transmission medium for inter‑block connectivity.
(iv) Write any two measures to secure the network from unauthorized access.
(v) Name the protocol used for transferring web pages and its secure version.

***********

You might also like