UGC-NET Jan 2017 · Functions of a Single Variable

MCQ · 2 marks · Problem EM-LIMC-0027

Which one of the following is correct for overloaded functions in $C++$?
  1. A
    Compiler sets up a separate function for every definition of function.
  2. B
    Compiler does not set up a separate function for every definition of function.
  3. C
    Overloaded functions cannot handle different types of objects.
  4. D
    Overloaded functions cannot have same number of arguments.

Solve it on GATE DA practice →More Differential Calculus problems

Show the worked solutionEach overloaded version is a distinct function with its own signature. The compiler compiles each definition separately (with its own mangled name) and picks one at each call by overload resolution.(B) contradicts this — incorrect.(C) Overloading exists precisely to handle different argument types — incorrect.(D) Overloads may have the same number of arguments if the types differ — incorrect.Answer: A

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com