Part 1
Part 2
Part 3
Part 4
Part 5
100
The REPE prefix does the following:
What is : repeats an instruction while the Zero flag is set
100
This instruction causes the ESI and EDI registers to be incremented by the MOVSB instruction
What is : CLD
100
The MOVSB instruction uses this register as the source operand
What is : ESI
100
In this example the program will jump to this label ::::.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
What is : L1
200
In this example ESI point at this variable after the CMPSB instruction executes::::.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
What is : at var2
200
If var1 and var2 were changed to type SWORD in the following code, then this change(s) would have to be made to the instructions in the code segment: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: .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
What is : change CMPSB to CMPSW and change JA to JG, and change JB to JL
200
In this example, assume that str1 is located at offset 00040010h. What will be the value of EDI after line 7 executes?:::::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]****
What is : 00040015h
200
This country produces the greatest volume of beer per year
What is : United States
200
In this xample , if we change line 6 to "std", what value will be moved to BL after line 8 executes?::::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]****
What is : cannot be determined
300
This airline company is named after a Greek letter
What is : Delta
300
This many red stripes are on the U.S. flag
What is : 7
300
In this Example, if we change line 7 to "repe scasb", what value will be moved to BL after line 8 executes?::::::::: 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]****
What is : ASCII code of "3"
300
This block of code will fill all elements of arrayW with FFFFh:::: arrayW WORD 50 DUP(?)
What is : ::::mov ax,0FFFFh**** mov esi,OFFSET arrayW**** mov ecx,SIZEOF arrayW**** std**** rep stosw
300
7. Write a sequence of instructions using LODSB and STOSB that copy each character from arrayA to arrayB, converting it to lowercase in the process. Note: setting bit 5 in an uppercase character will convert it to lowercase:::: arrayA BYTE "ABCDEFGHI"**** arrayB BYTE LENGTHOF arrayA DUP(0)
What is : ; (first 4 statements may be in any order)**** mov ecx, LENGHTOF arrayA**** mov esi, OFFSET arrayA**** mov edi, OFFSET arrayB**** cld******** L1 : LODSB**** or al, 0010 0000**** stosb**** LOOP L1
400
Assume that pString is a doubleword that contains the offset of a string. This code will will set EAX to the length of the string? (The length should not count the string's null byte.)
What is : mov edi,pString*** mov eax,0**** L1: cmp BYTE PTR [edi],0**** je L2**** inc edi**** inc eax**** jmp L1**** L2:
400
Write a sequence of instructions that use STOSD to fill each position of arrayD with the largest possible 32-bit positive integer: arrayD SDWORD 20 DUP(?)
What is : ; ( first 4 statements may be in any order)*** mov eax, 7FFFFFFFh**** mov edi, OFFSET arrayD**** mov ecx, LLENGHTOF arrayD**** cld**** rep stosd
400
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 implmentation::::: .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**** WRITE THE REMINING INSTRUCTIONS:::::
What is : 7: cmp al,'z' ***** 8: ja L2***** 9: and BYTE PTR [esi],11011111b***** 10: L2: inc esi***** 11: jmp L1***** 12: L3: ret*****
400
Which is greater - The pressure in an automobile tire, or the pressure in a bottle of champagne?
What is : Champagne is about 3 times as much pressure as in a tire
400
6. Write a sequence of instructions using CMPSD that compare arrayA to arrayB in reverse order. After the comparison, move the first pair of non-matching array values to EAX and EBX.::::: COUNT = 5**** arrayA DWORD COUNT DUP(?)**** arrayB DWORD COUNT DUP(?)****
What is : ; ( first 4 statements may be in any order )**** mov esi, arrayA + count - 4**** mov edi, arrayB + count - 4**** mov ecx, count**** std**** repe cmpsd**** ; (next 2 assignments may be in any order)**** mov eax, [esi+4] ; from arrayA ***** mov ebx, [edi +4] ; from arrayB
500
21. Given the following declaration of a two-dimensional array,write a code to calculate the sum of theelements in column 0:::::: .data ROWSIZE = 5 NUMROWS = 4 twArray WORD NUMROWS DUP( ROWSIZE DUP(?) )
What is : 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
500
Cinderella, Rapunzel and Hansel and Gretel are a few of the fairy tales written by 19th century German brothers, Jacob and Wilhelm, whose last name was what?
What is : Brothers Grimm
500
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 the code executes, what value will be stored at offset [str2+4]?
What is : 0FFh
500
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:****** 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
What is : 00h
500
Write a sequence of instructions that use SCASD to search arrayD for the first value that is not the same as the current contents of EAX. When the search is completed, move the value you have found into EAX:::: arrayD SDWORD 50 DUP(?)
What is : ; ( first 3 statements may be in any order)**** mov edi, OFFSET arrayD**** mov ecx, LENGHTOF arrayD**** cld*** repz scasd**** mov eax, [edi-4]
M
e
n
u