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;
        I := 6;
        B := A + I;
    end Y;
begin
    I := 4;
    J := 8;
    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) & " " & Integer'Image(J));
end Test;

Solution

Back to Quiz 0