C# Programming - Functions and Subroutines - Discussion

Discussion :: Functions and Subroutines - General Questions (Q.No.10)

10. 

If a function fun() is to receive an int, a Single & a double and it is to return a decimal then which of the following is the correct way of defining this function?

[A].
decimal static fun(int i, Single j, double k)
{ ... }
[B].
decimal fun(int i, Single j, double k)
{ ... }
[C].
static decimal fun(int i, Single j, double k)
{ ... }
[D].
static decimal fun(int i, Single j, double k) decimal
{ ... }
[E].
static fun(int i, Single j, double k)
{ 
    ... 
    return decimal;
}

Answer: Option C

Explanation:

No answer description available for this question.

Daniel Hursan said: (Oct 5, 2014)  
Why does C) need to be the only accepted correct answer.

There is no specification of how the method should be accessed(static or object instance).

Wouldn't B) be the correct answer as well ?

Vijayan said: (Jun 16, 2017)  
Why not?

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.