1.

To use extern variable _____________________(a) The source file must not be included in the new file code(b) The source file itself must be used for a new program(c) The source file must be included in the new file(d) The source file doesn’t matter for extern variablesI had been asked this question in an interview for internship.This is a very interesting question from Extern Variable topic in chapter Memory Allocation & Scope of Variable of Object Oriented Programming

Answer»

The correct choice is (c) The source file must be INCLUDED in the new file

Explanation: The source file must be included in the file which NEEDS to use the EXTERN variable. This is done to ENSURE that the variables that are already declared can be used again. Only the declarations are used from one file to ANOTHER.



Discussion

No Comment Found

Related InterviewSolutions