Explore BrainMass
Share

Output for values

This content was STOLEN from BrainMass.com - View the original, and get the already-completed solution here!

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

© BrainMass Inc. brainmass.com October 24, 2018, 8:33 pm ad1c9bdddf
https://brainmass.com/computer-science/algorithms/output-for-values-100222

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 ...

$2.19
See Also This Related BrainMass Solution

Calculating profit maximizing output level and price

Suppose a company has just introduced a new line of ceramic insulators for which it has received patent protection, effectively granting the company monopoly status in the industry. The company's revenue and cost relations are given as:

TR = $300Q - $0.001Q2

TC = $9,000,000 + $20Q + $0.0004Q2

where TR is total revenue, Q is output, and TC is total cost.

a) As a monopolist, calculate this firm's optimal output (Q) and price per unit (P).
b) Calculate the level of total profit at this output level and also the value of per unit profit at this output level.

View Full Posting Details