Assembly

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

What is the largest and smallest number that can be represented by a 16-bit SIGNED number?

-2^15 to 2^15 - 1 = -32,768 to 32,767 Smallest: -32,768 Largest: 32,767

What is the largest and smallest number that can be represented by a 8-bit SIGNED number?

-2^7 to (2^7 - 1) = -128 to 127 Smallest: -128 Largest: 127

What is the largest and smallest number that can be represented by a 8-bit UNSIGNED number?

0 to (2^max # bits - 1) = 0 to (2^8 - 1) = 0 to 255 Smallest: 0 Biggest: 255

What is the largest and smallest number that can be represented by a 32 bit UNSIGNED number?

0 to 2^32 - 1 = 0 to 4,294,967,295 Smallest: 0 Largest: 4,294,967,295

What will be printed out from the following code? .data list word 1, 2, 3, 4 .code main proc mov edx, offset list mov eax, [edx] call writeHex exit main endp end main

00 02 00 01

What is a cache hit?

1) Cache Memory: High-speed expensive static RAM both inside and outside the CPU 2) Cache hit: When data to be read is already in cache memory

What are the three basic steps in the instruction execution cycle?

1) Fetch instruction 2) Decode 3) Execute

How many hex digits are there in a byte?

2

Use the following data : word1 WORD 1000h,2000h,3000h,4000h,5000h dword1 DWORD 10000h,20000h,30000h,40000h What is the final value of AX after this code has executed? mov edx,OFFSET word1 + 8 mov ecx,2 mov ax,0 L1: mov ax,[edx] add ax,20h sub edx,4 Loop L1

3020h

Use the following data: dword1 DWORD 10000h,20000h,30000h,40000h Suppose we want EAX to contain the sum of the dword1 array when the following (incomplete) code finishes executing: 1: mov edi,OFFSET dword1 2: mov ecx,LENGTHOF dword1 3: ? 4: ? 5: ? 6: loop L1 Which of the following choices would best fill in lines 3, 4, and 5?

3: mov eax, 0 4: L1: add eax, [edi] 5: add edi, TYPE dword1

Use the following data: arr word 10h,20h,30h,40h Suppose we want al to contain the sum of the array when the following (incomplete) code finishes executing: 1: mov edi,OFFSET arr 2: mov ecx,LENGTHOF arr 3: ? 4: ? 5: ? 6: loop L1

3: sub eax, eax 4: L1: add ax, [edi] 5: add edi, TYPE arr

The hexadecimal value for the binary byte: 1000 1010, if it is unsigned Data.

8A

The central processor unit is connected to the rest of the computer system using what three buses?

Address bus: sends out the address Control bus: send control signals Data bus: sends data

choose the right answer: You declared the following array in your data segment. byte1 BYTE 0BCh,1, 10b when you open the memory window, this is what you will see:

BC 01 02

Name at least four CPU status flags.

CF (Carry Flag) OF (Overflow Flag) SF (Sign Flag) ZF (Zero Flag)

The central processor unit (CPU) contains registers and what other basic elements?

Clock: synchronizes CPY operations Control Unit (CU): coordinates sequence of execution steps ALU: performs arithmetics and bitwise processing Registers: store data during CPU operations

Name all eight 32-bit general-purpose registers

EAX EBX ECX EDX EBP ESP ESI EDI

You are given a before condition of the registers eax, ebx, edx and an instruction. Choose the correct after condition of eax, edx Before condition: EAX: 00 00 00 1B EBX: 00 00 00 0D EDX 00 00 00 00 Instruction: div ebx After condition:

EAX: 00 00 00 02 EDX: 00 00 00 01

You are given a before condition of the registers eax, ebx, edx and an instruction. Choose the correct after condition of eax, edx Before condition: EAX: 00 00 00 03 EBX: 00 00 00 04 EDX: FF 03 FF 01 Instruction: mul bx After condition:

EAX: 00 00 00 0C EDX: FF 03 00 00

You are given a before condition of the registers eax, ecx, edx and an instruction. Choose the correct after condition of eax, edx Before condition: EAX: 01 0F 00 0B ECX: 00 00 00 04 EDX: 0C E0 00 00 Instruction: div cx After condition:

EAX: 01 0F 00 02 EDX: 0C E0 00 03

You are given a before condition of the registers eax, edx and an instruction. Choose the correct after condition of eax, edx: Before condition: EAX: 12 34 56 78 EDX: 9A BC DE F0 Instruction: xchg eax, edx After condition of EAX, EDX:

