Difficulty: Easy
Correct Answer: by value
Explanation:
Introduction / Context:Understanding how function arguments are passed is vital to predict whether a callee can modify a caller's data. C++ supports three common styles: pass-by-value, pass-by-reference, and pass-by-pointer. This question focuses on the style where only the data's current content is copied into the function, leaving the caller's original variable unchanged.
Given Data / Assumptions:
Concept / Approach:
Step-by-Step Solution:
Identify which method supplies only the data's contents, not its identity/location → pass-by-value.Confirm that changes in the callee do not propagate back to the caller's variable.Hence the blank is correctly filled by 'by value'.Verification / Alternative check:
Example: void inc(int x){ x++; } int a=5; inc(a); a remains 5 after the call because x is a copy.Why Other Options Are Wrong:
Common Pitfalls:
Final Answer:
by value
Discussion & Comments