Python Functions

A colorful illustration of Python programming concepts with fun<wbr>ctions highlighted, featuring elements like code snippets, question marks, and a lightbulb symbolizing learning.

Python Functions Quiz

Test your knowledge of Python functions with this engaging and informative quiz! Whether you're a student, a teacher, or a Python enthusiast, this quiz will challenge your understanding of function definitions, arguments, return values, and much more.

Key features of the quiz:

  • 13 carefully crafted questions
  • Multiple choice and checkbox formats
  • Instant feedback on your answers
13 Questions3 MinutesCreated by CodingEagle247
What is the output of the following function call ?
def fun1(name, age=20):
    print(name, age)

fun1('Emma', 25)
Emma 25
Emma 20
Select which true for Python function
A function is a code block that only executes when called and always returns a value.
A function only executes when it is called and we can reuse it in a program
Python doesn’t support nested function
Select which is true for Python function
A Python function can return only a single value
A function can take an unlimited number of arguments.
A Python function can return multiple values
Python function doesn’t return anything unless and until you add a return statement
What is the output of the following code ?
def outer_fun(a, b):
    def inner_fun(c, d):
        return c + d
    return inner_fun(a, b)

res = outer_fun(5, 10)
print(res)
15
Syntax Error
(5, 10)
What is the output of the following display_person() function call ?
def display_person(*args):
    for I in args:
        print(i)

display_person(name="Emma", age="25")
TypeError
Emma
25
name
age
What is the output of the following display() function call ?
def display(**kwargs):
    for I in kwargs:
        print(i)

display(emp="Kelly", salary=9000)
TypeError
Kelly
9000
(’emp’, ‘Kelly’)
(‘salary’, 9000)
emp
salary

Given the following function fun1() Please select all the correct function calls

def fun1(name, age):
    print(name, age)
  • fun1("Emma", age=23)
  • fun1(age =23, name="Emma")
fun1(name="Emma", 23)
fun1(age =23, "Emma")
Python function always returns a value
False
True

What is the output of the following function call ?

def outer_fun(a, b):
    def inner_fun(c, d):
        return c + d

    return inner_fun(a, b)
    return a

result = outer_fun(5, 10)
print(result)
5
15
(15, 5)
Syntax Error
Choose the correct function declaration of  fun1() so that we can execute the following function call successfully
fun1(25, 75, 55)
fun1(10, 20)
Def fun1(**kwargs)
No, it is not possible in Python
Def fun1(args*)
Def fun1(*data)
What is the output of the following function call ?
 
def fun1(num):
    return num + 25

fun1(5)
print(num)
25
5
NameError

What is the output of the add() function call ?

def add(a, b):
    return a+5, b+5

result = add(3, 2)
print(result)
15
8
(8, 7)
Syntax Error
{"name":"Python Functions", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"Test your knowledge of Python functions with this engaging and informative quiz! Whether you're a student, a teacher, or a Python enthusiast, this quiz will challenge your understanding of function definitions, arguments, return values, and much more.Key features of the quiz:13 carefully crafted questionsMultiple choice and checkbox formatsInstant feedback on your answers","img":"https:/images/course3.png"}
Powered by: Quiz Maker