Question 0-2

Assume that the following Ada program compiled successfully.

with Text_IO; use Text_IO;

procedure Test is
    I : Integer;
    J : Integer;

    procedure Y(A : Integer; B : Integer) is
    begin
        A := 5;
        B := A + J;
        I := B + I;
    end Y;
begin
    I := 3;
    J := 2;
    Y(I, J);
    Put_Line(Integer'Image(I) & " " & Integer'Image(J));
    Y(I, I); -- Note: I is passed for both parameters!
    Put_Line(Integer'Image(I));
end Test;

Solution

Back to Exam 0