Open In App

Aptitude | GATE CS 1998 | Question 48

Like Article
Like
Save
Share
Report

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;

(A) 5
(B) 25
(C) 36
(D) 42


Answer: (C)

Explanation:

Quiz of this Question


Last Updated : 12 Oct, 2017
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads