MATURI VENKATA SUBBA RAO (MVSR) ENGINEERING COLLEGE
NADERGUL, HYDERABAD-501510
(Sponsored by Matrusri Education Society, Estd.1980)
An Autonomous Institution
Approved by AICTE & Affiliated to Osmania University, Estd.1981
ISO 9001:2015 Certified Institution, Accredited by NAAC
website: www.mvsrec.edu.in
Subject: Programming for Problem Solving using Python Acad.Yr:2023-24
Class: B.E-I/IV, Sem-2 Branch: CSE(A,B,C,D), IT(A,B,C)
QUESTION BANK
UNIT-1
Short Answer Questions
1. List out the features of python
2. List out the data types in python
3. Differentiate compiler and interpreter
4. What is the use of sep and end parameters in the print() function?
5. What do you mean by Type casting? Give examples.
6. What is an operator precedence? Give an example.
7. Compare all sequence data types
8. What is indentation? What is its role in python?
9. Compare break and continue
10. What is the use of the ‘pass’ statement?
11. What are input and output statements in python? Give examples.
12. What is the use of the range() function? Explain with an example.
Long Answer Questions
1. Explain the different procedures for writing and executing a python program.
2. Explain in detail about Operators in python
3. Explain in detail about Selection statements in python
4. Explain in detail about Iteration statements in python
5. Explain in detail about Jump statements in python
6. Discuss about strings and its operations in python
7. Discuss about List and its operations in python
8. Discuss about Tuple and its operations in python
9. Discuss about Set and its operations in python
10. Discuss about Dictionary and its operations in python
UNIT-2
Short Answer Questions
1. Compare recursion and iteration
2. Can a function return multiple values? If yes,explain with suitable examples.
3. What is a module? How to create it and use it?
4. List out the different ways of loading a module into a python program.
5. List out any five builtin modules in python.
6. What is meant by scope and lifetime of variables? Give an example.
7. What is the use of ‘global’ keyword? Given an example.
Long Answer Questions
1. Explain any ten builtin functions with necessary syntax and examples.
2. Discuss in detail about lambda functions
3. What are command line arguments? Explain with an example.
4. “A python function can accept default arguments”. Justify the statement.
5. How to pass variable-length arguments in python? Explain with examples.
6. What are keyword arguments? Explain with an example.
7. Discuss about os module and its builtin functions
8. Discuss about math module and its builtin functions
9. Discuss about statistics module and its builtin functions
10. Discuss about random module and its builtin functions
UNIT-3
Short Answer Questions
1. What is OOP? List out its principles.
2. Define class and object. Give syntax with an example.
3. Compare class attribute and data attribute(instance/object attribute)
4. What is the use of self argument?
5. Define Inheritance.What is the use of it?Mention its types.
6. What are private and public members?
7. What is data encapsulation?Give an example.
Long Answer Questions
1. Discuss in detail about OOP principles.
2. Explain in detail the concept of class and object with syntax and examples.
3. Write short notes on constructors and their types with proper syntax and examples.
4. “Using class we can create multiple objects in python”. Justify the statement with your answer.
5. Distinguish between operator overloading and method overloading
6. Explain method overriding
7. Discuss about data hiding
UNIT-4
Short Answer Questions
1. Define exception.How is it different from Error?
2. What is the use of try-except-finally blocks?
3. What is the use of the else block and raise keyword?
4. List out the different modes of file.
5. What are the operations performed on file?
6. How to rename and delete a file in python?
7. What is the purpose of GUI?Mention its advantages.
8. List out few GUI widgets
9. What is the use of the tkinter module?
Long Answer Questions
1. Discuss about any three built in exceptions
2. Explain about custom exceptions with an example program
3. Discuss about file paths
4. Explain about file positions in detail
5. Write short notes on following GUI Widgets
a. Label
b. Button
c. Entry
d. Combobox
6. Write short notes on following GUI Widgets
a. Radiobutton
b. Checkbutton
c. Text
d. messagebox
UNIT-5
Short Answer Questions
1. What is the use of numpy module?
2. How to create 1-d and 2-d arrays using numpy?
3. Differentiate between copy() and view() functions in numpy.
4. Differentiate between shape and reshape in numpy
5. What is the use of the pandas module?
6. What are the different ways of storing data using a Series object?
7. What is the use of the matplotlib module?
8. How to plot a graph using a Series object?
9. How to generate pie charts using the matplotlib module?
10. How to plot bar graphs and scatter graphs using the matplotlib module?
Long Answer Questions
1. Explain about sorting,searching and filtering array in numpy
2. Discuss about joining and splitting an array in numpy
3. Discuss any Ten built-in methods of numpy array
4. Explain about Series and DataFrame objects in pandas
5. What are the different ways of plotting graphs?Explain.
6. Discuss about head(),tail() and info() methods in DataFrame object
Programs to Practice
1. Using Selection Statements
a. Check a given number is leap year or not
b. Check a given number is gapful or not
c. Check a given number is even or odd and positive or negative
d. Check a given number x is divisible by y or not
e. Check whether a given element exists in a list of items or not
f. Find the number of occurrences of each word in a given sentence.
g. Create two sets s1,s2 with few items. Display all unique items and all repeated items from
both sets.
2. Using Loops
a. Check the given number is palindrome or not
b. Find the sum of the digits of a given number. Number should contain more than one digit.
c. Print the following patterns upto N rows
i. a ii. * * * *
a b * * *
a b c * *
a b c d *
3. Using Jump statements
a. Print first N odd numbers
b. Print sum of N numbers. Program should stop if a negative number is given.
4. Using Functions
a. define a function to swap two given numbers x,y
b. define a function to find sum of 0 to N numbers using variable length arguments
c. define a function to read a string and return its length, swapped and reversed string
5. Using Recursive functions
a. define a recursive function to return the sum of the digits
b. define a recursive function to return the sum of N natural numbers.
6. Using OOP principles
a. Create a class “Student” with fields name,rollno,branch,marks. Store and display N
student details. Use necessary constructors and methods.
b. Create a class “Vehicle” with following members:
Data attributes: vname, regid,type,price,model.
Class attribute: owner
Methods: constructors,Destructors and getDetails().
Store and display N vehicles.
c. Write a program to implement multilevel and hierarchical inheritance
d. Write a program to overload ‘+’ and ‘-’ operator
e. Write a program to demonstrate method overriding
f. Create a class ‘Demo’ that contains a private attribute, a public attribute,a private method
and a public method. Create an object for the Demo class and call the public method
which should print all attributes and also call the private method of Demo.
7. Exception Handling
a. Write a program to handle IndexError,ValueError and ZeroDivisionError using multiple
except blocks
b. Write a program to handle any four exceptions using single except block
c. Write a program to handle custom exceptions
8. File Handling
a. Write a program to create a file and write some data to the file
b. Write a program to read a file and display the contents of file
c. Write a program to copy the contents from one file to another file
d. Write a program to display the contents of file in reverse order
e. Write a program to read a file and display the number of lines, words and characters in
that file.
9. GUI Programming
a. Design a GUI to perform addition and subtraction of two numbers
b. Design a GUI to implement a Login application
10. Using Numpy module
a. Write a program to create two 2-d arrays and perform addition,subtraction,multiplication
of two matrices using numpy
b. Write a program to generate an identity matrix and transpose of a given matrix using
numpy
c. Write a program to create a 2-d array and find the sum and product of all elements,all
rows and all columns
d. Write a program to create a 1-d array of N elements and sorting and searching in the array
using numpy
11. Using Pandas module
a. Write a program to create a pandas Series object, insert ten elements using dictionary and
display the Series
b. Write a program to create a pandas DataFrame object,insert five student
details(rno,name,branch,marks) and display the DataFrame
c. Write a program that reads a csv file and displays employee
details(eid,name,salary,experience,company) from the csv file.
d. Write a program to demonstrate on DataFrame methods like head(),tail(),count(),info()
e. Write a program to demonstrate on any three pandas Series methods
12. Using Matplotlib module
a. Write a program to plot a simple line graph using matplotlib
b. Write a program to plot a sample bar graph using matplotlib
c. Write a program to plot a sample pie chart using matplotlib
d. Write a program to plot a sample scatter graph using matplotlib
*****THE END*****