10th class Computer Online test Chapter 5 Functions
Chapter 5 – Functions
Chapter 5 – Functions
Quiz
What is a function in programming?
- A set of instructions that perform a specific task
- A variable that stores data
- A loop that repeats a task
- A method to debug code
Which keyword is used to define a function in Python?
- function
- def
- define
- func
What is the correct syntax to define a function in Python?
- def function_name():
- function function_name():
- func function_name():
- define function_name():
What is the purpose of the return statement in a function?
- To terminate a function
- To output a value from a function
- To loop inside a function
- To pass arguments to a function
What are function parameters?
- Variables defined outside the function
- Values returned by a function
- Variables passed into a function when it is called
- Loops inside a function
What is a built-in function in Python?
- A function that the user creates
- A predefined function provided by Python
- A function that returns data
- A function used in loops
Which of the following is a Python built-in function?
- square()
- sum()
- multiply()
- divide()
Which of the following statements about functions is TRUE?
- Functions cannot take arguments.
- Functions cannot return a value.
- Functions help reduce code duplication.
- Functions cannot call other functions.
What is the primary purpose of a function in programming?
- To store multiple values
- To execute a block of code when called
- To define conditional statements
- To repeat a block of code automatically
Which of the following is a benefit of using functions?
- Reduces code readability
- Encourages code duplication
- Allows code reuse and modularity
- Increases program size unnecessarily
No comments:
Post a Comment