If a variable is created inside a function (a Local Variable), what happens to…
2026
If a variable is created inside a function (a Local Variable), what happens to that variable once the function finishes its execution and returns a value?
Answer: C. It is “destroyed” or removed from memory and its value is no longer accessible.
- A.
It is stored in the global memory for the rest of the program’s life.
- B.
It is permanently saved to the hard drive.
- C.
It is “destroyed” or removed from memory and its value is no longer accessible.
- D.
It is renamed automatically to avoid confusion with other variables.
Attempted by 291 students.
Show answer & explanation
Correct answer: C
Loading lesson…