204k views
5 votes
Look at the following function prototype. double mynewFunction(int); What is the data type of the function’s return variable?

a.double
b.string
c.void
d.int

1 Answer

2 votes
The answer is A) Double.

The return type is specified before the method's signature, and the signature is composed of the the method's name and parameters.

In this case, the method is named mynewFunction, takes in an integer as a parameter, and returns a double.

Also, fun fact which is kind of unrelated: if two or more methods have the same name, they can have different functionality as long as their signature is different (different parameter types).
User Hyster
by
8.7k points