Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. [28 points] For this problem we will focus on a hypothetical 16-bit machine (instead of 32 or 64 as we are accustomed to). This

image text in transcribed

3. [28 points] For this problem we will focus on a hypothetical 16-bit machine (instead of 32 or 64 as we are accustomed to). This means that, for this problem, an int is 2-bytes, a long is 4-bytes, while a char still is 1-byte. Also assume that signed values are encoded using a two's-complement encoding. Recall that the printf options relevant to this question are as follows: $p-pointer address (in hexadecimal) $u- unsigned decimal %c - character %d - signed decimal $x - unsigned hexadecimal $1x - long unsigned hexadecimal Consider the following portion of memory, displayed as a table like we have been drawing in class, but only two bytes wide, reflecting the fact that we are on a 16-bit machine. Each table cell is a memory location, which contains a single byte, with values shown in hex, and the address of the rightmost byte on each row is shown to the right of the row. Addresses increase as we move to the left and up in the table. Address d4 9c 0x7d4e 4e 88 0x7d4c ff 8d 0x7d4a la 3c 0x7d48 (a) [2 points] What are the contents of memory location Ox7d49 in binary? (b) [2 points] What are the contents of memory location 0x7d4c in binary? For each of the following code snippets, which include printf statements, write down what would be printed out. In each part, assume that p is a pointer of type void * that has the value Ox7d48. () [2 points) char *a - (char *); printf("$x", +a); Output: (d) [2 points) char *a - (char *)p; printf("%c", *a); Output

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

Who was the first woman prime minister of india?

Answered: 1 week ago

Question

Explain the concept of going concern value in detail.

Answered: 1 week ago

Question

Define marketing.

Answered: 1 week ago

Question

What are the traditional marketing concepts? Explain.

Answered: 1 week ago

Question

Understand why empowerment is so important in many frontline jobs.

Answered: 1 week ago