# 5.18. Functions Multiple Choice QuestionsΒΆ

- function header (including the definition and the name)
- Correct!
- function body
- Correct!
- variables
- Variables are not absolutely needed to create a function. For example, a function can just contain a print statement.
- return statement
- A return statement is not absolutely needed to create a function. For example, a print statement can be used instead of a return statement.
- function call
- Correct!

p9-1: Select all the parts that are absolutely needed to create and call a function.

- 5 and 5.2 and 1
- Incorrect! When you do a smaller number % a larger number, the answer will always be the smaller number. When you do a number % the same number, the answer will always be 0.
- 5 and 95.3 and 0
- Correct!
- 100 and 95.3 and 12
- Incorrect! When you do a larger number % a smaller number, the answer will be the remainder of the larger number divided by the smaller number. When you do a number % the same number, the answer will always be 0.
- 95 and 100.5 and 0
- Incorrect! When you do a larger number % a smaller number, the answer will be the remainder of the larger number divided by the smaller number. When you do a smaller number % a larger number, the answer will always be the smaller number.
- 5 and 100.5 and 1
- Incorrect! When you do a smaller number % a larger number, the answer will always be the smaller number. When you do a number % the same number, the answer will always be 0.

p9-2: What will be returned after calling `modulus(100,95)`

and `modulus(95.3,100.5)`

and `modulus(12,12)`

?

```
def modulus(num1, num2):
answer = num1 % num2
return answer
```

- 1, 1.05, 0, 0.71, 1, 1.4
- Incorrect! Single division is floating point division. Double division is integer division, and it outputs the floor of the value.
- 1.05, 5, 0.71, 5, 1.4, 2
- Incorrect! Single division is floating point division. Double division is integer division, and it outputs the floor of the value.
- 1.05, 2, 0.71, 1, 1.4, 2
- Incorrect! Single division is floating point division. Double division is integer division, and it outputs the floor of the value.
- 1.05, 1, 0.71, 1, 1.4, 1
- 1.05, 1, 0.71, 0, 1.4, 1
- Correct!

p9-3: What will be printed after calling `divide(100, 95)`

and `divide(5, 7)`

and `divide(7, 5)`

? (Note: Ignore whitespaces.)

```
def divide(num1, num2):
single_div_answer = num1 / num2
print(round(single_div_answer, 2))
double_div_answer = num1 // num2
print(round(double_div_answer, 2))
```

- None will be outputted after printing and calling multiplication_one(5, 10). Nothing will be outputted after calling multiplication_two(5, 10).
- Correct!
- Nothing will be outputted after printing and calling multiplication_one(5, 10). None will be outputted after calling multiplication_two(5, 10).
- Incorrect! None is printed when you print and call a function and there is no return statement in the function body. Nothing is outputted when you call a function that only has a return statement and you don't print the function call.
- 50 will be outputted after printing and calling multiplication_one(5, 10) and after calling multiplication_two(5, 10).
- Incorrect! None is printed when you print and call a function and there is no return statement in the function body. Nothing is outputted when you call a function that only has a return statement and you don't print the function call.
- None will be outputted after printing and calling multiplication_one(5, 10). 50 will be outputted after calling multiplication_two(5, 10).
- Incorrect! Nothing is outputted when you call a function that only has a return statement and you don't print the function call.
- 50 will be outputted after printing and calling multiplication_one(5, 10). Nothing will be outputted after calling multiplication_two(5, 10).
- Incorrect! None is printed when you print and call a function and there is no return statement in the function body.

p9-4: After running the following code, what will the output be?

```
def multiplication_one(num1, num2):
num1 * num2
print(multiplication_one(5, 10))
def multiplication_two(num1, num2):
return num1 * num2
multiplication_two(5, 10)
```

- None and -89
- Incorrect! When you print a function call (e.g., print(subtraction(new_add_answer, 200))) and the function prints an output (e.g., def subtraction(num1, num2): print(num1 - num2)), the output will be printed first due to the function call. Then, printing the function call will output None because the function does not have a return statement.
- None
- Incorrect! When you print a function call (e.g., print(subtraction(new_add_answer, 200))) and the function prints an output (e.g., def subtraction(num1, num2): print(num1 - num2)), the output will be printed first due to the function call. Then, printing the function call will output None because the function does not have a return statement.
- -89
- Incorrect! When you print a function call (e.g., print(subtraction(new_add_answer, 200))) and the function prints an output (e.g., def subtraction(num1, num2): print(num1 - num2)), the output will be printed first due to the function call. Then, printing the function call will output None because the function does not have a return statement.
- -89 and None
- Correct!

p9-5: What would be outputted after running the code below? (Note: Ignore whitespaces.)

```
def addition(num1, num2):
return(num1 + num2)
def subtraction(num1, num2):
print(num1 - num2)
def main():
add_answer = addition(2, 4)
new_add_answer = addition(add_answer, 105)
print(subtraction(new_add_answer, 200))
main()
```

You have attempted of activities on this page