Python Functions
Python Functions - Important Points
1. | What is the keyword used to define a function in Python? |
---|
A. define
B. function
C. def
D. create
View Answer Discuss Work SpaceAnswer: option c
Explanation:
The keyword "def" is used to define a function in Python.
2. | What is the syntax to call a function in Python? |
---|
A. call function_name(arguments)
B. function_name(arguments)
C. function(arguments)
D. call function(arguments)
View Answer Discuss Work SpaceAnswer: option b
Explanation:
3. | What is the purpose of the return statement in a function? |
---|
A. It specifies the function name
B. It returns a value from the function
C. It defines the function arguments
D. It ends the function execution
View Answer Discuss Work SpaceAnswer: option b
Explanation:
4. | What is the difference between function parameters and arguments in Python? |
---|
A. There is no difference
B. Parameters are values passed to a function, whereas arguments are variables defined within a function
C. Arguments are values passed to a function, whereas parameters are variables defined within a function
D. Parameters and arguments are both variables defined within a function
View Answer Discuss Work SpaceAnswer: option c
Explanation:
5. | What is the purpose of the *args parameter in a function definition? |
---|
A. It allows the function to accept a variable number of keyword arguments
B. It allows the function to accept a variable number of positional arguments
C. It defines the default arguments for a function
D. It defines the required arguments for a function
View Answer Discuss Work SpaceAnswer: option b
Explanation: