Sub Code: CST-005 ROLL NO……………..……………..
ODD SEMESTER EXAMINATION, 2023 – 24
IInd yr B.Tech.
Python Programming
Duration: 3:00 hrs Max Marks: 50
Note: - Attempt all questions. All Questions carry equal marks. In case of any ambiguity or missing data,
the same may be assumed and state the assumption made in the answer.
Q 1. Answer any two parts of the following. 5x2=10
a) What do you mean by Python IDE? Explain in detail.
b) Write a Python program to construct the following pattern, using a nested for
loop.
*
**
***
****
*****
****
***
**
*
c) Explain the following terms briefly. Also, list some of their applications :
● Tuples
● Lists
● Dictionary
● Set
Q 2. Answer any two parts of the following. 5x2=10
a) Explain why Python is considered as an interpreted language.
b) Explain with the help of program how can you randomize the items of a list in
place in Python?
c) Write a Program to display Fibonacci sequence upto 20 terms.
Q 3. Answer any two parts of the following. 5x2= 10
a) Discuss what are file input and output operations in Python Programming?
b) Explain any five basic operators of Python with examples.
c) Write the output of the given Python codes :
i)
ii)
Q 4. Answer any two parts of the following. 5x2= 10
a) Write a Python program to capitalize the first and last character of each word in
a string. (input string- hello world)
b) State whether the following statement is true or false.
1. Python is a case-sensitive language.
2. Python is an object-oriented language.
3. Variable declaration is implicit in Python.
4. When executing a Python program, Python first compiles source code(file
statement) into a format known as pseudo-code.
5. An int can be converted to a string while a string cannot be converted to an
int.
c) Explain why Python has become one of the most popular language among the
programmers. Also, highlight the features of Python.
Q 5. Answer any two parts of the following. 5x2= 10
a) Write the output of the given Python codes :
i)
ii)
b) Explain the following:
1. Global variable and Local Variable
2. What are Python modules? Name some commonly used built-in modules in
Python.
c) Explain the concept of file handling in Python. Also, differentiate between text
files and binary files.
**********