Question: 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
![3. [28 points] For this problem we will focus on a](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3b5b028d59_79166f3b5af9ecb8.jpg)
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
Get step-by-step solutions from verified subject matter experts
