Quiz 0

One-page version suitable for printing.

Statistics:

mean     21.429 (300.000/14)
stddev   6.044
median   24.500
midrange 14.000-27.000

#   avg
1   7.29 / 10
2   6.79 / 10
3   7.36 / 10

Question 0-1

Complete the following Ada program to read 30~numbers from the user into an array and then echo back to the screen all that exceed 50.

with Text_IO; use Text_IO;
procedure Print_Large is
    package Int_IO is new Integer_IO(Integer); use Int_IO;


begin




end Print_Large;

Solution

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

Question 0-3

Use the following grammar in answering the questions below.

S -> N 0 N 1 N
N -> 0 N | 1 N | eps

Solution

Solution