Python Programming
1. Explain any Four of the following:
a) Features of Python b) Modules in Python
c) Mutable & immutable d) Explain break, continue and pass of Python
e) Lambda Function
2. Explain conditional statements in Python
3. Explain how to access Strings, also various methods associated with it
4. What do you mean by function? Explain function and it’s type with suitable example
5. What is dictionary? Explain with suitable example
6. Write a program to open a textfile ‘emp1’ and ‘emp2’ and store all the information of
both the files in ‘ emprecord’ file
7. Write a program to validate date pattern using regexp (2022-05-11)
8. Write a program to create a derived class current_ account from Account class derived
class consist two method deposit and withdraw display the deposit and withdraw amount
9. Write a program to perform basic CRUD operations with MongoDB
10. Short notes on
a) Series in pandas b) Visualization Tools c) Universal Array Function
11. Write a program to check the number entered by user is even or odd. Program should
accept integer digits only.
12. Illustrate types of arguments used in python function with example.
13. Discuss the polymorphism concept in python create suitable python classes.
14. Write a python program for the following.
i) Create list of fruits ii) Add new fruit in list.
iii) sort the list. iv) delete last fruit name from list.
15. Write a python function to check the given number is even or odd. Handle suitable
exceptions.
16. Explain constructor concept in python with example.
17. Write a python program to create an employee. txt file and store employee name and
address.
18. Write a python program to create “employee” collection with fields” (ID, name, address,
phone email and dept) in mongoDB. Prform the following operations.
i) Display all employees in “Accounts” department
ii) Delete employee with ID - 210345
iii) Update phone with new phone for employee ID -123
19. What is tuple? What is the difference between list and tuple?
20. What is set? Explain with example
21. Write a program to retrieve and display employee details from “Employee” collection
stored in mangoDB database.
22. Write a program to update the employee details stored in “Employee” collection stored in
Mangodb database.
23. Write python program to read “employee” . txt” file and display alternate employee
record
24. Write a program for extracting email address from a given webpage
25. What is synchronization in threading? Explain with example.
26. What is module? Explain with example.
27. Write a program to validate URL using regular expression. Explain every special
character of the regular expression used in this program.
28. Write a multithreading program, where one thread prints square of a number and another
thread prints factorial of a number. Also display the total time taken for the execution.
29. What is anonymous function in python? Demonstrate with example
30. Create 5×5 2D numpy assay and retrieve top left corner 2×2 array from it.
31. Write a program to illustrate slicing in numpy array.
32. Create paundas dataframe using two dimensional list. Perform following operations.
i) Count number of rows.
ii) Count missing values in first column.
iii) Display number of columns in data frame
33. Explain the terms w.r.t. oops in python.
i) -- lnit-- ii) Self
34. Create 3×3 numpy array and display column wise mean and median.
35. Create a series from numpy array and find max and mean of unique items of series.
36. Given data frame as below:
ID Name HRA TA DA
1001 Mohan 12000 6000 10000
1002 Sachin 13000 5000 9000
1003 Virat 11000 4000 8000
i) Compute sum of each column.
ii) Compute mean of each integer column.
iii) Compute median of each integer column.
37. Explain overloading in python with example.
38. Write a program that accept the string from user and display the same string after
removing vowels from it.
39. Explain possitional and keyword arguments in function. Use suitable example.
40. Describe instance variable, static variable and local variables in python object oriented
programming with example
41. Compare List and tuple with suitable example.
42. Explain lambda with example
43. Create class called, library with data attributes like Acc-number publisher, title and
author, the methods of the class should include
i) Read ( ) - Acc- number, title, author, publisher.
ii) Compute ( ) - to accept the number of day late, calculate and display the fine
charged at the rate of Rupees 5/- per day.
iii) Display the data
44. Develop a program to print the number of lines, words and characters present in the given
file? Accept the file name from user. Handle necessary exceptions.
45. Illustrate CRUD operations in MongoDB with example
46. Compare SQL Database with No SQL Database
47. Write aprogram to check whether entered string & number is palindrome or not.
48. Develop a pythan program to remove the comment character from all the lines in the
given file. Accept the file name from user
49. Write a pythan program to perform following operations. on MongoDB Database.
i) Create collection “EMP” with fields: Emp-name, Emp- mobile, Emp, sal, Age
ii) Insert 5 documents.
iii) Find the employees getting salary between 5000 to 10000.
iv) Update mobile number for the employee named as “Riddhi”
v) Display all employees in the order of “Age”
50. Write a pythan program to find the factorial of a given number using recursion
51. Write a program to demonstrate:
i) Creating a Thread without using any class
ii) Creating a Thread by extending Thread class.
52. Write a Pythan program to check the validity of a password given by [Link] password
should satisfy following criteria:
a. Contain at least 1 letter between a and z
b. Contain at least 1 number between 0 and 9
c. Contain at least 1 letter between A and Z
d. Contain at least 1 character from $, #, @,*
e. Minimum length of password : 8
f. Maximum length of password : 20
53. Explain Generators in python with suitable example.
54. Write a program for synchronization of threads using RLOCK. Accept the two numbers
from user and calculate factorial of both numbers simultaneonly
55. Write a pythan program
i) To remove all leading ‘zeros’ from an IP address
ii) ii) To find all 5 character long words in a string Accept string from
56. Explain decorators in pythan with suitable example
57. Explain numpy integer indexing, array indexing. boolean array indexing and slicing with
example.
58. Draw bar graph using matplotlib and decorate it by adding various elements
59. Prepare the pandas dataframe from csv file.
perform following operations.
i) Fill all ‘NaN’ values with the mean of respective column.
ii) Display last 5 rows.
60. Explain constructors in pythan with example
61. Write a program to illustrate numpy array attributes/functions.
i) ndarray. shape
ii) np. zeros ( )
iii) np. eye ( )
iv) np. random. random ( )
62. Read data from csv five and create dataframe. Perform following operations.
i) Display list of all columns.
ii) Display data with last three rows and first three columns
63. Draw line graph using matplot lib and decorate it by adding various elements. Use
suitable data.
64. Explain multiple inheritance in python with suitable example.
65. Write a program to check if the input year is leap year or not. Validate the input
66. Write a program to find the factorial of a number using recursion.
67. What is inheritance? Explain the concept of multiple inhertance with the help of suitable
example.
68. Write a program to print the sum of natural numbers using recursion.
69. What is inheritance? Explain the concept of multilevel inheritance with the help of
suitable example.
70. Write a program to reverse each word of “[Link]” file
71. Write a python program using MongoDB database to create a “Books” collection having
fields: title, Author (a list), Publisher, PubAddress, (a dict with keys like area, city,
country), Price, ISBN. Accept input from user to insert documents
72. Write a mongoDB program to update the “Books” collection having fields: title, Author
(a list), Publisher, PubAddress, (a dict with keys like area, city, country), Price, ISBN.
Accept input from user to insert documents.
73. Write a program to accept decimal number and print its octal and hexadecimal equivalent
74. Write a program to read the contents of file and display occurrance of given character
75. Write a python program using mongoDB database to create a “student” collection having
fields: Student-ID, Name, Course, Mobile, Address. (a dict with keys like area, city,
country, pin) Accept input from user to insert documents
76. What is dictionary in Python? Explain with examples.
77. Write a program to validate email address using regular expression. Also explain the
meaning of each and energy special character of the regular expression used by you in
this program.
78. Write user defined exception program in python which will except age as an input from
the user and check whether the user is eligible for voting or not. If age
79. Write a Note on : Modules and packages in Python.
80. Write a program to validate URL using regular expression. Also explain the meaning of
each and every special character of the regular expression used by you in this program.
81. Write multithread program, where one thread prints square of a number and another
thread prints cube of numbers. Also display the total time taken for execution.
82. Explain anonymous function with example.
83. Create a 5×5 2D numPy array and retrieve bottom right corner 2×2 array from it
84. Given a dataFrame df in Pandas as below:
City MaxTemp MinTemp RainFall
Delhi 40 32 24.1
Bengaluru 31 25 36.2
Chennai 35 27 40.8
Mumbai 29 21 35.2
Kolkata 39 23 41.8
Write commands:
i) to compute sum of every column of the dateFrame.
ii) to compute mean of column rainFall.
iii) to compute Median of the MaxTemp column.
iv) to display all column names
85. Explain constructors in Python.
86. Create a 4×3 numPy array and find it’s column-wise mean
87. Create a series from a numPy array and find frequency count of unique items of a series.
88. Create a pandas dataFrame using CSV file and perform a following:
i) Display first 10 rows.
ii) Display list of all columns.
89. Explain operator overloading in Python.
90. What is dictionary? Explain python dictionaries in detail along with its operations and
method
91. Explain looping statements in python with proper example
92. Write a multithreading program where one thread prints cube of number and other thread
print square of number.
93. What is constructors in python? Explain its type with suitable example.
94. Explain pattern matching in regular expression.
95. Explain in details about namespace and scoping
96. Explain in details about python files and its type
97. Explain step by step process per Database connectivity in python.
98. What is numpy? Explain universal array function.
99. Explain any three builtin exceptions.
100. Do the following operations on dictionaries :
i) Initialize two dictionaries with key & value pair.
ii) ii) Find keys that are in first and not in second dictionary.
101. What is pandas? Explain series in pandas with example.
102. Write short notes on (any two) :
a) ‘Static’ keyword
b) Matplotlib
c) Modules
d) Lambda function
e) Destructor