Home > Python > Quizzes > Python Programming Basics Practice Test: Python Functions
Python Programming Basics Practice Test: Python Functions
Fast practice, instant feedback. Timer auto-submits when time’s up.
Avg score: 82% Most missed: “Which of the following is a feature of DocString?”
Python functions are defined using the def keyword, followed by the function name and parentheses. The parentheses can be empty, or they can contain a list of arguments. The body of the function is indented, and the function ends with the return keyword, followed by the value that the function should return. You can also define functions that do not return any values. These functions are typically used to perform some action, such as printing a message to the console.  - Define the code that it will process each time you call it - Specify the values to return (if any) when you call the... Show more
Python Programming Basics Practice Test: Python Functions
Time left 00:00
22 Questions

1. What is a variable defined inside a function referred to as?
2. Which keyword is used for function?
3. Lambda is a statement.
4. Python supports the creation of anonymous functions at runtime, using a construct called __________
5. What will be the output of the following Python code?
def f(x, y, z): return x + y + z
f(2, 30, 400)
6. Which of the following is a feature of DocString?
7. What is a variable defined outside a function referred to as?
8. What will be the output of the following Python code?
y = 6
z = lambda x: x * y
print z(8)
9. Does Lambda contains return statements?
10. Which of the following is a feature of DocString?
11. What are the two main types of functions?
12. Lambda is a statement.
13. Python supports the creation of anonymous functions at runtime, using a construct called __________
14. What will be the output of the following Python code?

def maximum(x, y):
if x > y:
return x
elif x == y:
return 'The numbers are equal'
else:
return y
 
print(maximum(2, 3))
15. What will be the output of the following Python code?

lamb = lambda x: x ** 3
print(lamb(5))
16. Which keyword is used for function?
17. What will be the output of the following Python code?
def printMax(a, b):
if a > b:
print(a, 'is maximum')
elif a == b:
print(a, 'is equal to', b)
else:
print(b, 'is maximum')
printMax(3, 4)
18. Lambda contains block of statements.
19. What will be the output of the following Python code?

min = (lambda x, y: x if x < y else y)
min(101*99, 102*98)
20. Does Lambda contains return statements?
21. If a function doesn’t have a return statement, which of the following does the function return?
22. What is called when a function is defined inside a class?