Explore BrainMass

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);
i := j + 1;
m := k + 1;
writeln (i, j, k, m);
procedure P(var i: integer; j: integer);
var k: integer;
procedure S(i: integer)
i := k + 3;
m := i + 3;
writeln(i, j, k, m);
k := 8;
i := i + k;
j := j + k;
Q(i, j);
writeln(i, j, k, m);
writeln(i, j, k, m);
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);
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

Solution Preview


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

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