6 Consider the following set of assembly instructions:
addl %ecx, %edx;
cmpl %ebx, %edx;
jge .L4
where %ecx stores the value C, %ebx the value B and %edx the value D. What C comparison is implemented by this assembly code?
Select one:

a. if (c + d >= b) then { … } else { .L4 }
b. if (c + d > b) then { … } else { .L4 }
c. if (c + d < b) then { … } else { .L4 }
d. None of these.

i think the answer id d.

2 Years
Discussion Span
Last Post by Schol-R-LEA

I think you are correct. The assembly code as written is doing basically this:

d += c;
if (d >= b) then goto .L4;

So, to quote Richard Pryor in Brewster's Millions, the answer is "Vote for None of the Above"... :-)


@rubberman: While your answer is strictly correct, I suspect that the professor who gave this question was being idiomatic (or perhaps merely idiotic) and not expecting the students to be quite so literal about it, in which case C) would be the expected (if subtly wrong) answer. Of course, it hardly matters now, since the quiz that the OP was trying to cheat on had been over before you answered the question, anyway.

Edited by Schol-R-LEA

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.