Question 1-2

Consider the following Ada program.

with Text_IO; use Text_IO;
procedure Test is
    X : Integer;

    procedure A is begin
        X := 3;
    end A;

    procedure B is
        X : Integer;
    begin
        X := 4;
        A;
        Put_Line(Integer'Image(X));
    end B;
begin
    X := 2;
    B;
    Put_Line(Integer'Image(X));
end Test;

Solution

Back to Quiz 1