Chapter 7 · Class 11 · CBSE · Science Computer Science
Functions
25 practice questions · 5 marks weightage
Topics in this chapter
- Function Definition and Basic Calling
- Parameters and Argument Passing Types
- Return Values and Variable Scope
- User-Defined Functions and Problem Solving
- Recursion and Recursive Functions
Cheat sheet
Cheat SheetPractice questions
- Question 1Q-92F0B2See the answer and solution
What is the output of the following Python code? def add(a, b=2): return a + b print(add(3))
- A.3
- B.5
- C.6
- D.Error because b is not provided
- Question 2Q-25AE4ASee the answer and solution
What is the output of the following Python code? x = 10 def change(): global x x = x + 5 return x print(change(), x)
- A.15 10
- B.10 15
- C.15 15
- D.Error because x is used inside the function
- Question 3Q-DFEDCCSee the answer and solution
Explain the difference between formal parameters and actual parameters in Python functions. Give a suitable example using a function call.
- Question 4Q-EC98DDSee the answer and solution
What is the output of the following Python code? def product(a, b): return a * b print(product(b=3, a=4))
- A.7
- B.12
- C.43
- D.TypeError
- Question 5Q-319499See the answer and solution
What is the output of the following Python code? def mystery(n): if n <= 1: return 1 return n * mystery(n - 2)
print(mystery(5))
- A.5
- B.8
- C.15
- D.25
20 more questions on Functions
Sign up free to practise the full chapter. Questions you get wrong come back until you've mastered them.
Start practising freeFree to start · No credit card needed