Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 1 (15 marks) (a) (5 marks) The following programming model contains in its code memory the indicated C program composed of a single main
Question 1 (15 marks) (a) (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 how 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 name % 2,6, A, 10 Code Memory Working Memory #include void main(void) // Variable declarations int logicvar; // logic variable double P, // some variables for creating logic expressions. // Instructions P-39.54; - 18.32; // Some logic expressions logicvar - (p 10.0); logicvar - (p 1/ Pinction prototype double computeVariance (double, double, double, double): void main double nii double n21 double double 1.4 double variance n1 - 31.236 m2 -28.445 m3 - 35.78 4 - 24.3 varianos - computovarianconi, 12, 13, 14) printf("the four values are: 1.21, 1.2, 1.21, 1.28 ", al, 12, 13, 14) printf("The variance of the 4 values is 6.2E ", variance) double computavaran(double nl, double double 1), double nd) double variance double avg avg - + 2 + 3 + 4 avg - avg/4.0) variance - ni - avg)(al - avg) varianos - variance (n2 - avg) (12 - avg) variance - variance + (n - avg) in3 - avg); variance - variance + (nd - avg) * ind - avg) variance - variance/4.0/ return (variance) Console CPU Note: You do NOT need to show how the CPU interacts with memory. Question 1 (15 marks) (a) (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 how 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 name % 2,6, A, 10 Code Memory Working Memory #include void main(void) // Variable declarations int logicvar; // logic variable double P, // some variables for creating logic expressions. // Instructions P-39.54; - 18.32; // Some logic expressions logicvar - (p 10.0); logicvar - (p 1/ Pinction prototype double computeVariance (double, double, double, double): void main double nii double n21 double double 1.4 double variance n1 - 31.236 m2 -28.445 m3 - 35.78 4 - 24.3 varianos - computovarianconi, 12, 13, 14) printf("the four values are: 1.21, 1.2, 1.21, 1.28 ", al, 12, 13, 14) printf("The variance of the 4 values is 6.2E ", variance) double computavaran(double nl, double double 1), double nd) double variance double avg avg - + 2 + 3 + 4 avg - avg/4.0) variance - ni - avg)(al - avg) varianos - variance (n2 - avg) (12 - avg) variance - variance + (n - avg) in3 - avg); variance - variance + (nd - avg) * ind - avg) 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