EAX: 9A BC DE F0 EDX: 12 34 56 78

Which register contains the starting address of data when calling DumpMem?

ESI

Use the following data for the following question in this page: word1 WORD 1000h,2000h,3000h,4000h,5000h dword1 DWORD 10000h,20000h,30000h,40000h What is the final value of AX after this code has executed? mov esi,OFFSET word1 mov ecx,5 mov eax,100h L1: add ax,[esi] add ax,16 add esi,TYPE word1 Loop L1

F150h

you are given a before condition of ecx register and an instruction. Choose the correct after condition of ecx: Before condition of ECX: FF FF FF FF Instruction: inc cl After condition of ecx:

FF FF FF 00

you are given a before condition of ecx register and an instruction. Choose the correct after condition ecx: Before condition of ECX: FF FF FF 3B Instruction: neg cl After condition of ecx:

FF FF FF C5

You are given a before condition of ecx register and an instruction. Choose the correct after condition of ecx: Before condition of ECX: FF FF FF C8 Instruction: add ecx, 6 After condition of ECX:

FF FF FF CE

You are given a before condition of ecx register and an instruction. Choose the correct after condition of ecx: Before condition of ECX: 0A 00 BF 7A Instruction: mov ecx, -1 After condition of ECX:

FF FF FF FF

A quadword is 4 bytes

False

According to masm Assembler the following instruction is valid dec [ebx]

False

Data bus is an internal bus uses binary signals to synchronize actions of all devices attached to the processor.

False

Dead state is the name of the time delay in a CPU caused by differences between the speed of the CPU and RAM

False

Given the following array definition, newArray DWORD 10,20,30,40,50 ArrayCount = (newArray - $)/4 is a valid constant declaration named that automatically calculates the number of elements in the array.

False

Given the following array definition, newArray WORD 10,20,30,40,50 ArrayCount = ( $ - newArray ) / 4 is a valid constant declaration named that automatically calculates the number of elements in this array.

False

Identifiers are by default, case sensitive

False

If the data range for an application is between +200 and -200 decimal, you can use the data type SBYTE to define memory variables to store data.

False

The EIP register can be the destination operand of a MOV, ADD, or SUB instruction.

False

The EQU directive permits a constant to be redefined at any point in a program

False

The PUSH instruction copies a value from the stack to an operand before decrementing the stack pointer.

False

The RET instruction pops the value pointed to by EBP off the stack into the instruction pointer.

False

The binary representation of decimal -42 is 1101 0111

False

The esi register is used as a counter for loops

False

The following instruction will assembly correctly: inc [esi]

False

The following instructions will set the carry flag: mov al, 0FEh sub al,2

False

The following sequence of statements is invalid: .code mov eax, edx .data myByte BYTE 10 .code mov al, myByte

False

The name of the lowest 8 bits of EDX register is DH

False

The signed word with value 9FFH is negative decimal value

False

The signed word with value A7DEh is a positive decimal value

False

The signed word with value FC3h is a negative decimal value

False

When the OF is set, the result of the signed numbers calculation is valid

False

Within the CPU, all calculations and logic operations take place inside the CU

False

one way to translate an unsigned hexadecimal number into binary, repeatedly divide the integer by 2, saving each remainder as a binary digit.

False

What special purpose does the ECX register serve?

Loop counter: used by looping instructions

Why does memory access take more machine cycles than register access?

Multiple cycles required when reading from memory, because it responds much more slowly than the CPU 1) Address placed on address bus 2) Read line (RD) set low (0) 3) CPU waits one cycle for memory to respond 4) Read Line (RD) goes to 1 indicating that the data is on the data bus

Define Multitasking?

Multiple threads of execution within the same program.

What is the function of the OS scheduler?

Scheduler utility assigns a given amount of CPU time to each running program.

A doubleword (on x86 systems) is 32 bits

True

A signed byte can be equal to +127

True

A word (on x86 systems) is 16 bits

True

Assume that List2 begins at offset 2000h. Is 2004h the offset of the third value (5)? List2 WORD 3,4,5,6,7

True

Fetch, decode, execute are the three primary steps of the instruction execution cycle

True

Fetch, decode, execute are the three primary steps of the instruction execution cycle.

True

High-speed memory that reduces the frequency of access by the CPU to conventional memory is called cache memory

True

If AL contains +127 and you add 3 to AL, the Overflow flag will be set

True

If a CPU clock oscillates 10 billion times per second, then the speed of the processor is 10 GHZ

True

If the data range for an application is between +127 and -128 decimal, you can use the data type SBYTE to define memory variables to store data.

