Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

III) Given the next pseudo block structured program: 1. program test; 2. varx: integer; y: array [1..4] of integer; procedure Pli: integer; j: integer); 4.

image text in transcribed

III) Given the next pseudo block structured program: 1. program test; 2. varx: integer; y: array [1..4] of integer; procedure Pli: integer; j: integer); 4. begin(*P*) 5. j:= 3; 6. Writeln("inside P"); Writeln(i, x, j); 7. end; (*P*) 8. begin (*test*) 9. X:= 2; y[1]:= 3; y[2]:= 50; y[3]:= 10; y[4] := 30; 10. Ply[x], x); 11. P(x,y[x]); 12. Writeln("back in test: "); Writeln(x); Writeln(y[x]) 13. end (*test*) Write the output of the program if: (parts a and b (next) are totally independent) a) i is passed by value and jis passed by reference. (10 pts) (first call of P) "inside Pia X = ju (second call of P) + "inside P" i = X = j = "back in test:" x = y[x] b) i is passed by name and j is passed by value-result. (10 pts) (first call of P) "inside P" i = x = j= (second call of P) "inside P" i = X = "back in test: X = y[x] = III) Given the next pseudo block structured program: 1. program test; 2. varx: integer; y: array [1..4] of integer; procedure Pli: integer; j: integer); 4. begin(*P*) 5. j:= 3; 6. Writeln("inside P"); Writeln(i, x, j); 7. end; (*P*) 8. begin (*test*) 9. X:= 2; y[1]:= 3; y[2]:= 50; y[3]:= 10; y[4] := 30; 10. Ply[x], x); 11. P(x,y[x]); 12. Writeln("back in test: "); Writeln(x); Writeln(y[x]) 13. end (*test*) Write the output of the program if: (parts a and b (next) are totally independent) a) i is passed by value and jis passed by reference. (10 pts) (first call of P) "inside Pia X = ju (second call of P) + "inside P" i = X = j = "back in test:" x = y[x] b) i is passed by name and j is passed by value-result. (10 pts) (first call of P) "inside P" i = x = j= (second call of P) "inside P" i = X = "back in test: X = y[x] =

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions