Python Module Wise Important Questions
Python Module Wise Important Questions
MODULE-1
1. Explain working of while loop with examples. Also write a python program
to find the largest value from the given set of accepted values.
2. With syntax and example code, explain the working of definite loop in
python.
3. Write a python program to concatenate and compare two strings. Read the
strings from user.
4. Write a python program to demonstrate counting, summing and average of
elements using loops.
5. Explain fileopen, fileclose, fileread and filewrite concepts in python with
syntax and examples.
6. Write a python program to find the largest value from the given set of
accepted values.
7. Discuss string handling methods in python with example.
8. Write a python program to check whether a given string is palindrome or not.
9. Develop a python program for creating a copy and existing file.
10. Write a python program to generate and print prime numbers between 2 to
50.
11. What is string slicing. Explain the slicing operator in python with examples.
12. Write a python program to count the number of occurrence of a given word
in a file
13. Write a python function that takes decimal number as input and convert that
to binary equivalent and return the same.
14. List any six methods associated with strings and explain each of them with
an example.(String handling methods)
15. Write a python program to accept a filename from user:
(i)Display the first N-lines of the file.
(ii)Find the frequency of occurrence of the word accepted from the user in
the file.
MODULE-3
1. What is list? Lists are mutable. Justify the statement with examples.
2. Explain the concept of list slicing and list traversing with example.
3. How tuples are created in python? Explain different ways of accessing and
creating them.
4. Write a python program to read all the lines in a file accepted from the user
and print all email addresses contained in it. Assume the email address
contain only non-white space characters. Using Regular expression library.
5. What is dictionary? How is it different from list? Write a python program to
count occurrence of characters in a string and print the count.
6. Write a python program to search lines that start with 'X' followed by any
non whitespace characters, followed by ':' ending with number. Display the
sum of all these number.
7. With an example program, illustrate how to pass function arguments to list.
8. Explain difference between a list and a dictionary.
9. Make a list of first ten letters of the alphabet then using the slice operation
do the following:
a. Print the first three letters from the
list
b. Print any three letters from the
middle
c. Print the letters from 5th letters to
the end of the list
10. Discuss the lists handling functions in python with example.
11. Define tuple, explain DSU pattern. Write a python code to determinate tuples
by sorting a list of words from longest to shortest using loops
12. Explain the need of Regular expressions in python language.
13. Differentiate Pop and Remove methods on lists? Explain with an example for
each.
14. Compare and contrast lists and tuples.
15. Demonstrate (i) How a dictionary items can be represented as a list of tuples
(ii) How tuples can be used as keys in dictionaries?
16. Describe any two list operations and list methods. Write a python program to
accept ‘n’ numbers from user, find sum of all even numbers and product of
all odd numbers in entered list.
MODULE-4
1. Define class, object and attributes in python? what are programmer defined
types ? explain with example
2. What is a class? how to define a class in python? how to instantiate a class
and how the class members are accessed?
3. Explain pure functions and modifiers with an examples.
4. Explain what is type based dispatch with a python example.
5. What is the difference between method and function? Explain the working of
init method with suitable code.
6. Define attribute? With the help of python code, explain how functions return
instance values.
7. Write a program that uses class to store the name and marks of students. Use
list to store the marks in three subjects.
8. Explain initialization method with example.
9. Write a class Rectangle that has attributes length and breadth and a method
area which returns the area of the rectangle.
10. What is operative overloading and explain with an example
11. Write a python program that uses datetime module within a class ,takes a
birthday as input and prints the age and the number of days, hours,minutes
and seconds until the next birthday.
12. Define polymorphism . Demonstrate polymorphism with function to find
histogram to count the number of times each letter appears in a word and in
sentence.
MODULE-5