Name _______________________
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 |
end
<procedure_name>; Jgrasp doesn’t appear to require the procedure name
but I do |
2.
How many reserved words are there in |
63 in |
3.
What is the assignment operator in |
:= |
4.
What is the |
the for loop for <lcv> in
<start>..<finish> loop ... – <end loop>; |
5.
What other types of loops does |
loop
... end loop; potentially infinite loop; can get out with an
exit or an exit when
(<condition>) ada
loops can have names associated with them
often used when loops are nested and programmer wants to exit from more
than the nearest surrounding loop while
(<condition>) loop ... end
loop; |
6.
What is the function of a semi-colon in |
statement terminator remember that
in Pascal, the semi-colon was a separator
and that in FORTRAN the end of the line (i.e. card) was the statement
terminator unless there was a continuation card. |
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 |
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. Pass by
reference passes an address |
8.
FORTRAN had two types of subprograms and
so did Pascal, how many does |
two |
9.
What are the |
procedures and functions Note: packages are not callable – and are not subprograms. They are “withed” The “with” is like
an “include” in C or an “import’ in Java |
10.
Who is responsible for the development
of the |
The Department of Defense
-Jean Ichbiah was the leader of the team whose design was the final one. |
11.
What was the intended use for the |
real time embedded systems |
12.
What are the discrete data types in |
integers, booleans,
characters, enumeration |
13.
What are the structured data types in |
arrays, records these
have component parts |
14.
What other data type is there in |
access types, real real
includes both fixed and float |
15.
What do you need to include in your
program in order to be able to input or output text in |
with ada.text_io; you do not need use ada.text_io; you can always use a
fully qualified reference and in this class you should NOT use use clases. |
16.
Write the |
type vegetable is (carrots, peas, beans, zucchini); the order in which the vegetables appear is entirely
up to the programmer but once entered, the order is significant. Peas is the succ
of carrots and the pred of beans. |
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); this is an example of an instantiation. You do not need a use clause. The instantiation for integers has
been done for you in Ada 95, you had to do it
yourself in |
18.
Is it legal to
have the same value as an element of two different enumerated types in (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 a variable declared to be a trafficLight
can not be assigned the value of orange or blue. Likewise a variable declared to be a crayon
can not be assigned the value of green or yellow. Each type needs a separate instantiation in
order to read or write values of the type. |
19.
In |
they have equal precedence And has higher precedence in Pascal. What about in FORTRAN? |