(a) Using the scope rules of Pascal determine the declaration that apply to…

PYQ GATE 1995Modified — slightly modified from the official paper; see the solution

(a) Using the scope rules of Pascal determine the declaration that apply to each occurrence of the names A and B in the following program segment.

procedure T(U, V, X, Y: integer);

var

A: record A, B : integer end;

B: record B, A : integer end;

begin

with A do begin A:=4; B:=V end;

with B do begin A:=X; B:=Y end

end;

(b) Find the errors in the following Pascal statement:

if A > 1, then B = 2.5A else read (C);

Sign up free to check your answer

Sign up free

Explore the full course: Zero To Hero

Loading lesson…