Module 6 Chapter 4 Answer
Question 1
Which Python keyword indicates the start of a function definition?
A. def
B. sweet
C. continue
D. help
✅ Correct Answer: A. def
Question 2
In Python, how do you indicate the end of the block of code that makes up the function?
A. You add a line that has at least 10 dashes
B. You de-indent a line of code to the same indent level as the def
keyword
C. You put the colon character (:) in the first column of a line
D. You add the matching curly brace that was used to start the function }
✅ Correct Answer: B. You de-indent a line of code to the same indent level as the def
keyword
Question 3
What is the input()
feature best described as in Python?
A. A user-defined function
B. A data structure that can hold multiple values using strings as keys
C. A reserved word
D. A built-in function
✅ Correct Answer: D. A built-in function
Question 4
What does the following code print out?
A. There
B. Hello
C. Hello There
D. thing Hello There
✅ Correct Answer: A. There
Question 5
In the following Python code, which of the following is an “argument” to a function?
A. x and y
B. print
C. max
D. ‘banana’
✅ Correct Answer: C. max
Question 6
What will the following Python code print out?
A. x
B. def
C. 10 20
D. x 20
✅ Correct Answer: C. 10 20
Question 7
Which line of the following Python program will never execute?
A. return
B. print(‘Hello’)
C. print(‘World’)
D. def stuff():
✅ Correct Answer: C. print(‘World’)
Question 8
What will the following Python program print out?
A. Bonjour Michael
B. def
C. Hola Michael
D. Hello Michael
✅ Correct Answer: A. Bonjour Michael
Question 9
What does the following Python code print out?
A. 14
B. 7
C. addtwo
D. 2
✅ Correct Answer: D. 2
Question 10
What is the most important benefit of writing your own functions?
A. Avoiding writing the same non-trivial code more than once in your program
B. Following the rule that no function can have more than 10 statements in it
C. To avoid having more than 10 lines of sequential code without an indent or de-indent
D. Following the rule that whenever a program is more than 10 lines you must use a function
✅ Correct Answer: A. Avoiding writing the same non-trivial code more than once in your program