Name _______________________   Max Points: 20   Earned Points:  ____

 

NOTE:  The answers to some of these questions may be found in the code samples you have seen.  You may find others in our text book and still others on the Web.  The best source of information is the Ada Information Clearing House (fondly called AdaIC) whose web address is on the useful URL page.  Required parts of answers are in red.  Additional information is in blue. 

 

1.        What is the last line in a Ada program? 

end <filename>;

2.       How many reserved words are there in Ada?

 63  or  69  List

3.       What is the assignment operator in Ada?

:=

4.       What is the Ada equivalent of the FORTRAN  DO loop?

the for loop

for <lcv> in <start>...<finish> loop

...

<end loop>;

5.       What other types of loops does Ada have?

loop ... end loop;

while (<condition>) loop

...

end loop;

6.       What is the function of a semi-colon in Ada?

statement terminator

7.       In FORTRAN, parameters were passed by reference. In Pascal they were passed by value (copy in) or by reference (var).  How are they passed in  Ada (i.e. what are the parameter modes)

in  - which is copy in

out – which is copy out

in out – which is copy in / copy out

Note: this looks like pass by reference in most cases

8.       FORTRAN had two types of subprograms and so did Pascal, how many does Ada have?

two

 

9.       What are the Ada subprograms called?

procedures and functions Note: packages are not callable – and are not subprograms.

10.     Who is responsible for the development of the Ada programming language?     

The Department of Defense

11.      What was the intended use for the Ada programming language?

real time embedded systems

12.     What are the discrete data types in Ada?

integers, booleans, characters, enumeration

13.     What are the structured data types in Ada?

arrays, records  these have component parts

14.     What other data type is there in Ada?

access types, float also fixed

15.     What do you need to include in your program in order to be able to input or output text in Ada?

with ada.text_io;

16.      Write the Ada code that would declare a new type called vegetable that consists of the vegetables carrots, peas, beans, zucchini. 

type vegetable is (carrots, peas, beans, zucchini);

17.      Write the statement you would need in your program to be able to read and write values of type vegetable.  You may assume that your program already has with ada.enumerated_text_io;  at the top.

package <name> is new ada.eumerated_text_io (vegetable);

18.     Is it legal to have the same value as an element of two different enumerated types in Ada?

  (i.e. can you have the following two type declarations in the same program?

type trafficLight is (red, green, yellow);

type crayon is (red, orange, blue);

yes

19.     In Ada, which has higher precedence and or or? or do they have equal precedence?

they have equal precedence