Question
What is the output of the following Ada-like program assuming the parameter passing mode is pass by: a) reference b) copy: value-result c) name procedure
What is the output of the following Ada-like program assuming the parameter passing mode is pass by:
a) reference
b) copy: value-result
c) name
procedure Main is i: integer := 3; type vector is array (1..3) of integer; a: vector := (3, 1, 2); procedure Put (v: vector) is begin put ("A = ("); for i in v'range loop Put (v(i)); Put (" "); end loop; Put_Line (")"); end Put; procedure Do_Something (t: mode integer) is begin i := i - 1; t := i + 1; a(t) := a(i) + 1; a(i) := a(t) + 1; i := i - 1; a(t) := t - 1; a(i) := a(t) - 1; end Do_Something; begin Do_Something(a(i)); Put (a); end Main;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started