Any2Quiz
CBSE / 11 / ICT / Programming

Functions Quiz - CBSE Class 11 ICT

Free practice quiz: Functions (CBSE Class 11 ICT). 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 programming?

    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. It improves code organization and readability.

  2. Explain the difference between a function's definition and a function's call.

    1. There is no difference
    2. Definition executes the function; call only declares it
    3. Definition declares the function; call executes it
    4. Definition is an input; call is an output
    Show answer

    Answer: C. Definition declares the function; call executes it

    The function definition describes what the function does. The function call is the action of using it.

  3. What is the scope of a variable declared inside a function?

    1. Global scope
    2. Local scope
    3. Static scope
    4. Dynamic scope
    Show answer

    Answer: B. Local scope

    Variables declared inside a function have local scope; they are only accessible within that function.

  4. What is the difference between pass-by-value and pass-by-reference when passing arguments to a function?

    1. Pass-by-value creates a copy; pass-by-reference uses the original
    2. Pass-by-value modifies the original; pass-by-reference creates a copy
    3. There is no difference
    4. Pass-by-value is faster, pass-by-reference is slower
    Show answer

    Answer: A. Pass-by-value creates a copy; pass-by-reference uses the original

    Pass-by-value creates a copy of the argument, while pass-by-reference uses the original variable's memory location.

  5. Discuss the advantages and disadvantages of using recursive functions.

    1. Advantages: Simplicity, Disadvantages: None
    2. Advantages: Efficiency, Disadvantages: Complexity
    3. Advantages: Simplicity, Disadvantages: Potential stack overflow
    4. Advantages: Speed, Disadvantages: Readability
    Show answer

    Answer: C. Advantages: Simplicity, Disadvantages: Potential stack overflow

    Recursive functions can elegantly solve certain problems, but excessive recursion can lead to stack overflow errors.

Take the full quiz

More quizzes

Browse all Programming quizzes