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 Sheet

Practice questions

  1. Question 1Q-92F0B2

    What is the output of the following Python code? def add(a, b=2): return a + b print(add(3))

    1. A.3
    2. B.5
    3. C.6
    4. D.Error because b is not provided
    See the answer and solution
  2. Question 2Q-25AE4A

    What is the output of the following Python code? x = 10 def change(): global x x = x + 5 return x print(change(), x)

    1. A.15 10
    2. B.10 15
    3. C.15 15
    4. D.Error because x is used inside the function
    See the answer and solution
  3. Question 3Q-DFEDCC

    Explain the difference between formal parameters and actual parameters in Python functions. Give a suitable example using a function call.

    See the answer and solution
  4. Question 4Q-EC98DD

    What is the output of the following Python code? def product(a, b): return a * b print(product(b=3, a=4))

    1. A.7
    2. B.12
    3. C.43
    4. D.TypeError
    See the answer and solution
  5. Question 5Q-319499

    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))

    1. A.5
    2. B.8
    3. C.15
    4. D.25
    See the answer and solution

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 free

Free to start · No credit card needed