Output for values
Not what you're looking for?
4. Consider the following program in Pascal with static scope:
program main (input, output);
var i, j, k, m: integer;
procedure Q (var i: integer; m: integer);
begin
i := j + 1;
m := k + 1;
writeln (i, j, k, m);
end
procedure P(var i: integer; j: integer);
var k: integer;
procedure S(i: integer)
begin
i := k + 3;
m := i + 3;
writeln(i, j, k, m);
end
begin
k := 8;
i := i + k;
j := j + k;
Q(i, j);
writeln(i, j, k, m);
S(m);
writeln(i, j, k, m);
end
begin
i := 5;
j := 2;
k := 7;
m := 9;
writeln(i, j, k, m);
P(i, k);
writeln(i, j, k, m);
Q(j, m);
writeln(i, j, k, m);
end
Please fill in the following table with the values of i, j, k, and m for each writeln
statement. Assume use call by value
Place of writeln statement i: J: k: m:
1. In Main, before calling P
2. In Q
3. In P after Q
4. In S
5. IN P after S
6. In Main after P
7. In Q
8. In Main
Purchase this Solution
Solution Preview
Solution:
i j k m
1. 5 2 7 9 as given in problem
2. 3 2 7 8 i,m are local to Q passed from P ...
Purchase this Solution
Free BrainMass Quizzes
Basic UNIX commands
Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.
Basic Networking Questions
This quiz consists of some basic networking questions.
C# variables and classes
This quiz contains questions about C# classes and variables.
Java loops
This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.
C++ Operators
This quiz tests a student's knowledge about C++ operators.