MCQ on Python Functions – 2

Q1) If a function doesn’t have a return statement, which of the following does the function return?

a) None
b) null
c) int
d) An exception is thrown without the return statement

View Answer Answer:- a) None

Q2) What is called when a function is defined inside a class?

a) Class
b) Method
c) Another function
d) Module

View Answer Answer:- b) Method

Q3) What are the two main types of functions?

a) System function
b) User function
c) Built-in function & User defined function
d) Custom function

View Answer Answer:- c) Built-in function & User defined function

Q4) Select which is true for the Python function.

a) A Python function can return only a single value
b) A Python function can return multiple values
c) Python function doesn’t return anything unless and until you add a return statement

View Answer Answer:- b) A Python function can return multiple values

Q5) Which of the following refers to mathematical function?

a) rhombus
b) add
c) rhombus
d) sqrt

View Answer Answer:- d) sqrt

Q6) What is a recursive function?

a) A function which calls itself.
b) A function that calls other functions.
c) Both A and B
d) None of the above

View Answer Answer:- a) A function which calls itself.

Q7) Python supports the creation of anonymous functions at runtime, using a construct called __.

a) anonymous
b) pi
c) lambda
d) none of the mentioned

View Answer Answer:- c) lambda

Q8) In which part of memory does the system store the parameter and local variables of a function call?

a) stack
b) heap
c) Uninitialized data segment
d) None of the above

View Answer Answer:- a) stack

Q9) What are the advantages of functions in python?

a) Improving clarity of the code
b) Reducing duplication of code
c) Decomposing complex problems into simpler pieces
d) All of the mentioned

View Answer Answer:- d) All of the mentioned

Q10) A named sequence of statements is known as which of the following?

a) method
b) function
c) turtle
d) module

View Answer Answer:- b) function

Q11) What is a variable defined inside a function referred to as?

a) A local variable
b) An automatic variable
c) A volatile variable
d) A global variable

View Answer Answer:- a) A local variable

Also See:- Function MCQ in Python – 3

Leave a Comment

Your email address will not be published. Required fields are marked *