CS271 Week 2

Ace your homework & exams now with Quizwiz!

Convert the following binary number into an unsigned decimal value. 1010 0000 0110 1001

41065.0

Convert the following binary number into an unsigned decimal value. 1101 0111 0011 0010

55090.0

Convert the following ASCII hex representation into its string. The hex 31 2B 7A is the string 1+z 53 74 61 74 65

State

After the following code has finished execution, ECX contains the initial contents of which register? mov edx, eax mov ebx, ecx mov ebx, edx mov ecx, ebx mov edx, eax

eax

Given the following MASM code using Irvine's library: mov eax,1 mov ebx,4 label6: mul ebx call WriteDec call CrLf inc ebx cmp eax,40 jbe label6 mov eax,ebx call WriteDec call CrLf Show the output produced by execution of the code.

4 20 120 7 7

Convert the following string into its ASCII hex representation. Don't use 0x or h with the hex values. The hex for "1+z" is 31 2B 7A Apple

41 70 70 6C 65

Convert the following string into its ASCII hex representation. Don't use 0x or h with the hex values. The hex for "1+z" is 31 2B 7A Visual

56 69 73 75 61 6C

Convert the following ASCII hex representation into its string. The hex 31 2B 7A is the string 1+z 4D 65 6D 6F 72 79

Memory

Convert the following ASCII hex representation into its string. The hex 31 2B 7A is the string 1+z 4D 69 63 72 6F 73 6F 66 74

Microsoft

Convert the following binary number into a signed decimal value. 1101 0010 0011 0111

-11721.0

Convert the following binary number into a signed decimal value. 1100 1000 0100 0001

-14271.0

Convert the following binary number into a signed decimal value. 1010 1111 0101 1010

-20646.0

The following data segment starts at memory address 0x2300 (hexadecimal) .data printString BYTE "MASM is fun",0 moreBytes BYTE 32 DUP(0) dateIssued DWORD ? dueDate DWORD ? elapsedTime WORD ? What is the hexadecimal address of dueDate?

0x2330

The following data segment starts at memory address 0x3000 (hexadecimal) .data printString BYTE "Assembly is fun",0 moreBytes BYTE 19 DUP(0) dateIssued DWORD ? dueDate DWORD ? elapsedTime WORD ? What is the hexadecimal address of dueDate?

0x3027

The following data segment starts at memory address 0x3600 (hexadecimal) .data printString BYTE "Do not add decimal to hex",0 someBytes WORD 19 DUP(0) moreBytes BYTE 10, 20, 30, 40, 50, 60, 70, 80, 90 questionAddr DWORD ? ignoreMe WORD ? What is the hexadecimal address of questionAddr?

0x3649

After the following MASM code is executed: mov eax,192 mov ebx,56 mov ecx,93 add eax,ebx sub eax,ecx 1)What is the value in the eax register (in decimal)? 2)What is the value in the ebx register (in decimal)? 3)What is the value in the ecx register (in decimal)?

1) 155 2) 56 3) 93

After the following MASM code is executed: mov eax,25 mov ebx,7 mov edx,0 div ebx 1) What is the value in the eax register (in decimal)? 2) What is the value in the ebx register (in decimal)? 3) What is the value in the edx register (in decimal)?

1) 3 2) 7 3) 4

After the following MASM code is executed: mov eax,37 mov ebx,23 mov ecx,11 add eax,ebx sub eax,ecx 1) What is the value in the eax register (in decimal)? 2) What is the value in the ebx register (in decimal)? 3) What is the value in the ecx register (in decimal)?

1) 49 2) 23 3) 11

After the following MASM code is executed: mov eax,123 mov ebx,13 mov edx,0 div ebx 1)What is the value in the eax register (in decimal)? 2)What is the value in the ebx register (in decimal)? 3)What is the value in the edx register (in decimal)?

1) 9 2) 13 3) 6

Place the 3 major steps of the Instruction Execution Cycls in the correct order.

1) fetch 2) decode 3) execute

Suppose that result is declared as DWORD, and the following MASM code is executed: mov eax,17 mov ebx,2 mov ecx,6 label5: add eax,ebx add ebx,2 loop label5 mov result,eax What is the value stored in the memory location named result?

59

Suppose that result is declared as DWORD, and the following MASM code is executed: mov eax,7 mov ebx,5 mov ecx,6 label5: add eax,ebx add ebx,2 loop label5 mov result,eax What is the value stored in the memory location named result?

67

Match the Instruction Execution steps to the correct order and description. Step 1: Step 2: Step 3: Step 4: Step 5: Step 6:

Step 1: The control unit fetches the next instruction from the instruction queue Step 2: The control unit increments the instruction pointer (IP, also known as instruction counter). Step 3: The control unit decodes the instruction's function to determine what the instruction will do. Step 4: If the instruction uses an input operand located in memory, the control unit uses a read operation to retrieve the operand and copy it into internal registers. Step 5: The ALU executes the instruction using the named registers and internal registers as operands Step 6: If the output operand is in memory, the control unit uses a write operation to store the data.

Select the pseudo-code that corresponds to the following assembly code. .data ; General purpose variables a DWORD ? b DWORD ? c BYTE ? d BYTE ? upperLevel DWORD 18 lowerLevel DWORD 3 ; Strings yes BYTE "Yes",0 no BYTE "No",0 maybe BYTE "Maybe",0 .code main PROC mov eax, 0 cmp eax, lowerLevel jne option1 jmp option2 option1: mov edx, OFFSET yes call WriteString jmp endOfProgram option2: mov edx, OFFSET no call WriteString jmp endOfProgram option3: mov edx, OFFSET maybe call WriteString endOfProgram: exit main ENDP END main

print (yes);


Related study sets

chapter 42 cardiovascular system

View Set

American Sign Language, ASL Unit 1 Quiz, ASL 1A Final Study, ASL midterm, ASL 1 Study Guide

View Set

NCLEX Gastrointestinal Medications

View Set

{{Richard}} English Midterm 𝙂𝙧𝙖𝙢𝙢𝙚𝙧 ***in order for this to actually help you: use the writing tool NOT multiple-choice tool**

View Set

Config & Setup (objectives 3 +4) Practice Exam

View Set