0% found this document useful (0 votes)
14 views2 pages

Returning Multiple Values in Python Functions

This document contains a practice test on functions in Python with two sections: 1) Section A contains 5 multiple choice questions testing basic function concepts like default parameters, returning multiple values, and the def keyword. 2) Section B contains 9 short answer questions testing more advanced function topics like keyword arguments, local and global variables, returning values, and the random module. It also contains code snippets to predict outputs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views2 pages

Returning Multiple Values in Python Functions

This document contains a practice test on functions in Python with two sections: 1) Section A contains 5 multiple choice questions testing basic function concepts like default parameters, returning multiple values, and the def keyword. 2) Section B contains 9 short answer questions testing more advanced function topics like keyword arguments, local and global variables, returning values, and the random module. It also contains code snippets to predict outputs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

TEST M.

M - 50
CHAPTER 2: FUNCTIONS IN PYTHON

SECTION – A 5X1
=5

1) What is default parameter?


2) Can a function return multiple values in python?
3) If return statement is not used inside the function, then function will return?
4) Which of the following keywords marks the beginning of the function
block?
(a) func (b) define (c) def (d) function
5) What do you understand by flow of execution?

SECTION – B 9 X 3 = 45

1) What are keyword arguments? Also write advantage of keyword argument?


2) Consider the following function headers. Identify the correct statement: -
1) def correct(a=1,b=2,c): 2) def correct(a=1,b,c=3):
3) def correct(a=1,b=2,c=3): 4) def correct(a=1,b,c):
Also, State reason for each Option.
3) What will be the output of the following code?
a=1
def f():
a=10
print(a)
4) What are arguments? What are parameters? How are these two terms
different yet related? Give example.
5) What is the difference between local and global variables?
6) How many values a python function can return? Explain with an example?
7) Predict the output of the following code fragment?
def check(n1=1, n2=2):
n1=n1+n2
n2+=1
print(n1,n2)
check()
check(2,1)
check(3)
8) Write any two functions of random module and explain each function with
example?
9) What is the output of following code fragments?

You might also like