AMP

Chapter 1: Function — Online MCQ Test

COMPUTER SCIENCE · CLASS 12th · Tamil Nadu State Board
Practice Chapter 1: Function with a free chapter-wise online MCQ test. This chapter covers: This chapter introduces functional programming concepts building subroutines and main language constructs. It covers functions with parameters interface versus implementation and t.... AI-generated questions from basic to board-exam level, with instant results and explanations.

Start Exam on Full Site →

Chapter 1: Function — Important Questions & Answers

What is the main purpose of a function in programming?
  • A. To store only numeric values
  • B. To perform a specific task and improve code reuse
  • C. To display output only
  • D. To replace the entire program
Answer: B. To perform a specific task and improve code reuse
A function is a subroutine designed to perform a specific task. It helps in code reuse and makes programs easier to manage.
Which of the following is the correct term for values passed to a function when it is called?
  • A. Parameters
  • B. Arguments
  • C. Identifiers
  • D. Statements
Answer: B. Arguments
Arguments are the actual values supplied to a function call. Parameters are the variables in the function definition that receive these values.
Which of the following best describes the interface of a function?
  • A. The internal logic used inside the function
  • B. The way a function is called, including its inputs and outputs
  • C. The memory location of the function
  • D. The variable names used only inside the function
Answer: B. The way a function is called, including its inputs and outputs
The interface of a function tells how to use it from outside, such as its parameters and return value. The internal steps belong to the implementation.
A function is called with the same input value many times, and it always produces the same output without changing any program state. What can be inferred?
  • A. It is a pure function
  • B. It is an impure function
  • C. It must be a recursive function
  • D. It must use a global variable
Answer: A. It is a pure function
A pure function always gives the same output for the same input and does not cause side effects. That is exactly the defining property of purity.
Which statement is correct about function parameters and arguments?
  • A. Parameters are the actual values passed during the call
  • B. Arguments are the variables listed in the function definition
  • C. Parameters are in the function definition, while arguments are used in the function call
  • D. Both mean the same thing in all contexts
Answer: C. Parameters are in the function definition, while arguments are used in the function call
Parameters are placeholders in the function definition, and arguments are the actual values supplied when calling the function. This distinction is important in function usage.