string squareint a return Commencing Which option represen
string square(int a)
{
return \"Commencing\";
}
Which option represents are a legal call to the fuction named square()?
A. int a = square(4);
B.string a = square(\"help\");
C. double a = square(4.0);
D. string a = square(4);
E. None of theses are legal
Solution
Given, Function
string square(int a)
{
return \"Commencing\";
}
In above function, String a=square(4) is a legal call to the function because
the function definition is;
So, In given function, the return type is a string and square is a function name and a is a parameter of int type.
In option A. return type is an integer. So, it is wrong.
In option, B. Parameter is of string type which is wrong.
In option C. return type is double and a parameter is of double type.
In option, D. return type is string and parameter are of integer type. So, it is right.
In option E. Option D is legal, So, it is wrong.
Therefore, Option D. string a=square(4); is correct. It is a legal call to the function named square.
