Assuming the value of %rax is 0xb0, what is the value stored in %rdx after the e
ID: 3935659 • Letter: A
Question
Assuming the value of %rax is 0xb0, what is the value stored in %rdx after the execution of the following statement:
leaq 8(%rax), %rdx
Give your answer in hex and omit a leading 0x
Answer:
Question 2
Not yet answered
Points out of 1.00
Flag question
Question text
Assuming the value of %rax is 0xb0 and the value of %rcx is 0xa00, what is the value stored in %rdx after the execution of the following statement:
leaq 8(%rax, %rcx), %rdx
Give your answer in hex and omit a leading 0x
Answer:
Question 3
Not yet answered
Points out of 1.00
Flag question
Question text
Assuming the value of %rax is 0xb0 and the value of %rcx is 0xf, what is the value stored in %rdx after the execution of the following statement:
leaq (%rax, %rcx, 2), %rdx
Give your answer in hex and omit a leading 0x
Answer:
Question 4
Not yet answered
Points out of 1.00
Flag question
Question text
Assuming the value of %rcx is 0x3, what is the value stored in %rdx after the execution of the following statement:
leaq (, %rcx, 4), %rdx
Give your answer in hex and omit a leading 0x
Answer:
Question 5
Not yet answered
Points out of 1.00
Flag question
Question text
Assuming the value of %rax is 0xf000 and the value of %rcx is 0x10, what is the value stored in %rdx after the execution of the following statement:
leaq 8(%rax, %rcx, 4), %rdx
Give your answer in hex and omit a leading 0x
Answer:
Question 6
Not yet answered
Points out of 1.00
Flag question
Question text
Using the values in memory and registers above, what is the destination address of the instruction below and the value that would be stored at that destination?
sarq $2, (%rax)
Select one:
a. destination address: 0x108, value: 0x04
b. destination address: 0x108, value: 0x18
c. destination address: 0x100, value: 0x10
d. destination address: 0x110, value: 0x03
e. destination address: 0x108, value: 0x12
Question 7
Not yet answered
Points out of 1.00
Flag question
Question text
Using the values in memory and registers above, what is the destination address of the instruction below and the value that would be stored at that destination?
addq %rcx, (%rax)
Select one:
a. destination address: 0x100, value: 0x10
b. destination address: 0x118, value: 0x18
c. destination address: 0x108, value: 0x04
d. destination address: 0x118, value: 0x03
e. destination address: 0x108, value: 0x12
Question 8
Not yet answered
Points out of 1.00
Flag question
Question text
Using the values in memory and registers above, what is the destination address of the instruction below and the value that would be stored at that destination?
incq 8(%rax)
Select one:
a. destination address: 0x108, value: 0x18
b. destination address: 0x108, value: 0x04
c. destination address: 0x108, value: 0x12
d. destination address: 0x110, value: 0x0D
e. destination address: 0x100, value: 0x10
Question 9
Not yet answered
Points out of 1.00
Flag question
Question text
Using the values in memory and registers above, what is the destination address of the instruction below and the value that would be stored at that destination?
imulq $2, (%rax, %rdx, 8)
Select one:
a. destination address: 0x100, value: 0x03
b. destination address: 0x100, value: 0x10
c. destination address: 0x110, value: 0xD0
d. destination address: 0x110, value: 0x18
e. destination address: 0x108, value: 0x04
Question 10
Not yet answered
Points out of 1.00
Flag question
Question text
The code below was generated by the compiler of a C function named foo with the following prototype:
long foo(long a, long b);
The b parameter is in register %rdi and the a parameter is in register %rsi. The return value is placed in %rax.
_foo:
shlq $2, %rdi
addq %rdi, %rsi
movq %rsi, %rax
retq
What is returned if the function is called like this: foo(1, 2)
Give your answer in decimal.
Answer:
Question 11
Not yet answered
Points out of 1.00
Flag question
Question text
The code below was generated by the compiler of a C function named foo with the following prototype:
long foo(long a, long b);
The b parameter is in register %rdi and the a parameter is in register %rsi. The return value is placed in %rax.
_foo:
shlq $2, %rdi
addq %rdi, %rsi
movq %rsi, %rax
retq
What is returned if the function is called like this: foo(2, 4)
Give your answer in decimal.
Answer:
Question 12
Not yet answered
Points out of 1.00
Flag question
Question text
The code below was generated by the compiler of a C function named foo with the following prototype:
long foo(long a, long b);
The b parameter is in register %rdi and the a parameter is in register %rsi. The return value is placed in %rax.
_foo:
shlq $2, %rdi
addq %rdi, %rsi
movq %rsi, %rax
retq
What is returned if the function is called like this: foo(4, 1)
Give your answer in decimal.
Answer:
Question 13
Not yet answered
Points out of 1.00
Flag question
Question text
The assembly code below was generated by a C compiler for a function with the following prototype:
long foo(long a, long b);
The register %rdi holds the parameter a and the register %rsi holds the parameter b. The result is returned in register %rax.
_foo:
movq %rdi, %rax
cqto
idivq %rsi
retq
What is returned if foo is called like this: foo(5, 3)
Give your answer in decimal.
Answer:
Question 14
Not yet answered
Points out of 1.00
Flag question
Question text
The assembly code below was generated by a C compiler for a function with the following prototype:
long foo(long a, long b);
The register %rdi holds the parameter a and the register %rsi holds the parameter b. The result is returned in register %rax.
_foo:
movq %rdi, %rax
cqto
idivq %rsi
retq
What is returned if foo is called like this: foo(2, 4)
Give your answer in decimal.
Answer:
Question 15
Not yet answered
Points out of 1.00
Flag question
Question text
The assembly code below was generated by a C compiler for a function with the following prototype:
long foo(long a, long b);
The register %rdi holds the parameter a and the register %rsi holds the parameter b. The result is returned in register %rax.
_foo:
movq %rdi, %rax
cqto
idivq %rsi
retq
What is returned if foo is called like this: foo(14, 2)
Give your answer in decimal.
Answer:
Address Value Register Value 0x100 0xAB %rax 0x108 0x108 0x10 %rdx 0x1 0x110 0x0C %rcx 0x2 0x118 0x02Explanation / Answer
Answer1: leaq 8(%rax), %rdx after execution b8 get stored in %rdx
Because this instruction means take the value in %rax ,add 8 into that and then store the value in %rdx
%rax=0xb0=176
0x8=8
176+8=184 and it will store in %rdx in hexa decimal=b8
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.