True

In 32-bit mode, immediate values pushed on the stack are always 32 bits long.

True

Scheduler of an operating system is responsible for assigning a given amount of CPU time to each running program

True

The 8-bit two's complement of binary 0010.0110 is 1101.1010

True

The 8-bit two's complement of binary 0110 0010 is 1001 1110

True

The 8-bit two's complement of binary is 0000 0010 is 1111 1110

True

The = directive permits a constant to be redefined at any point in a program.

True

The JAE instruction jumps if the (unsigned) first operand is greater than or equal to the (unsigned) second operand.

True

The MOVSX instruction can use a variable as the source operand

True

The PUSHAD instruction pushes all the 32-bit general-purpose registers on the stack.

True

The SDWORD directive is used when defining signed 32-bit integers

True

The USES operator, coupled with the PROC directive, lets you list the names of all registers modified within a procedure.

True

The binary representation of decimal 42 is 0010 1010

True

The following are both valid data definition statements: List1 BYTE 10,20 BYTE 30,40

True

The following instructions will set the Sign flag: mov al, 0FEh sub al,2

True

The four parts of a CPU are: clock, registers, control unit, arithmetic logic unit

True

The hexadecimal representation of decimal 16 is 10h

True

The hexadecimal representation of decimal 17 is 11h

True

The sum of 3AB3h and 0428h is 3EDBh

True

The three types of buses connected to the CPU are: data, address, control

True

The three types of buses connected to the CPU are: data, address, control.

True

There is a one to one correspondence between an assembly instruction and a machine instruction.

True

This data definition statement creates an array of 500 signed doublewords named myListand initializes each array element to the value -1 myList SDWORD 500 DUP (-1)

True

When the CF is set, the result of the unsigned numbers calculation is not valid.

True

When the POP instruction executes, the ESP register is incremented after the value, it points to, is copied from the stack.

True

When you move a 16-bit constant or an 8-bit constant into a 64-bit register, the upper bits of the destination operand are cleared

True

you are given a before condition of ecx register and an instruction. Choose the correct after condition of indicated flags: Before condition of ECX: 00 00 00 20 Instruction: add cl, 3 After condition of flags:

ZF: 0 SF: 0 CF: 0 OF: 0

Which of the following CALL instructions writes the contents of AL to standard output as a character?

call WriteChar

Which of the following CALL instructions writes the contents of EAX to standard output as a signed decimal integer?

call WriteInt

What will be the value of ECX when the following sequence of instructions has executed? push 5 push 10 pop ebx pop eax pop ecx

cannot be determined

Given that edx = 0x0, eax = 0xAAD, ecx = 0x0 What is going to happen as a result of the execution of the following instruction: div cx Why?

dx:ax / cx 0000:0AAD / 0000 = runtime error because you are trying to divide by 0. The cpu is not capable of dividing by 0.

If you have the following array in the data segment arr byte 1,2,3,4 What will be the values of the array after the execution of the following code? push offset arr push type arr push 8 pop eax pop ebx pop esi add [esi + ebx], eax

eax = 8 ebx = 1 esi = &arr [esi + ebx] = 2 = 8 + 2 = 10 arr = 1, 10, 3, 4

Which of the following code sequences assigns the value 10h to EBX?

mov edx,20h push edx mov ecx,10h push ecx pop ebx pop edx

You are given the following array in your data segment arr word 0F8h, 16h, 0DBh, 77h write ONE instruction to toggle the least significant bit of the second and third elements in the array(Toggle means to change a 0 to 1 and a 1 to 0), For example, after your instruction executes, the array should have: 0F8h, 17h, 0DAh, 77h.

xor DWORD ptr [edx + 2], 00010001h


Kaugnay na mga set ng pag-aaral

ECON 1001: Chapter 14 (Oligopoly and Strategic Behavior)

View Set

Adaptive Learning Assignment (ALA) - Computer Software and Buying a Computer

View Set

Chapter 3: The Free Enterprise System

View Set

ACC 333 Final Exam [Questions from Discussion Boards]

View Set

Life & Health: Practice Exam Questions

View Set

Study questions: Unit 2 Torts; Chap 10

View Set

15 MKC1 CH-14 Customer Satisfaction, Loyalty, and Empowerment

View Set

Psychological Research Self-Check

View Set

AP Psychology - Unit 5: Learning and Classical Conditioning

View Set

06 Cyber Infrastructure & Technology

View Set

Anatomy Lab Exam 1 Chapter 1 - 4

View Set