What is the value of X printed by the following program? program COMPUTE…

GATE · 1995 · CS · Question 2 subpartsModified — slightly modified from the official paper; see the solution

What is the value of X printed by the following program?

program COMPUTE (input, output);
  var
    X:integer;
  procedure FIND (X:real);
    begin
      X:=sqrt(X);
    end;
  begin
    X:=2;
    Find(X);
    Writeln(X)
  end.

  1. A.

    2

  2. B.

    √2

  3. C.

    Run time error

  4. D.

    None of the above

Attempted by 24 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…