Summary

The document contains a collection of questions related to X86 assembly language instructions and concepts. These questions cover different aspects of assembly language, including converting decimal numbers to hexadecimal, performing arithmetic operations, memory addressing, and register operations. The questions also involve analyzing assembly code and deciphering instructions.

Full Transcript

## **Question 1** 2/2 points Consider the following X86 assembly instruction: mul BX What is the other operand (that does not appear in the instruction)? - AX - DX - EBX - BX - ECX - EDX - CX - EAX ## **Question 2** 2/2 points Fill in the gaps as directed, DO NOT use any space 1. Conv...

## **Question 1** 2/2 points Consider the following X86 assembly instruction: mul BX What is the other operand (that does not appear in the instruction)? - AX - DX - EBX - BX - ECX - EDX - CX - EAX ## **Question 2** 2/2 points Fill in the gaps as directed, DO NOT use any space 1. Convert decimal number 20231011 to Double word size hexadecimal: 0134B363 2. Write the above hexadecimal number in little endian form: 63B33401 ## **Question 3** 2/2 points Answer the following as directed. Use only UPPERCASE letters and numbers in your answers and NO SPACE. If you add DWORD size hex numbers (D1E14563 + 12A071B2), the result (in DWORD size hex) is: E481B715 and if you subtract BYTE size binary number (01110011 - 1100100) the result (in BYTE size binary) is: 00001111 ## **Question 4** 6/6 points Review the following snippet from an assembly code listing file and answer the questions. (Line numbers are not part of the code). ``` 000001A7 C7 05 00000000 R 121 mov n1, 50 00000032 122 00000181 BA FFFFFFEC 123 mov edx, -20 29 15 00000000 R 124 sub n1, edx 000001BC FF OD 00000000 R 125 dec n1 000001C2 B8 00000000 126 mov eax, 0 ``` 1. What is the byte-length of the instruction with largest size object code (i.e. maximum byte-length)? 10 2. Indicate the missing address of the instruction at line 124: 000001B6 3. What does 'R' stand for in the above listing file (Line: 121, 124 and: Rellocatable 4. What will be the value in n1 (in decimal) after the execution of the above instructions? 69 ## **Question 5** 4/4 points Assume that 'x' implies the value in the EAX register and 'y' implies the value in the EBX register. Write just the assembly instructions that will implement the following pseudocode. ``` IF ( x <= 0 ) then x = -1*x ELSE y = 2*y ``` ```assembly L1: mov eax, 0 cmp x, eax jl L2 mov eax, -1 mul x mov x, eax ret L2: mov ebx, 2 mul y mov y, ebx ret ``` ## **Question 6** 0/6 points For each of the given object code, corresponding assembly statement is provided partially. Fill in the blanks to complete the assembly statements. NOTE: Answer MUST be in UPPERCASE and MUST NOT contain any BLANK/SPACE | Object Code | Assembly Statement | |---|---| | 8B CA | MOV ECX,EDX | | F7 E2 | MUL EDX | ## **Question 7** 2/2 points Match the registers with the instructions (that update the corresponding registers). In case of any ambiguity match based on the appropriateness. | Register | Instruction | |---|---| | EAX | cbw | | EIP | Any assembly Instruction | | ECX | loop | | EFLAGS | cmp | ## **Question 8** 2/2 points Object code of any valid instruction has at least this many hexadecimal digits: - 0 - 4 - 6 - 8 - **2** ## **Question 9** 2/4 points Write the object code(i.e. encoded machine instruction) for each of the following assembly statements. Answer in UPPERCASE Hexadecimal ONLY and DO NOT include any space or any non-hex character in your answer. - MOV CX, 205: 66B900CD - INC EDX: 42 ## **Question 10** 0/2 points Write the string that corresponds to the following ASCII sequence. Note that the ASCII characters are enclosed within quotes (that are not part of the string) and separated by blanks for your readability but DO NOT put any space in your answer. ASCII Sequence: 70 114 101 115 110 111 45 50 48 50 50 and corresponding character string is: "Fresno-2022" ## **Question 11** 0/2 points If the object code for a jump instruction is: E9 B102A134 Indicate which of the following is/are true. - Backward jump - Relative Near Jump - Relative Short Jump - Forward Jump - Register Indirect Jump - Memory Indirect Jump ## **Question 12** 0/2 points What will be the correct representation of 206 (decimal) in base-4 number system? Answer(digits only and NO SPACE): 3032 ## **Question 13** 0/2 points array1 DWORD 25, 47, 15, 50, 32, -30, 38 How many bytes will be allocated for the above declaration? Answer(in decimal): 28 ## **Question 14** 0/6 points Review the following assembly code snippet (Ref:Q13) and answer the questions. (Line numbers are not part of the code). ``` 14 .DATA 15 n1 DWORD ? 16 n2 WORD ? 88 mov n1, 0 89 mov ebx, 100 90 mov n2, bx ``` 1. What type of operand addressing mode is NOT observed in the above code snippet? Memory: Register Indirect 2. Indicate the line number of the statement that will generate an opcode prefix: 90 and what opcode prefix will be generated? 90 3. What will be the value of n2 (in hexadecimal, as displayed in the memory window of the debugger) after the execution of all of the above instruction 66, 66, 66, 66, 66 4. What will be the value of n1 (in hexadecimal, as displayed in the memory window of the debugger) after the execution of all of the above instruction 6400, 64 00 ## **Question 15** 0/2 points What will be the effect of the following statement? mov 26, ECX - ECX register will have its value incremented by decimal 26 - ECX register will have hex 26 - None of the mentioned - ECX register will have decimal 26 Correct Answer: None of the mentioned ## **Question 16** 0/4 points Assume that 'x' implies the value in the EAX register and 'y' implies the value in the EBX register. Write just the assembly instructions that will calculate the value of the following expression and store the result in the EAX register. 9 - y - 2x ## **Question 1** 1/1 point In case of a binary addition, if you have a carry out from the most significant bit position, it always indicates that there is an over flow. - True - **False** ## **Question 2** 1/1 point Look up the hexadecimal ASCII value for the following characters. Use UPPERCASE for letters. DO NOT include any space in your answers. - ASCII of 'k' is: 6B - ASCII of '%' is: 25 ## **Question 3** 1/1 point If a 16 bit storage contains the following (in hexadecimal) : A7D4 The binary representation of the value in the above storage will be (All 16 bits, DO NOT include any space at all): 1010011111010100 ## **Question 4** 1/1 point How many words are there in a quadword? - 16 - 8 - **4** - 64 - 2 - 32 ## **Question 5** 1/1 point If you apply 2's complement transformation on the following hexadecimal number: 9AF7 The result will be(4 Hexadecimal digits ONLY, use UPPERCASE for letters, DO NOT include any space at all): 6509 ## **Question 6** 1/1 point If a byte sized storage contains the lowest possible signed value (that can be stored there). Write the above value in decimal representation (do not include any space): -128 ## **Question 7** 1/1 point Below are a list of word size hexadecimal numbers that represent a set of signed numbers(can be positive or negative). If '2's complement' representation is followed for all negative numbers, mark all the numbers below that are negative. - 5FF1 - **D004** - **8001** - 7FA8 ## **Question 8** /1 point Write the following hex number in little endian form. Use UPPERCASE for letters. DO NOT put any white space in your answer. 90CD8A9C Answer: 9C8ACD90 ## **Question 9** 0/1 point If you sign extend '6D10' (hexadecimal value, stored in a word) to make it suitable for storing in a doubleword, the sign extended value in hexadecimal form will be ffff92f0(Use UPPERCASE for letters. DO NOT include any white space in your answer) ## **Question 10** 0/1 point Order the following from highest (close to the user) to lowest(close to the hardware) Highest: Application Lowest: Hardware ## **Question 1** 1/1 point Match each of the registers on the left side to its corresponding size(in bits) on the right side. | Register | Size | |---|---| | R15D | 32 | | BH | 8 | | FLAGS | 16 | | RIP | 64 | ## **Question 2** 1/1 point Which of the following will not generate executable/object code? (select all that are correct) - **Text Editor** - Compiler - Assembler - **Debugger** ## **Question 3** 1/1 point Review the list below and mark the items that are not valid segment registers in a X86 CPU. - DS - GS - **BS** - FS - **AS** - **HS** - CS - ES - **IS** ## **Question 4** 1/1 point If the value in EDX register is 805FD1C6, what is the value in DL? Answer (in hexadecimal) with NO space: C6 ## **Question 5** 1/1 point Review the list below and mark the items that are not valid registers in a 64-bit X86 CPU. - **RSX** - R12 - RSI - RFLAGS - RSP - **R16** - RIP - **RPC** - R10 - **RBI** ## **Question 6** 0/1 point What are addresses of the two midean bytes in the 32-bit address space(memory)? Provide full 32-bit address in Hexadecimal with No Space 1: 7FFFFFFF 2: 7fffffff ## **Question 7** 1/1 point Link the items on the left side to its closest matching items on the right side. | Item | Matching Item | |---|---| | Segmented Memory Model | Offset | | Assembler | Object Code | | ALU | Arithmetic Calculation | | Clock | MHz | ## **Question 8** 1/1 point Indicate which one of the following is not a part of the CPU - ALU - Clock - **Main Memory** - Register - Control unit ## **Question 9** 1/1 point How many registers are there in a 64-bit system for general use? - 64 - 8 - 32 - 48 - **16** ## **Question 10** 0/1 point Which register is used in the 32-bit system to hold the address of the next instruction to execute? Answer (with no space): EIP ## **Question 1** 1/1 point Indicate all operand addressing modes in the list below that apply to the following assembly instruction. mov WORD PTR [ESI], 02C4h - **Register indirect memory reference mode** - **Immediate mode** - Direct memory reference mode - Register mode ## **Question 2** 1/1 point Is this statement valid for a 32-bit assembly program? mov DX, -2024 - No - **Yes** ## **Question 3** 0.5/1 point For each of the data declaration statements below, write the corresponding number of bytes (that will be allocated) in the space provided next to the declaration. (Write just the numeric answer with NO space and DO NOT specify unit) - a) num4 DWORD "ABCZ": 4 - b) myVar2 QWORD -105, 20, -29: 24 ## **Question 4** 1/1 point Indicate which of the following directives are not needed for a 64-bit assembly program - .DATA - .CODE - **.STACK 2024; <or any number>** - **.MODEL FLAT** ## **Question 5** 1/1 point Indicate whether the following statements are true or false. - a) You can define a macro with more than 4 parameters: **true** - b) you can not have comments within the macro definition: **false** ## **Question 6** 1/1 point Link each of the symbols on the left side to its matching purpose on the right side. | Symbol | Purpose | |---|---| | . | Directive | | : | Label | | , | Parameters | | ; | Comment | ## **Question 7** 1/1 point Indicate what does the following correspond to in the code/framework that you have downloaded for this course? atod - Directive - Data Declaration - **Macro** - Instruction ## **Question 8** 1/1 point Review the following data declaration where the type is purposely masked with XXXXXX. Select all of the possible data types that apply to the statement (i.e. will make it a valid data declaration) from the list below. value XXXXXX 246 - **BYTE** - **QWORD** - **WORD** - **DWORD** ## **Question 9** 0/1 point What will be value (in hexadecimal, in exact number of digits) used for the following declaration (as found in the listing file)? num WORD -1 Answer(just the hexadecimal digits, with NO prefix or Suffix): FFFF, ffff ## **Question 10** 1/1 point Link the data declarations Suffix notations on the left side to its matching Number Systems on the right side. | Suffix Notation | Number System | |---|---| | O | Octal | | H | Hexadecimal | | None/Nothing | Decimal | | B | Binary | ## **Question 1** 1/1 point Following are a set of generated object code taken from a listing file. Match each of them with its correct classification. | Object Code | Classification | |---|---| | 8B 15 00000000 R | Instruction contains a direct memory reference | | 48/F7 EO | Instruction contains a 64-bit operand | | C3 | Object code consists of one byte only | | 66|03 C2 | Instruction contains a word size operand | ## **Question 2** 0/1 point If the value in AX is 258 (Decimal), what will be its value after executing the following instruction: (Answer either in hex or decimal) CBW AX will contain: 0102 ## **Question 3** 0/1 point How many total bytes of object code is generated in the following snippet (taken from a listing file)? ``` 66 FF C3 FE CO C3 OA 48/ 8B D1 FF C8 ``` Answer: 11 ## **Question 4** 0.5/1 point Indicate the setting of Carry Flag(CF/CY)) and Overflow Flag (OF) after the following code executes: MOV AL, 24 ADD AL, 110 CF(/CY): 1 OF(/OV): 1 ## **Question 5** 0/1 point What will be the value in AX (in hexadecimal) after you execute the following instructions. MOV AL, -5 IMUL AL AX will contain (in hexadecimal): FFFD ## **Question 6** 0/1 point What will be the content (in hexadecimal) in BL after the following code executes: mov BL, OFFh inc BL BL: 00 ## **Question 7** 0/1 point If the MOD R/M byte of an object code is 15, Identify which of the following register is used in the above instruction? - **EBX** - ECX - EDX - EAX ## **Question 8** 1/1 point If an assembly instruction looks like: mov ECX, ......... and corresponding object code looks like : 8B OD ......... Does the second operand refer to a memory location? - **True** - False ## **Question 9** 0/1 point If the current values in AL and BL registers are -1 and -2 (both in decimal) respectively, which of the following condition sets will be true after the following instruction is executed SUB AL, BL - Sign Flag = 1 and Zero Flag = 1 - **Sign Flag = 0 and Zero Flag = 1** - None of the mentioned - Sign Flag = 1 and Zero Flag = 0 - Sign Flag = 0 and Zero Flag = 0 ## **Question 10** 0/1 point The following is a line from a listing file that corresponds to an arithmetic instruction and the mnemonic is purposely removed. Select the correct mnemonic from the given options. F7 DB - **NEG** - ebx ## **Question 1** 1/1 point How many(maximum) parameters can be passed to a 64-bit procedure via registers? Answer(numeric, no space): 4 ## **Question 2** 1/1 point Which of the following register can not be changed freely by a called procedure in a 64-bit program? - RAX - RDX - RCX - **RBX** ## **Question 3** 0/1 point Right after a procedure (that accepts parameters) is called and before any line of code in the procedure is executed, if the value in ESP is 0x00200A6C, what is the address where the 1st argument can be found in memory? Answer in hex, DO NOT include any space and Ox prefix: 00200A70 ## **Question 4** 1/1 point What will the value (in hex) be in EAX after the following code block runs? ```assembly mov EAX, -1 push EAX mov RAX,0 pop AX ``` Answer 0000FFFF ## **Question 5** 0/1 point If the Current value in ESP is: 00600B02 and the following instruction executes pop EBP Which of the following will be the new value of ESP? - 00600B04 - 00600B06 - 00600B00 - 00600AFA - **00600AFE** ## **Question 6** 0/1 point Can you have two ret instructions with the same procedure body? Answer: Yes ## **Question 7** 0/1 point Which of the following register is not necessarily relevant to the "ret" instruction? - EIP - EBX - **ESP** - EAX ## **Question 8** 1/1 point Which of the following directives is used to avoid duplicate label generation during macro expansion? - NOLIST - **LOCAL** - NOLISTMACRO - LIST ## **Question 9** 1/1 point Below are some keywords that are used in assembly programs. Match each with with its appropriate pair. | Keyword | Pair | |---|---| | call | ret | | macro | endm | | proc | endp | | push | pop | ## **Question 10** 1/1 point Which of the following statements is true? - A procedure can't be called from a macro and a procedure can't contain a macro call. - **A procedure can be called from a macro and a procedure can contain a macro call.** - A procedure can't be called from a macro but a procedure can contain a macro call. - A procedure can be called from a macro but a procedure can't contain a macro call. ## **Question 1** 1/1 point If AX contains hexadecimal 90B5, what will be the value (in binary) in AX after the following instruction? rol AX, 12 Answer (in hexadecimal): 590B ## **Question 2** 0/1 point Which of the following is always true when AX contains a negative number (in 2's complement form) and the following instruction is executed: rol AX, 9 - AX will contain a negative number - AX will contain an odd number - AX will contain an even number - **AX will contain a positive number** ## **Question 3** 0/1 point Assume that x is a decimal number. what will be the value of x when both the following instructions (run independently) will leave the same result in AL a) rcl AL, x b) rcr AL, x Value of x (in decimal) is: 8 ## **Question 4** 0/1 point If AL contains 10100101, what will be the value (in binary) in AL after the following instruction? shl EAX, 2 Answer (in binary): 01001010 ## **Question 5** 1/1 point What will be the value AL after the following code is executed (note that AL may contain a random value before the code runs). mov BL, AL not BL add BL, AL AL will contain (in hexadecimal): 00 ## **Question 6** 1/1 point If AX contains hexadecimal 80F0, what will be the value (in binary) in AX after the following instruction? sar AX, 8 Answer (in hexadecimal): 80 ## **Question 7** 1/1 point Is bitwise NOT operation same as 2's complement operation? - True - **False** ## **Question 8** 1/1 point Fill in the blank in the following instruction so that it is equivalent to the following pseudocode. EDX = EDX * 64 shl EDX, 6 ## **Question 9** 1/1 point Write the answer (all bits, no space in your answer) 10100100 XOR 10010001 = 00110101 ## **Question 10** 1/1 point Which register(s) will be updated by the following instruction test EDX, 150 - EDX - **EFLAGS** - ECX - EBX - EAX ## **Question 1** 2/2 points Which of the following registers are used by the instruction (indicate ALL that are applicable) : repe cmpsb - **ESI** - **EFLAGS** - ESP - **ECX** - EDX - **EDI** - EBX - EAX ## **Question 2** 0/2 points Match the instructions on the left side with matching description/characteristics on the right side. | Instruction | Description | |---|---| | stosb | Uses both ESI and EDI | | cmpsb | Uses both ESI and EDI | | std | Uses neither ESI nor EDI | | lodsb | Uses ESI but not EDI | ## **Question 3** 1/2 points 1) It does not make any sense to use a repeat prefix with lods.. Instruction. True/False? **False** 2) A repeat prefix, just by itself can be used as an instruction in an assembly program. True/False? **False** ## **Question 4** 1/2 points You are given a challenge to write a 32-bit program to copy 200 bytes from one memory location to another. If you use a loop(LOOP instruction). 1) which variant of mov instruction will you use to minimize the number of invocations of the mov instruction? **movsd** 2) how many times will you need to iterate (in the loop) to complete the copy task. **200** ## **Question 5** 2/2 points What general purpose registers are used character translation instruction (xlat) - ESP - ECX - EBP - **EAX** - EDX - EDI - **EBX** - ESI

Use Quizgecko on...
Browser
Browser