Question: There are two models for variables: Value model: A variable contains a value. Reference model: A variable refers to an object with a value in

There are two models for variables:

Value model: A variable contains a value.

Reference model: A variable refers to an object with a value in a different location

Given the following pseudocode segment in Ada-like syntax (3 points each. Total 6 points)

type T = record j: integer; end; S = record i : integer; n : T; end; var s1, s2 : S; sl.n.j := 20; s2 : = 1; s2.n.j := 10; writeln (s1.n.j);

a. Please give the output of the code if value model is used for all variables.

b. Please give the output of the code if reference model is used for all variables.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!