Class 12 Computer Science: Functions and Recursion
Answer the questions and tap Submit to see your score. Your progress is auto-saved on this device.
Jump to question
Q1 · MCQ · 1 mark
Which keyword is used to define a function in Python?
Q2 · FILL · 1 mark
A function that calls itself is known as a _______________ function.
Q3 · SHORT · 2 marks
Explain the purpose of the 'return' statement in a Python function.
Q4 · MCQ · 1 mark
What is the output of the following Python code:
def greet(name):
print('Hello, ' + name)
greet('Alice')
Q5 · FILL · 1 mark
Arguments passed to a function by their position in the function call are called _______________ arguments.
Q6 · MCQ · 1 mark
Which of the following is NOT a benefit of using functions in programming?
Q7 · MCQ · 1 mark
What is the base case in a recursive function?
Q8 · FILL · 1 mark
The scope of a variable defined inside a function is _______________.
Q9 · SHORT · 2 marks
Differentiate between formal parameters and actual arguments in a function call.
Q10 · MCQ · 1 mark
Consider the following recursive function:
def f(n):
if n == 0:
return 1
else:
return n * f(n-1)
What is the output of f(3)?