Question Bank
Course : B.Tech
Branch : CSE/IT
Year / Sem : 2nd Year / 4th Sem
Subject : Python Programming (KNC-402)
Unit 1
Q1. What do you mean by Python IDE? Explain in details.
Q2. What will be the output of the following Python code?
i=0
while i< 3:
print(i)
i += 1
else:
print(0.
Q3. Write Short Notes with example: Elements of Python, Type Conversion in Python, Operator
Precedence and Boolean Expression.
Q4. Discuss ADT in Python. How to define ADT in Python? Write code for a student
Information.
Q5. What will be the output of the following Python code?
def cube(x):
return x * x * x
x = cube(3)
print x
Unit 2
Q.1 Explain the Purpose and Working of the Loops. Discuss Break and Continue with Example.
Write a Program to convert time from 12 hour to 24 hour format.
Q.2 Write a Python program to construct the following pattern, using a nested for loop.
*
**
***
****
*****
****
***
**
*
Q.3 Explain why python is considered an interpreted language.
Q.4 Mention five benefits of Python.
Q.5 Explain Expression Evolution & Float Representation with Example.
Unit 3
Q.1 Write a Python program to change a given string to a new string where the first and last chars
have been exchanged.
Q2. Write a Python program to add an item in a tuple.
Q3. Write a Recursive function in python Binary Search (Arr,l,R,X) to search the given element
X to be searched from the List Arr having R elements, where l represent slower bound and R
represents the upper bound.
Q4. Explain higher Order functions with respect to the lambda expression. Write a python code to
Count Occurrences of an element in the list
Q5 Explain Unpacking sequences, Mutable Sequences, and List Comprehension with example.
Write a program to sort list a dictionaries by values in python-Using lambda function.
UNIT 4
Q1.Explain the algorithm Sieve of Eratosthenes used in Python Programming.
Q2.Solve the Tower of Hanoi problem for n= 3 disk and show all the steps.
Q3.What is File input and output operations in Python Programming?
Q4. How to create and import a module in Python?
Q5. Discuss and Differentiate iterators & Recursions. Write a program for Recursive Fibonacci
series.
UNIT 5
Q1. Explain the terms Merge List and Merge Sort in Python Programming.
Q2. Solve the Tower of Hanoi problem for n= 3 disk and show all the steps.
Q3. Explain different type of sorting with example. Write a program for sieve of
Eratosthenes
Q4. Write a program to perform linear search and Binary search.
Q5. What are File input and output operations in Python
Programming?