You, as an individual, are expected to do your own work. This means you cannot seek, receive or otherwise acquire any assistance except clarifications from the professor during an examination. Any communication involving the contents of the subject matter or the examination is considered cheating. Do not initiate or accept such communication, or the result of your examination is automatically voided.
Each correct answer is worth one point, each wrong answer is worth zero point, and each unanswered question is also worth zero point. This means you should guess and leave no question unanswered.
Make sure you write down you name on the upper right corner first, otherwise I cannot give points to anonymous students!
movl $0xff, (%eax)
movl $0xff, eax
movl $0xff, 6324523
movb $0xff, (,%eax)
movb $0x80,%al subb $____,%al
Select a value for ____ such at the carry (C) flag is set after the
subb instruction executes.
0x00
0x10
0x7f
0x80
0xff
somevar:
0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08Assume that
%eax has the address of somevar. What is the
content of somevar after the following code executes?
movl (%eax),%ebx addl $1,%eax movl %ebx,(%eax)
0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08
0x01 0x01 0x03 0x04 0x05 0x06 0x07 0x08
0x01 0x01 0x02 0x03 0x04 0x05 0x06 0x07
0x01 0x01 0x02 0x03 0x04 0x06 0x07 0x08
0x01 0x02 0x03 0x04 0x01 0x02 0x03 0x04
label1 if and only if val1 is greater than
val2? Assume val1 and val2 are signed, and they
are properly allocated space. Select an answer that works in general.
movl val1,%eax cmpl val2,%eax jg label1
movl val1+4,%eax cmpl val2+4,%eax jg label1 jl label2 movl val1,%eax cmpl val2,%eax jg label1 label2:
movl val1,%eax cmpl val2,%eax jg label1 movl val1+4,%eax cmpl val2+4,%eax jg label1
movl val1,%eax cmpl val2+4,%eax jg label1 movl val1+4,%eax cmpl val2,%eax jg label1
movl val1,%eax cmpl val2+4,%eax jg label1 movl val1+4,%eax cmpl val2,%eax jg label1
var1 and var1_end are defined as follows:
.data var1: .org +20 var1_end = .The direction
.org +20 means increase the memory location counter
by 20 (bytes). var1_end is effectively defined to be the address of
the byte immediately following the 20 bytes allocated by the first line.
What does the following code do to the allocated memory locations?
movl $var1,%eax
L1:
cmpl $var1_end,%eax
jb L2
movb $0,(%eax)
addl $1,%eax
jmp L1
L2:
%eax always alternates between 0
and 1
var1 are as follows:
0x01 0x02 0x03 0x04 0x00 0x05 0x06 0x07 0x08 0x09'What is the value of
%ecx when the following code completes?
movl $10,%ecx
movl $var1,%eax
L1:
cmpb $0,(%eax)
jz L2
cmpl $0,%ecx
jz L2
addl $1,%eax
subl $1,%ecx
jmp L1
L2:
eax.
eax after the following
code completes?
movl $1, %eax addl %eax, %eax addl %eax, %eax
cmpl %eax, %ebx jna label1
movl $-1, %eax movl $-1,%ebx addl %eax,%ebx