Which of the following is the use of function in python?
A. Functions are reusable pieces of programs
B. Functions don't provide better modularity for your application
C. you can't also create your own functions
D. All of the mentioned
Answer: Option A
What does the return statement in a function do?
A. It specifies the value to be returned from the function
B. It ends the execution of the function
C. It prints the result on the screen
D. It defines the function's name
How can you make a parameter optional in a Python function?
A. By using the optional keyword
B. By providing a default value to the parameter
C. By making the parameter lowercase
D. By using a special keyword opt
Which of the following is NOT a valid function name in Python?
A. my_function
B. 2nd_function
C. _function
D. function123
What is the purpose of the def keyword in Python?
A. It is used to define a function
B. It is used to declare a variable
C. It is used to import a module
D. It is used to create a loop

Join The Discussion