Difficulty: Easy
Correct Answer: Functions can be called, or invoked, only once in a program
Explanation:
Introduction / Context:Functions are fundamental building blocks in C and C++ that package a sequence of statements into a named, reusable unit. A solid grasp of what functions can and cannot do is essential for modular design, maintainability, and testing. This question asks you to identify the single false statement among several common claims about functions.
Given Data / Assumptions:
Concept / Approach:
Step-by-Step Solution:
Scan each statement for correctness based on standard function semantics.Statements about task encapsulation, decomposition, reuse, and void/value-returning functions are all true.The claim that a function can be called only once is false. Functions can be called any number of times, including zero, once, or thousands of times.Verification / Alternative check:
Consider a utility like max(a, b) or std::sort: these are intentionally designed to be reused and called multiple times in a single program run.Why Other Options Are Wrong:
Common Pitfalls:
Final Answer:
Functions can be called, or invoked, only once in a program
Discussion & Comments