Question: 1. (5 points) Consider the following function. integer fun(var k: integer) // k is an integer and passed by reference begin k:=k + 5; return

 1. (5 points) Consider the following function. integer fun(var k: integer)

1. (5 points) Consider the following function. integer fun(var k: integer) // k is an integer and passed by reference begin k:=k + 5; return (4 * k) - 1; end Suppose fun is used in the following program segment (stub): i:=8; suml :=(i * 4) + fun(i); j=6; sum2 := fun(j) + ( * 4); Note that var means the parameterk is passed by reference (i.e., its address is passed to the function). a. What are the values of suml and sum2, if the operands in the expressions to determine suml and sum2 are evaluated from left to right? b. What are the values of suml and sum2, if the operands in the expressions to determine suml and sum2 are evaluated from right to left

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 Databases Questions!