Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

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

More Books

Students also viewed these Databases questions

Question

Explain walter's model of dividend policy.

Answered: 1 week ago

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago