Questions and Answers Graded A+
What is the correct way to define a function in Python?
def function_name:
✔✔def function_name():
function function_name()
function_name def()
What keyword is used to define a function in Python?
func
def
✔✔function
method
How do you call a function named `greet()` in Python?
greet()
✔✔greet
1
,call greet()
run greet()
What will the following code print?
```python
def hello():
print("Hello, World!")
hello()
```
Hello, World!
Hello
✔✔Hello, World!
World!
Which of these can be used to pass information to a function?
✔✔Parameters
Arguments
Variables
2
, Statements
What happens if you call a function with the wrong number of arguments?
✔✔It raises a TypeError
It returns None
It causes an infinite loop
It ignores the extra arguments
What is the purpose of a return statement in a function?
✔✔To exit the function and return a value
To print the result to the console
To define the function
To define parameters
What will the following code return?
```python
def multiply(x, y):
return x * y
3