UIT(Autonomous) RGPV, BHOPAL
Total Printed Pages:-02 Roll No:……………………….
I YEAR BE/B-Tech Examination-NOVEMBER-DECEMBER - 2025
Subject Code: CS-205
Subject Name: Program & Problem Solving with Python
Time: 3 Hrs Max. Marks: 105
Min. Marks:
Note: (i) Answer all five questions. All questions carry equal marks.
(ii) In each question parts a, b, and care compulsory and part d has an internal choice. Out of which part a
(Maximum 50 words) carry 3 marks, part b & c (Maximum 100 words) carry 4 marks, and part d (Maximum
400 words) carry 10 marks. Word limit would not be followed for (except) diagrams, numerical
derivation,etc.
(iii) All parts of each question are to be attempted in one place.
(iv) Assume missing data, if any, suitably.
Q. No. Questions CO
1(a) Explain the role of comments in Python. Why are comments important in a program? CO1
(b) Find the output of the following code CO1
x = 5, y = 2
result1 = x + y * 2
result2 = (x + y) * 2
result3 = x > y and y > 0
print(result1, result2, result3).
(c) What are tokens in Python? Explain different types of tokens with examples. CO1
(d) Analyze the evolution of Python and compare CPython, Jython, IronPython, and Stackless CO1
Python based on their features and use cases.
OR
(e) Differentiate between operators and expressions in Python? Write a Python program to CO1
demonstrate the use of arithmetic, relational, and logical operators with examples.
2 (a) Differentiate between local and global variables in Python with examples. CO2
(b) What are lambda functions in Python? Explain their syntax and advantages with examples. CO2
(c) Write an algorithm to check whether a given number is palindrome or not. CO2
(d) What is a function in Python and what are its advantages? Write a Python program to find the CO2
factorial of a number using a function.
OR
(e) Explain decision-making statements in Python (if, if-else, if-elif-else, nested if) with syntax and CO2
examples. Also discuss conditional expressions.
3(a) Write a Python program to access the first and last element of a list. CO3
(b) What is a list in Python? How is it different from strings? Explain with examples. CO3
(c) Write a Python program to count the number of vowels and consonants in a given string entered CO3
by the user.
(d) Differentiate between linear search and binary search procedures and Write the pseudocode to CO3
implement binary search. Search the value “14” from the following sequence of numbers:
2, 5, 10, 14, 15, 30, 38
OR
(e) What are lists in Python? Explain list creation and element access using indexing and slicing, CO3
and describe built-in list functions such as append, extend, insert, remove, pop, sort, and reverse
with examples.
4 (a) What is the purpose of the self parameter in a Python class? CO4
(b) Explain method overriding? How is it achieved in Python? CO4
(c) Write a Python class 'Rectangle' with attributes length and breadth. Add methods to calculate CO4
area and perimeter.
(d) Describe what is Inheritance and Write a Python program to create a parent class 'Person' with CO4
attributes name and age, and a child class 'Employee' inheriting from Person with additional
attribute salary.
OR
(e) Explain constructor and destructor in Python classes. Write a program demonstrating their use CO4
with object creation and destruction.
5(a) Explain the seek() function in Python with syntax and example. CO5
(b) Differentiate between errors and exceptions in Python with examples. CO5
(c) Write a Python program to read content from a text file and count the number of lines, words, CO5
and characters.
(d) Write a Python GUI program using Tkinter to create a student registration form with labels, CO5
entry widgets, and buttons to save data to a file.
OR
(e) Explain file handling in Python with different file modes, reading and writing operations, and CO5
the seek() function. Differentiate between text files and binary files with examples.