Multiple choice

Which of the following statements is/are true? (1)Function declaration specifies the return type of function and types of parameters it will accept. (2)Variable declared in a function is also available for the other functions. (3) Function definition defines the task of main program.

  1. Only (1)

  2. Only (2)

  3. Only (3)

  4. Both (1) & (2)

  5. Both (2) & (3)

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Function declaration no doubt specifies return type and parameters of function. So, statement (1) is correct. Variable declared in a function is unique. So, it cannot be used by another function. So, statement (2) is false. Rules of function allow us to declare as many functions in a program as we want. So, statement (3) is incorrect. Hence, only statement (2) is correct.