Machine-translated by Google. Questions are authored in English.
Top

Discussion

Longevity of a variable refers to

  • A.The duration for which the variable retains a given value during the execution of a program.
  • B.The portion of a program in which the variable may be visible.
  • C.Internal linkage of a variable.
  • D.External linkage of a variable.

Answer: A

Correct answer: The duration for which the variable retains a given value during the execution of a program.

Longevity (or lifetime, or storage duration) is about time - how long the variable’s storage exists and keeps its value. That is a different question from scope, which is about place: the part of the program in which the name is visible. A static local has a short scope but the longest possible lifetime.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.