PCEP-30-02 · Question #215
A function parameter is a kind of variable accessible:
The correct answer is C. only inside the function. Function parameters are local variables - they exist only within the function's scope, making C correct. When a function is called, its parameters are created, bound to the passed arguments, and destroyed once the function returns; no code outside the function can access them…
Question
Options
- Aonly after the function definition's completion
- Banywhere in the code
- Conly inside the function
How the community answered
(54 responses)- A6% (3)
- B17% (9)
- C78% (42)
Explanation
Function parameters are local variables - they exist only within the function's scope, making C correct. When a function is called, its parameters are created, bound to the passed arguments, and destroyed once the function returns; no code outside the function can access them.
Why A is wrong: Parameters are accessible during the function's execution, not after it completes - once the function returns, the parameter is gone, not newly available.
Why B is wrong: Variables accessible anywhere in the code are called global variables; parameters are the opposite - they are deliberately scoped to keep functions self-contained and avoid unintended side effects.
Memory tip: Think of a function as a private room - parameters are tools you bring into that room to do work. The moment you leave (the function returns), the tools stay behind and can't be used in the hallway.
Community Discussion
No community discussion yet for this question.