Question
For this problem, assume that an int is stored in 8 bits. What value would be displayed to the screen when the following code executes?
For this problem, assume that an int is stored in 8 bits. What value would be displayed to the screen when the following code executes?
int a = 36; int b = 8; int c = a * b; printf("%d ", c);
Question options:
An error message appears | |
288 | |
32 | |
-224 |
The figure above shows you the bytes stored in a small portion of memory and in some registers. The memory is simply a byte dump similar to what you would get in gdb if you asked for 64 bytes while the registers show you values as 64-bit words. Which memory location holds the long value -8? (Recall that a long is 8 bytes wide and that Intel is little endian.)
Question options:
0x1028 | |
0x1020 | |
0x1010 | |
0x1018 |
The figure above shows you the bytes stored in a small portion of memory and in some registers. The memory is simply a byte dump similar to what you would get in gdb if you asked for 64 bytes while the registers show you values as 64-bit words.
What happens if we execute the assembly instruction
movl %edx, %ecx
Question options:
The value of the %rcx register becomes 0x CC CC CC CC FF FF FF F8. | |
The value of the %rcx register becomes 0x 00 00 00 00 FF FF FF F8. | |
The value of the %rdx register becomes 0x FF FF FF FF 00 00 00 08. | |
The value of the %rcx register becomes 0x FF FF FF FF FF FF FF F8. |
The figure above shows you the bytes stored in a small portion of memory and in some registers. The memory is simply a byte dump similar to what you would get in gdb if you asked for 64 bytes while the registers show you values as 64-bit words.
movq (%rbx), %rax
Question options:
The %rax register gets the value 0x 18 10 00 00 00 00 00 00 | |
The bytes in locations 0x1020 through 0x1027 get the values AA, AA, AA, AA, 00, 00, 00, and 01 respectively. | |
The %rax register gets the value 0x 20 10 00 00 00 00 00 00 | |
The %rax register gets the value 0x 00 00 00 00 00 00 10 18 |
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