Any2Quiz
CBSE / 10 / Computer Science / Programming with Python

Functions and Modules Quiz - CBSE Class 10 Computer Science

Free practice quiz: Functions and Modules (CBSE Class 10 Computer Science). 19 multiple-choice questions with answers and explanations. Play online, no sign-up needed.

Play all 19 questions free

Sample questions

  1. What is the correct way to define a function in Python?

    1. function myFunc():
    2. def myFunc[]:
    3. def myFunc():
    4. function(myFunc)
    Show answer

    Answer: C. def myFunc():

    In Python, functions are defined using the 'def' keyword followed by the function name and parentheses.

  2. What is a module in Python?

    1. A library of functions
    2. A piece of code that is built-in
    3. A variable of type module
    4. A package manager
    Show answer

    Answer: A. A library of functions

    A module is a file containing Python definitions and statements, functioning as a library of functions and definitions.

  3. What returning type allows a function to return two values at once?

    1. list
    2. tuple
    3. dictionary
    4. set
    Show answer

    Answer: B. tuple

    A function can return a tuple, allowing you to return multiple values at once.

  4. When are function annotations evaluated?

    1. During function definition
    2. During function execution
    3. During module import
    4. They are not evaluated
    Show answer

    Answer: A. During function definition

    Function annotations are evaluated at function definition time and stored in the function’s __annotations__ attribute.

  5. What is the output of 'print(math.pow(2, 3))' if the math module is imported?

    1. 8.0
    2. 6
    3. 8
    4. 2**3
    Show answer

    Answer: A. 8.0

    The 'pow' function in the math module returns a float. So, 'math.pow(2, 3)' will return 8.0.

Take the full quiz

More quizzes

Browse all Programming with Python quizzes