Roll No. …………………..
TCS–151
[Link]. (CSE)
(Second Semester)
EXAMINATION, 2024-25
INTRODUCTION TO PYTHON PROGRAMMING
Time : 2 1 Hours
2
Maximum Marks : 60
Note : Question paper has three Sections. Read
carefully instructions for each Section.
Section—A
(Very Short Answer Type Questions)
1. Attempt all questions. 1 each
(a) What is Python ? (CO1, RE)
(b) Who developed Python and in which year ?
(CO1, RE)
P. T. O.
[2] TCS–151
(c) Write any two features of Python. (CO1, RE)
(d) What is the use of the .py extension ?
(CO1, RE)
(e) Define type casting in Python. (CO1, RE)
(f) How do you declare a variable in Python ?
(CO1, RE)
(g) What is the difference between mutable and
immutable data types ? (CO2, RE)
(h) What is the subscript operator ([]) used for in
Python (CO2, RE)
(i) Write the syntax of a for loop in Python.
(CO2, RE)
(j) What is the purpose of the break statement ?
(CO2, RE)
(k) Define recursion in Python. (CO4, RE)
(l) What is operator overloading ? (CO5, RE)
Section—B
(Short Answer Type Questions)
2. Attempt all questions. 4 each
(a) Build a program in python to check if a given
number by user in an Armstrong number or
not. (CO2, CR)
[3] TCS–151
OR
Build a program to find largest number among
three numbers ? (CO2, CR)
(b) Explain arbitrary arguments (*args and
**kwargs) with an example. (CO4, UN)
OR
Explain Recursive function with an
appropriate example. (CO4, UN)
(c) Write a Python function process-data that
takes a list of integers as input. The function
should iterate through the list and perform the
following operations :
(i) For each even number, calculate its
square and append it to a new list called
even-squares.
(ii) For each odd number, calculate its cube
and append it to a new list called
odd-cubes.
(iii) Return a dictionary containing the
even-squares and odd-cubes lists with
the keys ‘even’ and ‘odd’ respectively.
(CO3, CR)
P. T. O.
[4] TCS–151
OR
Write a Python program to demonstrate Loop
manipulation using pass, continue and break.
(CO3, EV)
(d) Write a Python program to explain list slicing
with examples. (CO2, EV)
OR
Explain the concept of mutable and
immutable data types in Python. (CO2, UN)
(e) Write a Python program to demonstrate the
use of the math module. (CO5, CR)
OR
Differentiate between text files and binary
files in Python. (CO5, UN)
(f) What is polymorphism ? Explain with an
example. (CO5, RE)
OR
Explain file handling operations in Python
with suitable examples. (CO5, UN)
Section—C
(Long Answer Type Questions)
3. Attempt all questions. 8 each
(a) Describe the history of Python along with its
key features. (CO1, RE)
[5] TCS–151
OR
Explain the different data types available in
Python with examples. (CO1, RE)
(b) Write a Python program to demonstrate the
use of Assert statements. (CO3, CR)
OR
Write a Python program that demonstrates
run-time error handling using try, except, else,
and finally blocks. (CO3, CR)
(c) What is recursion ? Write a recursive Python
program to calculate the factorial of a number.
(CO4, AP)
OR
Write a python program to print different
patterns explained below :
(i) Square pattern
(ii) Right angle Triangle (CO4, EV)
×××××
TCS–151 860
P. T. O.