Functions in Python Quiz - CBSE Class 11 Computer Science
Free practice quiz: Functions in Python (CBSE Class 11 Computer Science). 20 multiple-choice questions with answers and explanations. Play online, no sign-up needed.
This CBSE Class 11 Computer Science practice quiz has 20 multiple-choice questions on Functions in Python, and 20 of them come with an explanation. Try the 5 sample questions below (tap an option to check yourself), then play the full quiz online. No sign-up needed.
Start quiz: 20 questions, freeSample questions
What is a function in Python?
Show answer
Answer: A. A block of code that performs a specific task
A function is a reusable block of code designed to perform a specific task.
What is a function parameter?
Show answer
Answer: C. A variable in the function definition that receives an argument
Parameters act as placeholders for the arguments passed during function call.
What happens if a recursive function lacks a base case?
Show answer
Answer: D. The program enters an infinite loop
Without a base case, the function will call itself repeatedly without stopping.
How can you access a global variable from inside a function?
Show answer
Answer: D. By using the 'global' keyword before accessing the variable
Using the 'global' keyword explicitly indicates that you want to modify the global variable.
What is the difference between *args and **kwargs?
Show answer
Answer: B. *args accepts a variable number of positional arguments, **kwargs accepts a variable number of keyword arguments
They are used to handle flexible function signatures.
More questions in this quiz
Answers and explanations are in the full quiz.
- How do you define a function in Python?
- What is the purpose of the 'return' statement in a Python function?
- What are arguments in a Python function?
- What is the difference between a function's parameters and arguments?
- What is a recursive function?
- What is the base case in a recursive function?
- Explain the concept of function scope in Python.
- What is a local variable in Python?
- What is a global variable in Python?
- What are default arguments in Python functions?
- What is the purpose of keyword arguments in Python?
- Explain the concept of variable-length arguments (*args and **kwargs) in Python functions.
- Describe a scenario where using lambda functions in Python would be beneficial.
- How do you define an anonymous function (lambda function) in Python?
- Explain higher-order functions in Python and provide an example using map or filter.
More quizzes
Browse all Programming and Computational Thinking quizzes