Multiple choice technology programming languages

Can 2 functions have same name & input parameters but differ only by return data type?

  1. True

  2. False

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Function overloading requires differences in the parameter list (number, types, or order), not just the return type. In languages like Java, C++, and C#, the return type is not part of the function signature used for overload resolution. If two functions differ only by return type, the compiler cannot determine which one to call in contexts like standalone function calls or assignments where the return type isn't immediately clear.