You are on page 1of 4

SHRI VILE PARLE KELAVANI MANDAL’S

SHRI BHAGUBHAI MAFATLAL POLYTECHNIC

Programme: Computer Engineering Semester: IV (A & B)


Course: Programming in Python Course code: PRP228918
Question Bank for PT - 1
1 Differentiate between mutable and immutable data types.
2 Enlist any 4 inbuilt Python modules
3 Explain map function with suitable example program.

4 Explain filter function with suitable example program.

5 Explain reduce function with suitable example program.

6 Explain Lambda function with suitable example program.

7 With suitable example, explain explicit Type Casting in Python


8 Show method overloading in Python with the help of an example.
9 Explain the built in attributes of a class.
10 Differentiate between List, Tuples, dictionary and Set data types
11 Differentiate between break and continue statement
Read email address of a user from the keyboard. Write a Python program to check
12
whether given email address contains both ‘@’ and ‘.’ symbol or not.
13 Give the use of the functions ord(),oct(),str(),chr() in Type Casting.
14 Show the use of range function.
15 “Variables are dynamically typed in Python”.Justify with code snippet.
Elaborate Python data types with suitable example.
16
Number, Strings, Set, Tuple, List, Dictionary, Frozenset, Bool
17 Explain all the Python Operators with suitable example.
18 Explain slicing in strings, Tuple and List with an example.
19 Compare the Deep copy and Shallow copy with suitable example.
20 Show how to declare a dictionary, access values in dictionary.
21 Explain any 4 features of python
Explain all the methods of following with example and its uses also:
22
1)string 2)List 3) Tuples 4) Dictionary 5)Set
23 State the use of globals() and locals() in Python with example.
SHRI VILE PARLE KELAVANI MANDAL’S
SHRI BHAGUBHAI MAFATLAL POLYTECHNIC

PROGRAMS
Use the for loop and elif in a python script that counts and displays all letters,
24 digits and special symbols in a given string
“Python 33345 $_Programming”
Give the output of the following statements if a=10 ,b=1:
i)print(a<<b)
25
ii)print(a>>b)
Note: Practise similar statements on any operators
Analyse the below given python statements and state the output of each statement
if str=”ComputerEngineering”
print(str[:6])
26 print(str[5:4])
print(str[-1:-12:-1])
print(str[::-1])
Note: Similar slicing problems on strings,Lists, tuples may be asked
Use the while loop and write a python program that calculates the sum of numbers
27
in a list.
Write the python script using for loop and range function to get the following output.
28 i) 2 5 8 11 14 17 20 23 26 29
ii) 2 3 4 5
Write a Python function CountFreqList(l) that takes as input a list of integers and
returns a pair of the form (minfreqlist,maxfreqlist) where minfreqlist is a list of
numbers with minimum frequency in l, sorted in ascending order ,maxfreqlist is a
list of numbers with maximum frequency in l, sorted in ascending .
For instance
29 >>> CountFreqList ([13,12,11,13,14,13,7,11,13,14,12])
([7], [13])
>>> CountFreqList ([13,12,11,13,14,13,7,11,13,14,12,14,14])
([7], [13, 14])
>>> CountFreqList ([13,12,11,13,14,13,7,11,13,14,12,14,14,7])
([7, 11, 12], [13, 14])
30 Write a Python script to Search a particular word in a given string.
Write the Python Script that replaces the white spaces with ‘#’ in the given below
31 given string.
str = "Python Programming in academics"
Use the while loop and write a python program that prints the odd numbers in a
32
list.
33 Write a python script to display the calendar of the year 2023.
Write a Python Script to define a class BookStore with constructor that initializes
34 essential attributes. Also calculate total valuation and develop member methods to
update price and quantity of a book. Use array of objects to read data of n books.
SHRI VILE PARLE KELAVANI MANDAL’S
SHRI BHAGUBHAI MAFATLAL POLYTECHNIC

Write a Python script to read data of n students (roll number, name,address and
35 marks of 5 subject) display the data and also percentage of each student. Use
array of object to read and display n students’ information.
Write a Python program to combine two dictionary adding values for common
keys.
36
d1 = {'a': 100, 'b': 200, 'c':300}
d2 = {'a': 300, 'b': 200, 'd':400}
Write a Python program to replace the last value of tuples in a list.
Sample list: [(10, 20, 40), (40, 50, 60), (70, 80, 90)]
37
Expected Output: [(10, 20, 100), (40, 50, 100), (70, 80, 100)]

Write a Python program to calculate the average value of the numbers in a given
tuple of tuples.
Original Tuple:
38
((10, 10, 10, 12), (30, 45, 56, 45), (81, 80, 39, 32), (1, 2, 3, 4))
Average value of the numbers of the said tuple of tuples:
[30.5, 34.25, 27.0, 23.25]
Write a Python script to generate and print a dictionary that contains a number
(between 1 and n) in the form (x, x*x).
39
Sample Dictionary ( n = 5) :
Expected Output : {1: 1, 2: 4, 3: 9, 4: 16, 5: 25}
Write a Python program to filter a dictionary based on values.
Original Dictionary:
40 {'Cierra Vega': 175, 'Alden Cantrell': 180, 'Kierra Gentry': 165, 'Pierre Cox': 190}
Marks greater than 170:
{'Cierra Vega': 175, 'Alden Cantrell': 180, 'Pierre Cox': 190}
Write a Python function to reverse a list at a specific location.
Sample Output:

Original list:
41 [10, 20, 30, 40, 50, 60, 70, 80]

Reverse elements of the said list between index position 2 and 4


[10, 20, 50, 40, 30, 60, 70, 80]

Write a Python program to add two given lists of different lengths, starting on the
right.

Sample Output:
42 Original lists:
[2, 4, 7, 0, 5, 8]
[3, 3, -1, 7]

Add said two lists from right:


[2, 4, 10, 3, 4, 15]
SHRI VILE PARLE KELAVANI MANDAL’S
SHRI BHAGUBHAI MAFATLAL POLYTECHNIC

43 Write a Python script to calculate the BMI of a person.

Write a Python script to Check whether given email address contains both ‘@’ and
44
‘.’ symbol or not.
Using in-built python modules write the code snippets for the following:
 creation and deletion of folder/directory
 display the date in dd-mm-yyyy format
45
 display the calendar of “July 2022” month
 shuffle the element of given list

46 Write a Python program to shuffle the elements of a given list.


Write the List Comprehension statements that gives the following output.
47 [18, 16,14,12,10,8,6,4,2]

Write a Python script to merge two Python dictionaries.


48
Write a Python script to Remove empty strings from the list of strings
49  list1 = ["Mike", "", "Emma", "Kelly", "", "John"]

Write a Python script to display words having minimum 5 characters and end with
50 ’t’ from the given list of strings

*******************************ALL THE BEST*******************************

You might also like