1.

All variables declared within a block ____________________(a) Are not always automatic(b) Can be made non-automatic(c) Are static by default(d) Are automatic by defaultI had been asked this question during an online exam.The query is from Automatic Variable in section Memory Allocation & Scope of Variable of Object Oriented Programming

Answer» RIGHT answer is (d) Are AUTOMATIC by default

To EXPLAIN: The variables declared inside a block, are make automatic by default. This is to ensure that the variables get destroyed when not REQUIRED. The variables REMAIN live only till those are required, the life is dependent on the scope of a variable.


Discussion

No Comment Found

Related InterviewSolutions