1.

Which is the correct condition for the default arguments?(a) Those must be declared as last arguments in argument list(b) Those must be declared first in the argument list(c) Those can be defined anywhere in the argument list(d) Those are declared inside the function definitionI have been asked this question in an internship interview.Asked question is from Default Arguments topic in section Default Arguments vs Overloading, Upcasting and Downcasting of Object Oriented Programming

Answer»

Right option is (a) Those must be declared as last arguments in ARGUMENT list

For EXPLANATION: The DEFAULT arguments must be declared at last in the argument list. This is to ensure that the arguments doesn’t CREATE ambiguity. The normal arguments should be passed first.



Discussion

No Comment Found

Related InterviewSolutions