Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

16. Use the following data for the next question. All values are signed: .data v

ID: 3543071 • Letter: 1

Question

16. Use the following data for the next question.  All values are signed:

.data

val1 SDWORD ?

val2 SDWORD ?

Which selection is the correct implementation of the following pseudocode? (5 points)

if( val1 > val2 || val2 > eax )

  mov ebx,1;

else

  mov ebx,2;

a.

mov val1,ebx

     cmp ebx,val2

     jng L1    

     cmp val2,eax

     jg L1

     mov ebx,2

     jmp L2

L1:  mov ebx,1

L2:

b.

mov val1,ebx

     cmp ebx,val2

     jg L1

     cmp val2,eax

     jg L1

     mov ebx,2

     jmp L2

L1:  mov ebx,1

L2:

c.

mov val1,ebx

     cmp val2,ebx

     jg L1

     cmp val2,eax

     jg L2

     mov ebx,2

     jmp L2

L1:  mov ebx,1

L2:

d.             

mov val1,ebx

     cmp ebx,val2

     jle L1

     cmp val2,eax

     jle L1

     mov ebx,1

     jmp L2

L1:  mov ebx,2

L2:


17.  Which choice(s) contain correct implementations of the following pseudocode? Assume that all values are unsigned. (5 points)

if( eax > ebx )

     mov dl,5;

else

     mov dl,6;

a.

     cmp eax,ebx

     ja L1

     mov dl,6

     jmp L2

L1:  mov dl,5

L2:

b.

     cmp eax,ebx

     ja L1

     mov dl,5

     jmp L2

L1:  mov dl,6

L2:

c.

     cmp eax,ebx

     jbe L2

     mov dl,5

     jmp L2

L1:  mov dl,6

L2:

d.

     cmp eax,ebx

     jna L1

     mov dl,5

     jmp L2

L1:  mov dl,6

L2:

Explanation / Answer

16)b.

mov val1,ebx

cmp ebx,val2

jg L1

cmp val2,eax

jg L1

mov ebx,2

jmp L2

L1: mov ebx,1

L2:


17)d.

cmp eax,ebx

jna L1

mov dl,5

jmp L2

L1: mov dl,6

L2:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote