Python Question bank - module 1 and 2
Python Question bank - module 1 and 2
3rd semester
Question Bank
Module 1: Python Fundamentals
1. What are reserved words and variables?
2. Explain the two translators.
3. Explain print(), input() and string replications.
4. Explain different operators used in python and their order/precedence. Show steps to
evaluate the expression: 4+5*6+2**3
5. Explain different logical operators used in python with example.
6. What is a flow control statement? Discuss if and if else statements with flow chart.
7. Write a python program to add n numbers accepted from the user.
8. Write a python program to calculate area of square, rectangle and circle. Take the
input from the user. Print the results.
9. Write a program to find if the given number is odd or even.
10. Explain Conditional Execution, Alternative execution, Chained conditionals and
Nested conditionals with examples.
11. With Python programming examples to each, explain the break and continue
statements.
19. Write a Python Program to prompt the user for hours and rate per hour for pay
computation with time and a half for overtime to give the employee 1.5 time the
hourly rate for hours worked above 40 hours.
Module 2:
Functions
1. Explain a function with example and its syntax.
2. Explain and give examples of built-in functions.
3. Write a note on math functions.
4. What is user defined functions? How can we pass parameters in user defined
functions? Explain with suitable example.
12. What are String Slices? Explain the Slicing Operator in Python with examples.
13. Perform the below actions on the string ‘say your name backwords’ using the python
statements
a. Length of string
b. Print 11th character and last character
c. Print only ‘say your name’
d. Insert ‘buddy’ and print ‘say your name backwords BUDDY’
14. Read the below sentence as string:
The proverb 'Health is wealth' means that one's health is the greatest wealth
@gmail.com
i. Print the line that starts with t
ii. Identify the position of @
15. Explain rstrip(), strip(), startwith().
16. Explain join(), islower() and split() string methods with examples.
17. What are String Slices? Explain the Slicing Operator in Python with examples.
18. List and explain any four built in string manipulation functions supported by Python
with examples.
19. Write a Python program to swap cases of a given string.
Input: Java
Output: jAVA
20. If S= ‘Hello World’, explain and write the output of the following statements:
i) S[1:5] ii)S[:5] iii)S[3:-1] iv)S[:]
21. Write a Python program to find the length of a string without using inbuilt function.
Module 3:
Lists
*** * ***