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

Example 1 .data var1 BYTE 10 var2 BYTE 20 var3 BYTE 30 .code mov esi,OFFSET var2

ID: 3643491 • Letter: E

Question

Example 1
.data
var1 BYTE 10
var2 BYTE 20
var3 BYTE 30
.code
mov esi,OFFSET var2
mov edi,OFFSET var1
cmpsb
ja L1
jb L2
je L3

5.To which label will the program jump in Example 1?
a. L1
b. L2
c. L3
d. cannot be determined from the information given

6.In Example 1, where will ESI point after the CMPSB instruction executes?
a. at var1
b. at var2
c. at var3
d. cannot be determined from the information given

7.If var1 and var2 were changed to type SWORD in Example 1, what change(s) would have to be made to the instructions in the code segment?
a. change CMPSB to CMPSW
b. change CMPSB to CMPSD
c. change JA to JG, and change JB to JL
d. none of the above
Example 2
1: .data
2: str1 BYTE "1324A2342424",0
3: .code
4: mov edi,OFFSET str1
5: mov al,'A'
6: cld
7: repne scasb
8: mov bl,[edi]

8.In Example 2, assume that str1 is located at offset 00040010h. What will be the value of EDI after line 7 executes?
a. 00040010h
b. 00040013h
c. 00040014h
d. 00040015h
9.In Example 2, if we change line 6 to "std", what value will be moved to BL after line 8 executes?
a. ASCII code of "4"
b. ASCII code of "A"
c. ASCII code of "2"
d. cannot be determined
10. In Example 2, if we change line 7 to "repe scasb", what value will be moved to BL after line 8 executes?
a. ASCII code of "3"
b. ASCII code of "A"
c. ASCII code of "2"
d. cannot be determined

11.Which letter choice contains instructions that will fill all elements of arrayW with FFFFh?
arrayW WORD 50 DUP(?)
a.
mov ax,0FFFFh
mov edi,OFFSET arrayW
mov ecx,SIZEOF arrayW
cld
rep stosb
b.
mov ax,0FFFFh
mov edi,OFFSET arrayW
mov ecx,LENGTHOF arrayW
cld
rep stosw
c.
mov ax,0FFFFh
mov esi,OFFSET arrayW
mov ecx,SIZEOF arrayW
std
rep stosw
d.
mov ax,0FFFFh
mov esi,OFFSET arrayW
mov ecx,LENGTHOF arrayW
cld
repz stosw


Example 3
1: .data
2: str1 BYTE "AAAX",0
3: str2 BYTE 10 DUP(0FFh)
4: .code
5: mov edi,0
6: L1: mov al,[str1+edi]
7: cmp al,0
8: je L2
9: mov [str2+edi],al
10: inc edi
11: jmp L1
12: L2:

After Example 3 executes, what value will be stored at offset [str2+4]?
a. 0FFh
b. ASCII code of "X"
c. 00h
d. cannot be determined

13. In Example 3, if we changed lines 7, 8, and 9 to the following, what value would be stored at offset [str2+4] after the loop finished?
7: mov [str2+edi],al
8: cmp al,0
9: je L2
a. 0FFh,
b. ASCII code of "X"
c. 00h
d. cannot be determined

Explanation / Answer

5.b 6.d 7.c 8.a 9.d 19.a 11.b 12.d

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