Examine the following piece of code and determine the data type of the function's return value.
Function Real sum (integer num1, integer num 2)
Declare Integer result
Set result = num1 + num2
Return result
End Function
A) Real
B) Integer
C) Sum
D) Result
E) None of these

Respuesta :

Answer:

The answer is "Option A".

Explanation:

In the code, there are so many errors, So the correct explanation of the code and wrong options are described as follows:

In the given question a method Realsum is defined that accepts two integer variable that is "num1 and num2" as a parameter. Inside a function, a variable Setresult is defined that add (num1 and num2) variable value and use return keyword for return added value. The function is given a real value because in the function if we pass negative or positive value it will calculate it and return its value.

wrong options:

  • In option b, The function returns a value that is positive or negative that it is not correct.
  • In option C, The function adds value and returns it value in the function there is not a sum that's why it is not correct.
  • In option D, The function returns a value that is stored in a setresult variable that's why it is not correct.