U8 quiz

Ace your homework & exams now with Quizwiz!

The REPE prefix does which of the following? Question 1 options: 1) repeats an instruction while the Zero flag is clear 2) repeats an instruction while the Zero flag is set 3) repeats an instruction while the Carry flag is clear 4) repeats an instruction while the Carry flag is set

2

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? 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: 7:mov [str2+edi],al 8:cmp al,0 9:je L2 Question 15 options: 1) 0FFh, 2) ASCII code of "X" 3) 00h 4) cannot be determined Irvine, Kip R. Assembly Language for Intel-Based Computers, 4th Edition7

3

In Example 2, assume that str1 is located at offset 00040010h. What will be the value of EDI after line 7 executes? 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] Question 7 options: 1) 00040010h 2) 00040013h 3) 00040014h 4) 00040015h

4

Which instruction causes the ESI and EDI registers to be incremented by the MOVSB instruction? Question 3 options: 1) CLC 2) REP 3) STD 4) CLD

4

After Example 3 executes, what value will be stored at offset [str2+4]? 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: Question 14 options: 1) 0FFh 2) ASCII code of "X" 3) 00h 4) cannot be determined

1

Assume that pString is a doubleword that contains the offset of a string. Which of the following letter choices contains code that will set EAX to the length of the string? (The length should not count the string's null byte.) Question 11 options: 1) mov edi,pString mov eax,0 L1:cmp BYTE PTR [edi],0 je L2 inc edi inc eax jmp L1 L2: 2) mov edi,pString mov eax,0 L1:cmp BYTE PTR [edi],0 jne L2 inc edi jmp L1 L2: 3) mov edi,pString mov eax,0 L1:cmp BYTE PTR [edi],0 jae L2 inc edi inc eax jne L1 L2: 4) mov edi,pString L1:cmp BYTE PTR [edi],0 ja L2 inc edi inc eax jnz L1 L2:

1

If a bubble sort requires 0.2 seconds to sort an array of 1,000 elements, how many seconds will it require to sort 10,000 elements? Hint: bubble sort is an O(n2) algorithm. Question 2 options: 1) 2 seconds 2) 20 seconds 3) 200 seconds 4) 4 seconds

1

In Example 2, if we change line 7 to "repe scasb", what value will be moved to BL after line 8 executes? 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] Question 9 options: 1) ASCII code of "3" 2) ASCII code of "A" 3) ASCII code of "2" 4) cannot be determined

1

The MOVSB instruction uses which register as the source operand? Question 4 options: 1) ESI 2) EDI 3) EAX 4) ECX

1

To which label will the program jump in Example 1? 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 Question 5 options: 1) L1 2) L2 3) L3 4) cannot be determined from the information given

1

In Example 1, where will ESI point after the CMPSB instruction executes? 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 .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

2

Suppose we want to convert the letters in myString to uppercase (by clearing bit 5 of each character). Lines 1 through 6 are the first part of the implementation: .data myString BYTE "abCDefg123hij",0 .code 1:mov esi,OFFSET myString 2: L1:mov al,[esi] 3:cmp al,0 4:je L3 5:cmp al,'a' 6:jb L2 Which letter choice contains the best alternative for the remaining instructions? 7:cmp al,'z' 8:ja L2 9:and BYTE PTR [esi],11011111b 10: L2:inc esi 11: jmp L1 12: L3:ret Question 12 options: 1) 7:cmp al,'z' 8:jbe L3 9:and BYTE PTR [esi],11011111b 10: L2:inc esi 11: jmp L1 12: L3:ret 2) 7:cmp al,'z' 8:jna L2 9:and BYTE PTR [esi],11011111b 10: L2:inc esi 11: jmp L1 12: L3:ret 3) 7:cmp al,'z' 8:ja L2 9:and BYTE PTR [esi],11011111b 10: L2:inc esi 11: jmp L1 12: L3:ret 4) 7:cmp al,'z' 8:ja L2 9:and BYTE PTR [esi],11011111b 10: L2:jnz L3 11:inc esi 12: jmp L1 13: L3:ret

3

Which letter choice contains instructions that will fill all elements of arrayW with FFFFh? arrayW WORD 50 DUP(?) Question 10 options: 1) mov ax,0FFFFh mov edi,OFFSET arrayW mov ecx,SIZEOF arrayW cld rep stosb 2) mov ax,0FFFFh mov edi,OFFSET arrayW mov ecx,LENGTHOF arrayW cld rep stosw 3) mov ax,0FFFFh mov esi,OFFSET arrayW mov ecx,SIZEOF arrayW std rep stosw 4) mov ax,0FFFFh mov esi,OFFSET arrayW mov ecx,LENGTHOF arrayW cld repz stosw

3

Given the following declaration of a two-dimensional array, which letter choice contains statements that correctly calculate the sum of column 0? .data ROWSIZE = 5 NUMROWS = 4 twArray WORD NUMROWS DUP( ROWSIZE DUP(?) ) Question 13 options: 1) mov esi,OFFSET twArray mov edi,0 mov ecx,NUMROWS mov ax,0 L1:add ax,twArray[esi+edi] add esi,ROWSIZE loop L1 2) mov esi,0 mov edi,OFFSET twArray mov ecx,NUMROWS mov ax,0 L1:add ax,twArray[esi+edi] add esi,ROWSIZE loop L1 3) mov esi,0 mov edi,0 mov ecx,NUMROWS + ROWSIZE mov ax,0 L1:add ax,twArray[esi+edi] add esi,ROWSIZE loop L1 4) mov esi,0 mov edi,0 mov ecx,NUMROWS mov ax,0 L1:add ax,twArray[esi+edi] add esi,(ROWSIZE * TYPE twArray) loop L1

4

In Example 2, if we change line 6 to "std", what value will be moved to BL after line 8 executes? 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]

4


Related study sets

Compensation Administration Chap 12 TNTech

View Set

All the things you need to review

View Set

Basic Insurance Concepts and Principles

View Set

Chapter 6:Values,Ethics,and Advocacy PrepU

View Set

GE 101 - CH 3 Physical Geography - Multiple Choice

View Set

how to say hi in Spanish and French and

View Set