Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider a main program. Assume that the programmer declares the following variables: x, y, z , and result . At execution, variables are stored in

  1. Consider a main program. Assume that the programmer declares the following variables: x, y, z, and result. At execution, variables are stored in the memory starting at the address (4EF) H and each variable takes 2 bytes. Integers are represented in 2s complement on 2 bytes. The variables x, y, and z are initialized to -7, -15 and 30 (in decimal), respectively. Consider that the system is byte addressable, and one instruction takes 2 bytes. Consider that a function is called in the main program at the address (54E) H. The function has the definition: int func(int x, int y, int z). The function is located at the address (AB9) H.

int func(int x, int y, int z) {

int a;

a = (x +y) z;

return a;

}

  1. Draw a diagram of the process address space indicating the data (heap), stack and code. Indicate what the content of the data and stack is during the time when the function is called and executed. Write addresses and data in HEX.
  2. What are the values of the program counter before, during and after the function execution?
  3. What is the value of result variable after the function executes? Give the answer in HEX.

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

Joe Celkos Data And Databases Concepts In Practice

Authors: Joe Celko

1st Edition

1558604324, 978-1558604322

Students also viewed these Databases questions

Question

Perform an Internet search. Discuss a company that uses EPLI.

Answered: 1 week ago

Question

How do you feel about employment-at-will policies? Are they fair?

Answered: 1 week ago