ADA95 Flashcards

(15 cards)

1
Q

Which operator is used to map a value to a specific parameter or choice.

A

=> arrow

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Who led the main consortium team to revise Ada to become Ada 95?

A

Tucker Taft

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Identify the pair of keywords used to perform short-shircuit logical evaluations.

A

and then and or else

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which common graph representation is memory-efficient, allows for fast iteration, and makes adding edges easy by treating the graph like a collection of linked lists?

A

Adjacency List

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The Ada feature that allows defining operations that work on different concrete types using inheritance and dispatching.

A

Polymorphism

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Ada 83 already featured full support for inheritance and polymorphism before the Ada 9X project began.

A

False. Ada 83 lacked full support for these OOP features, which is the primary reason of Ada 95 being developed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

An unconstrained array (defined with the box notation <>) requires the index bounds to be specified at the time the variable is declared.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

It is allowed in Ada 95 to name a variable starting with underscores as long as a letter would follow

A

False. Underscores cannot be the first or last character of the identifier, and cannot have two underscores in a row

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

A loop statement must have a loop statement identifier in order to perform iteration.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Ada 95 includes object-oriented features such as tagged types and dispatching operations

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Determine the output of variable G in this Ada 95 program.

with Ada.Text_IO; use Ada.Text_IO;

procedure AliasD is
G : Integer := 10;

procedure Modify (P : in out Integer) is
begin
G := 50;
P := P + 1;
end Modify;

begin
Modify(G); – We pass the Global variable as the parameter
Put_Line(Integer’Image(G));
end AliasD ;

A

11 because of the strict Ada 95 rule of by copy

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the output of this PrintChar Ada 95 program?

with Ada.Text_IO; use Ada.Text_IO;
procedure PrintChar is
– A procedure that accepts a String of any length
procedure Print_Head (S : String) is
begin

  Put(S(1));    end Print_Head;

Message : String(10 .. 12) := “Ada”;

begin
Print_Head(Message);
end PrintChar;

A

Constraint_Error because the first character starts at 10 and 1 is out of bounds.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Given the array declaration type Int_Array is array (1 .. 10) of Integer;, how do you access the sixth element?

A

Int_Array(6)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Determine the output of this simple call and return Ada 95 program when Main is executed.

procedure Print_Message is
begin
Put_Line(“Is this the end?”);
end Print_Message;

procedure Main is
begin
Print_Message;
Put_Line(“This is the start.”);
end Main;

A

Is this the end?
This is the start.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Determine the before and after values of the variable SwapVal and array named Names.

with Ada.Text_IO; use Ada.Text_IO;

procedure Simple_Swap is
– Define fixed-length string type
subtype Name_String is String(1..10);

– Define array type
type Name_Array is array (1..4) of Name_String;

– Initialize variables
SwapVal : Name_String := “Rodrigo “;
Names : Name_Array := (“Judyville “,
“Wennette “,
“Marie “,
“Eysie “);
Temp : Name_String;

begin

Temp := SwapVal;
SwapVal := Names(1);
Names(1) := Temp;

Put_Line(“After swap:”);
Put_Line(“SwapVal = “ & SwapVal);
for I in Names’Range loop
Put_Line(“Names(“ & Integer’Image(I) & “) = “ & Names(I));
end loop;

end Simple_Swap;

A

After swap:
SwapVal = Judyville
Names( 1) = Rodrigo
Names( 2) = Wennette
Names( 3) = Marie
Names( 4) = Eysie

How well did you know this?
1
Not at all
2
3
4
5
Perfectly