ADA95 Flashcards

(79 cards)

1
Q

Name the team, led by Jean Ichbiah in France, that was selected by the DoD to design the programming language that ultimately became Ada.

A

Green team

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

Augusta Ada Byron, for whom the language is named, is recognized for her work on an algorithm intended for what early machine?

A

Analytical Engine

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

The Department of Defense formed the High Order Language Working Group (HOLWG) in 1975 to address a massive industry problem regarding maintenance and cross-language interoperability. What was this period of time known as in the software industry?

A

Software crisis

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

What is the name of the final requirements document that preceded the design of Ada, following the Strawman, Woodenman, Tinman, and Ironman documents?

A

Steelman

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

Ada 95 was the world’s first internationally standardized object-oriented programming language.
True or False

A

True

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

What specific built-in data type provides unsigned integer arithmetic with wrap-around behavior at the modulus value?

A

Modular Types

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

What keyword is used to declare a binding to a value that cannot change after it has been elaborated?

A

constant

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

In ADA95, Which user-defined type allows a programmer to create an ordered list of distinct, named values?

A

Enumerated types

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

Ada 95 supports implicit variable creation, meaning variables do not always need explicit declarations.
True or False

A

False

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

What specific type in Ada 95 functions similarly to pointers in C, providing references to dynamically allocated objects while offering null checking?

A

Access types

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

What reserved word is used in a package specification to hide the implementation details of an abstract data type?

A

private

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

In ADA95, This heterogeneous data structure groups related data of different types under a single name, functioning similarly to structs in C.

A

Records

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

Identifiers in Ada 95 are case-sensitive. True or False

A

False

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

What character is used to separate identifiers from their type or subtype in a variable declaration?

A

Colon (:)

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

In Ada 95, this sequence of two adjacent hyphens (–) is used to indicate the start of what?

A

A comment

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

How many reserved words (keywords) does standard Ada 95 have?

A

69

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

Which operator symbol is used for exponentiation in Ada 95?

A

**

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

Ada 95 uses a fixed text format where specific parts of the code must be placed in designated columns or zones.
True or False

A

False

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

What punctuation symbol acts as a selector to access components of packages or records?

A

Full Stop (.)

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

Which symbol is known as the “box” and is used to specify an indefinite range in unconstrained arrays?

A

<> (Box)

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

The inequality operator in Ada 95 is represented by the != symbol.
True or False

A

False

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

In ADA95, What operator is used for logical negation in a boolean expression and holds the highest precedence?

A

not

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

Which simple statement is used when a statement is syntactically required by the compiler but no action is desired?

A

Null Statement

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

