Any2Quiz
CBSE / 11 / Computer Science / Programming and Computational Thinking

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.

Play all 20 questions free

Sample questions

  1. What is a function in Python?

    1. A block of code that performs a specific task
    2. A type of variable
    3. A data structure
    4. A loop
    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.

  2. What is a function parameter?

    1. A variable declared inside a function
    2. The value returned by a function
    3. A variable in the function definition that receives an argument
    4. A type of loop
    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.

  3. What happens if a recursive function lacks a base case?

    1. The function executes correctly
    2. The program crashes
    3. The function returns an error
    4. The program enters an infinite loop
    Show answer

    Answer: D. The program enters an infinite loop

    Without a base case, the function will call itself repeatedly without stopping.

  4. How can you access a global variable from inside a function?

    1. You cannot access global variables from inside a function
    2. By declaring the variable as 'global' inside the function
    3. By passing the variable as an argument to the function
    4. By using the 'global' keyword before accessing the variable
    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.

  5. What is the difference between *args and **kwargs?

    1. *args accepts keyword arguments, **kwargs accepts positional arguments
    2. *args accepts a variable number of positional arguments, **kwargs accepts a variable number of keyword arguments
    3. Both are the same
    4. *args is used for recursion, **kwargs for iteration
    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.

Take the full quiz

More quizzes

Browse all Programming and Computational Thinking quizzes