0% found this document useful (0 votes)
31 views1 page

Module 2 Question Bank

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views1 page

Module 2 Question Bank

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Bapuji Educational Association (Regd.

Bapuji Institute of Engineering and Technology, Davangere-577004

Introduction to Python Programming (BCSPLC105A)


Question Bank
Module2
1. What is user-defined functions? How can we pass parameters in user-defined functions?
Explain with a suitable example.
2. What are functions? Explain Python functions with parameters and return statements.
3. Explain the local and global scope with suitable examples.
4. Define exception handling. How are exceptions handled in Python? Write a function
named DivExp, which takes TWO parameters, a and b and returns a value c (c=a/b).
Write a suitable assertion for a>0 in the function DivExp and raise an exception for
when b=0. Develop a Python program that reads two values from the console and calls
a function DivExp.
5. Explain the following list methods with examples.
i. negative indexing
ii. index()
iii. append()
iv. insert()
v. sort()
vi. reverse()
vii. remove()
6. Explain in and not in operators used in lists with an example.
7. Read N numbers from the console and create a list. Develop a program to compute and
print mean, variance and standard deviation with messages.
8. Lists are mutable justify your answer with suitable examples.
9. Explain random.choice and random.shuffle functions with lists.
10. How is tuple different from a list and which function is used to convert list to tuple?
Explain.
11. Explain the following methods in lists with examples:
i. len()
ii. sum()
iii. max()
iv. min()
12. Explain different ways to delete an element from a list with suitable Python syntax and
programming examples.
13. Tuples are immutable. Explain with Python programming example.
14. Explain multiple assignment trick and Augmented assignment operators using example

You might also like