0% found this document useful (0 votes)
7 views

Python Question bank - module 1 and 2

This document is a question bank for a Python Application Programming course, covering various topics such as Python fundamentals, functions, strings, and lists. It includes questions on reserved words, flow control statements, exception handling, user-defined functions, string manipulation, and list operations. Additionally, it contains programming exercises that require writing Python code to solve specific problems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Python Question bank - module 1 and 2

This document is a question bank for a Python Application Programming course, covering various topics such as Python fundamentals, functions, strings, and lists. It includes questions on reserved words, flow control statements, exception handling, user-defined functions, string manipulation, and list operations. Additionally, it contains programming exercises that require writing Python code to solve specific problems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Python Application Programming -22ECE136

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.

12. Explain the rules of precedence used by Python to evaluate an expression.

13. List the comparison operators with examples in Python.


14. Demonstrate the use of try and except with an example in Python.
15. Write a Python Program with exception handling code to solve divide-by-zero error
situation.
16. Implement a Python code which prompts the user for Celsius temperature. Convert
the temperature to Fahrenheit and print out the converted temperature by handling the
exception.
17. Develop a Python program to generate Fibonacci sequence of length (N). Read N
from the console.
18. Write a program to prompt for a score between 0.0 and 1.0. If the score is out of
range, print an error message and exit. If the score is between 0.0 and 1.0, print a
grade using the following table:

Score >=0.9 >=0.8 >=0.7 >=0.6 <0.6


Grade A B C D F

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.

5. Write a python program to generate random numbers from 25 to 100.


6. Write a function to calculate factorial of a number.

7. What is a function? How to define a function in python? Write a program using

function to find out the given string is palindrome or not.

8. Differentiate between argument and parameter. Illustrate the flow of execution of a


python function with an example program to convert Celsius to Fahrenheit
temperature.
9. Write a program to add two numbers by writing a function that adds the numbers.
10. Write a Python program to find the smallest value from the given set of accepted
values.
11. What is user defined function? Write a function to check if a given number is prime or
not ?
Strings:

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

1. Discuss list and with example


2. Explain the concept of slicing and indexing in lists with proper examples.
3. Write a python program to accept n numbers and store them in a list. Then print the
list without ODD numbers in it.
4. What are the different methods supported in python List. Illustrate all the methods
with an example.
5. For a given list num=[45,22,14,65,97,72], write a python program to replace all the
integers divisible by 3 with “ppp” and all integers divisible by 5 with “qqq” and replace
all the integers divisible by both 3 and 5 with “pppqqq” and display the output.
6. What is list? Explain append(), insert() and remove() methods with examples.
7. Explain the methods that are used to delete items from the list.
8. Write a program to take a sentence as input and display the longest word in the given
sentence.

*** * ***

You might also like