Logical-Reasoning
November 14, 2023Question 10010 – Algorithms
November 14, 2023Programming
|
Question 16
|
What is the result of the following program?
program side-effect (input, output);
var x, result: integer;
function f (var x:integer):integer;
begin
x:x+1;f:=x;
end;
begin
x:=5;
result:=f(x)*f(x);
writeln(result);
end;
|
5
|
|
|
25
|
|
|
36
|
|
|
42
|
Question 16 Explanation:
If it is call by reference then answer is 42.
If it is call by value then answer is 36.
If it is call by value then answer is 36.
Correct Answer: D
Question 16 Explanation:
If it is call by reference then answer is 42.
If it is call by value then answer is 36.
If it is call by value then answer is 36.
