0% found this document useful (0 votes)
66 views4 pages

Python Question Papers

Uploaded by

Kaushal Shakya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views4 pages

Python Question Papers

Uploaded by

Kaushal Shakya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Set – 1

End Semester Examination, Dec 2025


B.Tech. – CSE, 3rd Semester
Course Code: 5.0CE202E02H (Python)
Time: 3 Hrs | Max Marks: 80

Q.1 [CO1–CO4 | BTL 1–3 | 2×10 = 20 Marks]


Answer all:
a) Define mutable and immutable data types in Python with one example each. [CO1 |
BTL1]
b) Differentiate between while and for loops. [CO1 | BTL2]
c) Write a Python expression to compute the cube of a number without using **. [CO1 |
BTL3]
d) List two differences between tuple and list. [CO2 | BTL2]
e) Write Python code to add two sets {1,2,3} and {3,4,5}. [CO2 | BTL3]
f) Define recursion with a simple factorial function example. [CO3 | BTL2]
g) What is method overloading? Can it be achieved directly in Python? [CO3 | BTL2]
h) Write a simple Python class Student with attributes name and roll_no. [CO3 | BTL3]
i) State one advantage of using NumPy arrays over Python lists. [CO4 | BTL2]
j) Mention two Python libraries used for image processing. [CO4 | BTL1]

Q.2 [CO1 | BTL 2–4 | 15 Marks]


(a) Explain different data types in Python with suitable examples. [CO1 | BTL2] (7.5)
(b) Write a Python program to display Fibonacci series up to n terms using a loop. [CO1 |
BTL3/4] (7.5)

Q.3 [CO2, CO3 | BTL 3–5 | 15 Marks]


(a) Write a function in Python that accepts a list of numbers and returns the second
largest element. [CO2 | BTL3/4] (7.5)
(b) Define inheritance. Write Python code to demonstrate multilevel inheritance with
Person → Student → ResearchScholar. [CO3 | BTL4/5] (7.5)

Q.4 [CO4 | BTL 3–5 | 15 Marks | Unit 5]


(a) Write Python code using NumPy to create a 3×3 identity matrix and compute its
transpose. [CO4 | BTL3/4] (7.5)
(b) Create a Pandas DataFrame of 5 students with columns Name, Age, Marks. Write
code to:
- Display students with Marks > 70
- Compute average marks
[CO4 | BTL4/5] (7.5)

Q.5 [CO4 | BTL 2–5 | 15 Marks | Unit 6]


(a) Explain any three image-processing functions from PIL with code examples. [CO4 |
BTL2/3] (7.5)
(b) Write Python code using Matplotlib to plot a bar chart of student names vs marks.
[CO4 | BTL4/5] (7.5)
Set – 2
End Semester Examination, Dec 2025
B.Tech. – CSE, 3rd Semester
Course Code: 5.0CE202E02H (Python)
Time: 3 Hrs | Max Marks: 80

Q.1 [CO1–CO4 | BTL 1–3 | 2×10 = 20 Marks]


Answer all:
a) What is the difference between is and == operators? [CO1 | BTL2]
b) Write Python code to reverse a string "HELLO". [CO1 | BTL3]
c) Define list slicing with an example. [CO2 | BTL2]
d) Write a program to count frequency of elements in a tuple. [CO2 | BTL3]
e) Differentiate between remove() and pop() in lists. [CO2 | BTL2]
f) Write a recursive function to calculate the sum of first n natural numbers. [CO3 |
BTL3]
g) Define constructor in Python. Give an example. [CO3 | BTL2]
h) Create a class Circle with methods to compute area and circumference. [CO3 | BTL3]
i) What is broadcasting in NumPy? [CO4 | BTL2]
j) Mention two differences between OpenCV and PIL. [CO4 | BTL1]

Q.2 [CO1 | BTL 2–4 | 15 Marks]


(a) Explain different control statements in Python with examples. [CO1 | BTL2] (7.5)
(b) Write Python code to check whether a number is prime or not. [CO1 | BTL3/4] (7.5)

Q.3 [CO2, CO3 | BTL 3–5 | 15 Marks]


(a) Write a program to merge two dictionaries and remove duplicate keys. [CO2 |
BTL3/4] (7.5)
(b) Explain types of inheritance in Python with code examples. [CO3 | BTL4/5] (7.5)

Q.4 [CO4 | BTL 3–5 | 15 Marks | Unit 5]


(a) Using NumPy, create a 2D array of shape (4,4). Perform slicing to extract a 2×2 sub-
matrix. [CO4 | BTL3/4] (7.5)
(b) Write Python code to read data from a CSV file into Pandas and display only the first
5 rows. [CO4 | BTL4/5] (7.5)

Q.5 [CO4 | BTL 2–5 | 15 Marks | Unit 6]


(a) Write short notes on scaling, rotating, and converting an image to grayscale using
Python libraries. [CO4 | BTL2/3] (7.5)
(b) Write Python code using Matplotlib to plot a line chart for monthly sales (Jan–June).
[CO4 | BTL4/5] (7.5)

You might also like