Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 1 (15 marks) o) (5 marks) The following programming model contains in its code memory the indicated C program composed of a single main
Question 1 (15 marks) o) (5 marks) The following programming model contains in its code memory the indicated C program composed of a single main function. You will be showing how the working memory is used during the execution of main. Show hovw the given C program affects the contents of the working memory . Show the values are assigned to the variables. Be sure to show all values that are assigned and replaced. Record successive assignments to variables/parameters as follows Variable naime 2/6,4, 10 Code Memory Working Memory void sain void Int 1ogiovar f logio varlable fi some variables for oreating logio expeessions CPU (b) (10 marks) The following programming model contains in its code memory the indicated C program composed of 2 functions. You must show how the working memory is used during the execution of the two functions. Each piece of working memory is associated to a function using a pair of lines. (Note: the first pair of lines associates the piece of working memory allocated to the function main and the second pair of lines associates the piece allocated to the function computeVariance4). Show how the given C program affects the contents of the working memory: Show the values are assigned to variables. Be sure to show all values that are assigned and replaced. Rccord successive assignments to variables/parameters as follows: . Using arrows show how values are copied between the working memory allocated to the function main and the working memory allocated to the function computeNetResistance. . In the console window show the output of the program Code Memory Working Memory include // Function prototype double computeVariance4 (double, double, double, double) void main) double nl: double n2 double n3; double n4; double variance: n1 31.236; n2 28.445: n335.78: n4- 24.3 variance-computeVariance4 (nl, n2, n3, n4): printf ("The four values are : %.2f , .2f, .2f, %.2fla". ni, n2, n3, n4): printf ("The variance of the 4 values is .2fIn variance): double} oomputovarianoo4 (doublo ni , doublo n2, double n3, doubl@ n4) double variance: double avg; avg-nln2 3n4: avg-avg/4.0 variance(nlavg)* (nl-avg) variance variance(n2avg)*(n avg) variance- variance(n3-avg)(n3avg) variance- variance(n4-avg)(n4avg) variance variance/4.0: return (variance) Console CPU Note: You do NOT need to show how the CPU interacts with memory
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started