Consider the following Pascal function: function X (M:integer) : integer; var…

GATE · 1991 · CS · Question 3 subpartsModified — slightly modified from the official paper; see the solution

Consider the following Pascal function:

function X (M:integer) : integer;

var i:integer;

begin

i:=0;

while i*i<M do i:=i+1

X:=i;

end

The function call X(N), if N is a positive integer that is not a perfect square, will return

  1. A.

    (√N)

  2. B.

    (√N)+1

  3. C.

    [√N]

  4. D.

    [√N]+1

  5. E.

    None of the above

Attempted by 25 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…