Part 1
Part 2
Part 3
Part 4
Part 5
100
T/F A WHILE loop can be constructed with a CMP instruction at the bottom of the loop, followed by a conditional jump instruction.
What is : FALSE
100
This is the content of AL after the following instructions execute :::: mov al,11001111b***** and al,00101011b
What is : 00001011
100
This is the content of AL after the following instructions execute :::: mov al,00111100b**** or al,82h
What is : 10111110
100
This is the content of AL after the following instructions execute ::::mov al,94h xor al,37h
What is : 10100011
100
The contents of CF, SF, and ZF after these instructions are executed ::: mov al,5 cmp al,7
What is : 1 1 0
200
This is the equivalent Assembly Language code of the following C++ code. Assume that integers are unsigned. NO .IF directive allowed: if( eax > ebx ) mov dl,5; ******* else mov dl,6;
What is : cmp eax, ebx***jna L1****mov DL, 5****jmp L2****L1: mov dl,6
200
These are the values of CF, ZF, and SZF after the following instructions are executed : ::: mov al,00110011b**** test al,2
What is : CF = 0, ZF = 0, SF = 0
200
This instruction cause a jump to label L4 if bits 1, 2, and 3 are all set in the DL register?
What is :and dl,0Eh**** cmp dl,0Eh**** je L4****
200
This is the correct implementation of the following pseudocode:::if( val1 > val2 || val2 > eax )**** mov ebx,1;**** else**** mov ebx,2;
What is : mov val1,ebx**** cmp ebx,val2**** jg L1**** cmp val2,eax**** jg L1**** mov ebx,2**** jmp L2**** L1: mov ebx,1**** L2:
200
This is the correct implementation of the following pseudocode::::while( int2 >= int1 )**** {**** add ebx,2**** if( ebx > int2)**** mov ebx,0**** else**** mov ebx,int1**** }
What is ::: top:**** mov eax,int2**** cmp eax,int1**** jl L3**** add ebx,2**** cmp ebx,int2**** jg L1**** mov ebx,int1**** jmp L2**** L1: mov ebx,0**** L2: jmp top**** L3:
300
Which one of these is not on the coast: Venice, San Diego, Reykjavik, Marrakesh, Helsinki, Lisbon
What is : Marrakesh ( Morocco )
300
This code converts the string mystring to lower case
What is : mov ecx, LENGTHOF mystring**** mov esi, OFFSET mystring**** L1: or BYTE PTR [esi], 20h ; set bit 5**** inc esi**** loop L1****
300
This loop uses the XOR instruction to transform every character in a string called buffer into a new value ( produce a cipher text)
What is ::: KEY = 239 ; Can be any byte value**** BUFMAX = 128**** .DATA**** buffer BYTE BUFMAX+1 DUP(0)**** bufSize DWORD BUFMAX**** .CODE **** mov ecx, bufSize ; loop counter**** mov esi, 0 ; index 0 in buffer**** L1:**** xor buffer[esi], KEY ; translate a byte**** inc esi ; point to next byte**** loop L1****
300
This single instruction uses 16 bit operand that clear the high 8 bits of AX and does not change the low 8 bits
What is : AND ax, 00FFh
300
This code computes the Max of unsigned EAX and EBX
What is :::mov Max, eax ; assume Max = eax**** cmp Max, ebx**** jae done**** mov Max, ebx ; Max = ebx**** done:
400
Which is the financial centre and main city of Switzerland?
What is : Zurich
400
A code for a procedure that receives a character in AL. Sets the Zero flag if the character is a decimal digit.
What is ::::IsDigit PROC**** cmp al,'0' ; ZF = 0**** jb ID1**** cmp al,'9' ; ZF = 0**** ja ID1**** test ax,0 ; ZF = 1**** ID1: ret**** IsDigit ENDP
400
This code clears bits 0 and 1 in AL. Then , if the destination operand is equal to 0, the code should jump to label L3, otherwise, it will jump to label L4
What is ::: and al, 11111100 ****jz L3****jmp L
400
A case table that can call these prosedures if the user selects : a,b,c,d,e,f :::afoo, bfoo, cfoo, dfoo, efoo, ffoo. It must calculate table entry size and how many entries are there in the table.
What is :::CaseTable BYTE 'a'**** DWORD afoo**** EntrySize = ($ - CaseTable)**** BYTE 'b'**** DWORD bfoo**** BYTE 'c'**** DWORD cfoo**** BYTE 'd' **** DWORD dfooo BYTE 'e'**** DWORD efoo**** BYTE 'f' **** DWORD ffooo NumberOfEntries = ($ - CaseTable) / EntrySize
400
How many daughters did Charles Ingalls have in Little House on the Prairie?
What is :3
500
The following pseudo code in assembly language::: if(val1 >ecx) AND (ecx >edx ) then X = 1**** else X = 2;
What is ::: cmp val1, ecx****jna L1**** cmp ecx, edx****jna L1****mov x, 1**** jmp next****L1: mov X, 2****next
500
The following code in assembly Language:::if (var1 <= var2) **** {**** var3 = 10;**** }**** else**** {**** var3 = 6;**** var4 = 7;**** }
What is ::::mov eax,var1**** cmp eax,var2**** jle ifpart**** mov var3,6**** mov var4,7**** jmp next**** ifpart:**** mov var3,10**** next:
500
This code is functionally equivalent to example 6.5.3 but has fewer instructions
What is :::.DATA***sum DWORD 0***sample DWORD 50*** array DWORD 10, 60, 20, 33, 72, 89, 45, 65, 72,18****arraySize = ($ - array) / TYPE array****.CODE *** mov EAX, 0****mov EBX, sample***mov ESI, 0 **** MOV ECX, arraySize****L1: CMP ESI,ECX***JNL L5****cmp array[ESI*4], EDX****JNG L4**** add EAX, array[ESI*4]****L4 : inc ESI**** jmp L1****L5 : mov sum, EAX
500
In assembly language ::: if(ebx >ecx AND ebx >edx> OR (edx >eax) then X = 1 **** else X = 2
What is ::::cmp ebx, ecx**** jna L1**** cmp ebx, edx**** jna L1**** jmp L2**** L1: cmp edx, eax**** jna L3**** L2: mov X, 1**** jmp next **** L3: mov x, 2 **** next:
500
The following code in assembly language ::: if(ebx > ecx ) OR (EBX >val1 ) then x=1 **** else X = 2
What is ::::cmp ebx, ecx**** ja L1****cmp ebx, val1****ja L1****mov X, 2****jmp next****L1: mov X, 1****next:
M
e
n
u