Python Question Paper Mumbai Univercity
Python Question Paper Mumbai Univercity
a. Define function. Write syntax to define function. Give example of function definition.
b. What is actual and formal parameter? Explain the difference along with an example.
c. Write a Python program to calculate factorial of given number using recursive function.
d. Discuss the difference between local and global variable.
e. Explain any five basic operation performed on String.
f. Write a Python program to check whether a string is palindrome.
o Option 1
o Option 2
o Option 3
1. Why Python is famous? Discuss its features and the domains where it can be used for problem
solving.
2. Discuss any two reasons why people use Python.
3. Python code execution is slower in comparison to C or C++. State True or False and justify.
4. Explain working on Python Virtual machine with suitable diagram.
5. What are Frozen Binaries?
6. What is Integrated Development Environment? Name any two Python IDEs.
1. How append() and extend() are different with reference to list in Python?
2. Differentiate between filter and map in Python using example.
3. Match the pair
Collection Type Description
a. List a. unordered and unindexed.
6. Write short note about pass, break and continue. Give example for each of them.
7. Write a program which showcase use of list comprehension with map and without map.
8. How map can be used in Python program? Explain with a suitable example.
9. Write a Python program to find reverse of given number using user defined function.
10. Find output
l=[(x, y) for x in [1,2,3] for y in [3,1,4] if x != y]
print l
11. Write list comprehensions for [3]
a. Write div(n) function which returns sum of positive divisors of given number
b. return a string with vowels removed
c. Finding intersection from two lists
d. x is an alphabet in word ‘MATHEMATICS’, x is a vowel e.
e. Take two list of same length as input and return a dictionary with one as keys and other
as values
12. Explain with suitable example different parameter passing techniques in Python.
13. Describe concept of variable length of parameter with suitable example.
14. Explain how pass by reference is achieved in Python.
15. What are scope rules for variables in Python?
16. What is lambda function?
17. Explain Generators with suitable example.
18. Write a note on Modules and Packages. Explain with suitable example
19. Short note on
a. Factory functions
b. Function annotation
20. Python Functions are objects. Justify.
Data Structures
1. Explain Set data structure. Discuss any three mathematical operations supported on set with suitable
example.
2. What is dictionary in Python? Explain with an example.
3. Explain how stack and queues are implemented in Python.
4. Differentiate between tuples and sets based on their mutability, orderedness and uses.
5. How can all keys and values of a dictionary be traversed? Explain with an example.
Ch5. File operations
1. Give the syntax and significance of raw_input() and input() methods.
2. Explain any two file reading operations.
3. What is Object Serialization? Explain use of pickle module in serialization. Code snippet
expected.
4. Explain concept logging. How it is implemented in Python. Code snippet expected.
5. What is ConfigParser.
6. File Program
a. Write a Python program to count the frequency of each word in a file and display the
word and its frequency as output.
b. Write a program which implements following
– SaveList() function to save list contents in a text file.
– LoadList() function which loads saved list content and prints length of the list on
screen.
c. Write a Python program to read a random line from a file and print on screen.
d. Write a Python program to remove newline characters from a file.
e. Read a text file in Python and print no. of lines and no. of unique words.
7. Directory Program
8. Write a Python program to read a text file and do following:
a. Print no. of words
b. Print no. Statements