A case statement in Ada 95 requires that every possible value of the discrete expression be covered exactly once.
True or False

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What reserved word is used to catch unexpected values at the end of a case statement's list of alternatives?
others
26
Ada 95 has a built-in post-test loop structure explicitly named do ... while. True or False
False
27
What type of iteration scheme evaluates its condition before each iteration, executing the loop body zero or more times?
Pre-test (while) loop
28
In a for loop, what reserved word is used to make the loop parameter take on values in decreasing order?
reverse
29
What statement is used to immediately terminate the execution of a loop prematurely?
exit statement
30
To explicitly transfer control to a target statement with a given label, which statement is used?
goto statement
31
What are the two short-circuit logical operators available in Ada 95 used to prevent the evaluation of the second operand if it is unnecessary?
and then and or else
32
Which form of subprogram computes and returns exactly one value?
Function
33
The default parameter mode for a subprogram in Ada 95 is the in mode. True or False
True
34
Which parameter mode allows a subprogram to both read and modify the caller's variable?
in out mode
35
What type of subprogram calls itself, either directly or indirectly, to solve a problem?
Recursion / Recursive subprogram
36
What predefined root package is implicitly available to all Ada programs and defines basic scalar types like Integer and Boolean?
Standard
37
What are Ada's built-in concurrent units of execution called?
Tasks
38
Synchronization between tasks is achieved via rendezvous using accept statements and what type of calls?
Entry calls
39
An abort statement can synchronously and safely pause a running task until it is resumed. True or False
False
40
To handle error conditions structurally, what mechanism is localized using a when clause (e.g., when Constraint_Error =>)? declare X, Y : Integer := 0; begin X := 10 / Y; -- may raise Constraint_Error exception when Constraint_Error => Put_Line ("Division by zero detected"); end;
Exception Handling / Exception handlers
41
Which exception is raised at compile-time or runtime if a value violates its target's subtype bounds (e.g., assigning 32 to a variable restricted to 1..31)?
Constraint_Error
42
In Ada 95, functions can be invoked as standalone statements even if their return value is ignored. True or False
False
43
In Ada 95, you can implicitly mix logically different derived types (like adding a Meters type to a Seconds type) without raising a compile error. True or False
False
44
Create a statement in Ada 95 that declares a constant named Max_Size of type Integer with a value of 500 assigned to it.
Max_Size : constant Integer := 5
45
Create a statement in Ada 95 that declares an unconstrained array type named Float_Array holding Float elements, indexed by Integer.
type Float_Array is array (Integer range <>) of Float;
46
Create a simple if statement in Ada 95 that checks if a variable Age is greater than or equal to 18. If true, assign the Boolean variable Is_Adult to True.
if Age >= 18 then Is_Adult := True; end if;
47
Create a statement in Ada 95 that uses a for loop to iterate a variable I from 1 to 10.
for I in 1 .. 10 loop
48
What is the output of the following program snippet? Count : Integer := 3; while Count > 0 loop Put_Line(Integer'Image(Count)); Count := Count - 1; end loop;
3 2 1
49
What is the output of the following program snippet? for I in 1 .. 5 loop if I = 3 then exit; end if; Put(Integer'Image(I)); end loop;
1 2
50
What is the output of the following program snippet? Score : Integer := 85; case Score is when 90 .. 100 => Put_Line("Excellent"); when 80 .. 89 => Put_Line("Good"); when others => Put_Line("Needs Improvement"); end case;
Good
51
- Which operator is used to map a value to a specific parameter or choice.
=> arrow
52
- Who led the main consortium team to revise Ada to become Ada 95?
Tucker Taft
53
- Identify the pair of keywords used to perform short-shircuit logical evaluations.
and then and or else
54
- 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?
Adjacency List
55
- The Ada feature that allows defining operations that work on different concrete types using inheritance and dispatching.
Polymorphism
56
- Ada 83 already featured full support for inheritance and polymorphism before the Ada 9X project began. True or False
False. Ada 83 lacked full support for these OOP features, which is the primary reason of Ada 95 being developed
57
- An unconstrained array (defined with the box notation <>) requires the index bounds to be specified at the time the variable is declared. True or False
True
58
- It is allowed in Ada 95 to name a variable starting with underscores as long as a letter would follow True or False
False. Underscores cannot be the first or last character of the identifier, and cannot have two underscores in a row
59
- A loop statement must have a loop statement identifier in order to perform iteration. True or False
False
60
- Ada 95 includes object-oriented features such as tagged types and dispatching operations. True or False
True
61
- 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 ;
11 because of the strict Ada 95 rule of by copy
62
- 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;
Constraint_Error because the first character starts at 10 and 1 is out of bounds.
63
- Given the array declaration type Int_Array is array (1 .. 10) of Integer; how do you access the sixth element?
Int_Array(6)
64
- 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;
Is this the end? This is the start.
65
- 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;
After swap: SwapVal = Judyville Names( 1) = Rodrigo Names( 2) = Wennette Names( 3) = Marie Names( 4) = Eysie
66
What is the Assignment statement syntax of Ada95
assignment_statement ::= variable_name := expression;
67
Constraint values to a specific numeric range, subset of a parent type. They provide automatic bounds checking, making programs safer by catching out-of-range errors at compile-time or runtime.
Subrange types
68
Define an ordered list of distinct, named values. The compiler assigns ordinal positions starting from 0. They're ideal for representing states, categories, or any fixed set of options, providing type safety and readability.
Enumerated types
69
Create new types based on existing types, inheriting the parent's operations but remaining type-incompatible. This enforces strong typing to prevent mixing logically different values (like adding meters to seconds).
Derived types
70
Hide implementation details in package specifications while exposing only the interface. This enables encapsulation and data abstraction, allowing implementation changes without affecting client code.
Private types
71
Access types are Ada's pointers, providing references to dynamically allocated objects. They're safer than C pointers with null checking and strong typing, enabling dynamic data structures like linked lists and trees.
Access types
72
exit statement with a condition (no loop name)
Count : Integer := 1; loop exit when Count = 3; Count := Count + 1; end loop;
73
if statements if Month = December and Day = 31 then Month := January; Day := 1; Year := Year + 1; end if;
January 1, 2026
74
case statement
case Day_Of_Week is when Monday | Wednesday | Friday => Put_Line("Workout day"); when Tuesday | Thursday => Put_Line("Yoga day"); when Saturday | Sunday => Put_Line("Rest day"); when others => Put_Line("Invalid day"); end case;
75
type Day_Number is range 1 .. 31; type Temperature is range -50 .. 50; type Percentage is range 0 .. 100; type Age is range 0 .. 120; declare Today : Day_Number := 15; Temp : Temperature := 22; begin Today := Today + 1; end;
Today := 32
76
Loop Statement without Loop Identifier
loop Put_Line("Hello"); exit; end loop;
77
Loop with a Label
Main_Loop: for I in 1 .. 10 loop if I = 5 then exit Main_Loop; end if; end loop Main_Loop;
78
while
Count : Integer := 1; while Count <= 3 loop Count := Count + 1 end loop;
79
for
Main_Loop: for I in 1 .. 10 loop if I = 5 then exit Main_Loop; end if; end loop Main_Loop;