Subject Code:24CT11RC06 R-24 Reg No:
GAYATRI VIDYA PARISHAD COLLEGE OF ENGINEERING FOR WOMEN
(AUTONOMOUS)
(Affiliated to Andhra University, Visakhapatnam)
I [Link]. - II Semester Regular Examinations, June / July – 2025
PYTHON PROGRAMMING
(Common to CSE, IT, CSE(AI&ML))
1. All questions carry equal marks
2. Must answer all parts of the question at one place
Time: 3Hrs. Max Marks: 70
UNIT-I
1. a. Explain features of Python which make it a more sought-after language and
discuss the different application areas where Python is widely used [7M]
b. What are keywords in Python? List any seven Python keywords and briefly
explain the purpose of each. [7M]
OR
2. a. Write in detail about the data types in Python? [7M]
b. Explain the usage of the input() function and the print() function with examples and
also discuss how to handle different data types when taking input. [7M]
UNIT-II
3. a. Describe four different types of operators and provide examples of expressions
using each type. [7M]
b. What is the order of evaluation in Python expressions? Explain how parentheses
can be used to alter the default order of evaluation. [7M]
OR
4. a. Write a Python program that takes a list of numbers as input. Check whether each
number is even or odd and print the result. [7M]
b. Explain the purpose and usage of the break, continue and pass statements in Python.
Provide separate code examples for each. [7M]
UNIT-III
5. a. Describe how to create strings and access individual characters using positive and
negative indexing. Provide code to check for string palindrome. [7M]
b. Write a Python program that:
Creates a dictionary to store the prices of three different fruits
(e.g., "apple": 0.50, "banana": 0.25, "orange": 0.75).
Accesses and prints the price of one of the fruits using its key.
Adds a new fruit and its price to the dictionary.
Updates the price of an existing fruit in the dictionary.
Iterates through the modified dictionary and prints each fruit and its updated price. [7M]
OR
6. a. Explain the purpose and syntax of list comprehensions in Python. Write a program
to generate a list of squares of numbers from 1 to 10 using list comprehension. [7M]
b. How can slicing be used to extract a portion of a tuple? Provide examples of slicing
with positive and negative indices, as well as specifying a step. [7M]
UNIT-IV
7. a. Explain the different types of function arguments in Python with examples. [7M]
b. What is the lambda function in Python? How does it differ from a regular function? [7M]
OR
8. a. What are namespaces in Python? Provide an example illustrating how it prevents
naming conflicts when working modules and functions. [7M]
b. Create a Python package with two modules: one for math operations and one for
string operations. Demonstrate how to import and use these modules. [7M]
UNIT-V
9. a. Explain the difference between class variables and object variables in Python. How
are they defined and accessed? [7M]
b. What is method overriding in Python? Write a Python program to demonstrate
method overriding using inheritance. [7M]
OR
10. a. Explain the role of the try, except, and finally blocks in Python's exception handling
mechanism with an example program. [7M]
b. What are the different modes for opening files in Python. Write a Python program to
reverse the content of the file [7M]