0% found this document useful (0 votes)
40 views9 pages

Quiz 3 2

The document contains a quiz from a computer architecture course focusing on assembly language and macro functions. It includes various questions related to assembly instructions, memory operations, and calling conventions, with each question followed by the correct answers. The quiz was completed on May 23, 2022, and consists of multiple-choice and fill-in-the-blank questions, all of which received full points.

Uploaded by

Nhật Minh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views9 pages

Quiz 3 2

The document contains a quiz from a computer architecture course focusing on assembly language and macro functions. It includes various questions related to assembly instructions, memory operations, and calling conventions, with each question followed by the correct answers. The quiz was completed on May 23, 2022, and consists of multiple-choice and fill-in-the-blank questions, all of which received full points.

Uploaded by

Nhật Minh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Kien truc may tinh va hop ngu_ Nhom 01CLC

 Nhà của tôi / Các khoá học của tôi / CAAL230180_21_2_01CLC / Chapter 8: Macro & Function / Quiz #3

Bắt đầu vào lúc Monday, 23 May 2022, 8:52 AM


Trạng thái Đã xong
Kết thúc lúc Monday, 23 May 2022, 9:29 AM
Thời gian thực 36 phút 48 giây
hiện

Câu hỏi 1
Hoàn thành

Đạt điểm 1,00

Select the correct sequence of instructions to compute -1024/128 (all values are in hex).

Step 1:
MOV AX,FC00 mov ax,-1024
Step 2:
IDIV CX
cwd
Step 3:
mov cx,128
MOV CX,80
idiv cx
Step 4:
CWD

Câu hỏi 2
Hoàn thành

Đạt điểm 1,00

Which are the correct inputs for XLAT instruction

Select one or more:


[esi] pointed to look-up table
look-up index must be loaded into al
look-up index must be loaded into DL

ebx pointed to look-up table


Câu hỏi 3
Hoàn thành

Đạt điểm 1,00

Given a row of memory image in gdb

0x0ae80120 13 96 D0 E0 D0 E0 A2 1E - 99 80 3E 20 99 00 75 24

esi = 0x0ae80120, edi = 0x0ae80128


Select correct sequence of instructions to subtract words at [edi] from [esi] then store the result at memory location 0x0ae8012a

Step 1: MOV word[ebx], ax

Step 2: SUB ax, word[esi]

Step 3: SUB ax, word[edi]

Step 4: MOV ebx, 0x0ae8012a


Câu hỏi 4
Hoàn thành

Đạt điểm 1,00

Choose correct calling convention when a function is called in assembly language

Select one:

Caller: push arguments in forward order then push eip on stack

Callee:

On enter:

push ebp

mov ebp, esp

...

On quit:

leave

ret

Caller: push arguments in reverse order then push eip on stack

Callee:

On enter:

push ebp

mov esp, ebp

...

On quit:
leave

ret

Caller: push arguments in reverse order then push eip on stack

Callee:

On enter:

push ebp
mov ebp, esp

...
On quit:

leave
ret

Caller: push arguments then push cs:eip on stack

Callee:
On enter:

push esp
mov esp, ebp

...
On quit:

mov esp, ebp


pop ebp

ret
Câu hỏi 5
Hoàn thành

Đạt điểm 1,00

the memory stack area of a program shown in figure (16-bit real mode)

Address 1d50 1d51 1d52 1d53


Value AF 90 71 DA
The value of sp register is 0x1d50. What is the value of dx after execution of following 2 lines of code:
mov bp, sp

mov dx, word[bp+2]

Answer: 28 ==> 71

Câu hỏi 6
Hoàn thành

Đạt điểm 1,00

Given a code snippet (ax, bx are none negative integers):

if (ax >= bx)


ax -=bx;

else
bx -=ax;
What is the equivalent logic sequence of instructions in Assembly

Select one:
cmp ax,bx
ja a_label
sub ax,bx
jmp x_label
a_label:
sub bx,ax
x_label:

cmp ax,bx
jb a_label
sub ax,bx
jmp x_label
a_label:
sub bx,ax
x_label:

cmp ax,bx
jbe a_label
sub ax,bx
jmp x_label
a_label:
sub bx,ax
x_label:

cmp ax,bx
jnbe a_label
sub ax,bx
jmp x_label
a_label:
sub bx,ax
x_label:
Câu hỏi 7
Hoàn thành

Đạt điểm 1,00

Given an assembly code copying from the memory buffer Buff1 to Buff2:
mov esi, Buff1
mov edi, Buff2
mov cx,20
;--- Start of block
cp_loop:
mov al, byte[esi]
mov byte[edi], al
inc esi
inc edi
loop cp_loop

; ---End of block
Choose equivalent string operations in place of the above code block

Select one or more:


cld
cp_loop:
movsb
LOOP cp_loop
cld
cp_loop:
rep movsb
loop cp_loop
cld
rep movsb
std
cp_loop:
movsb
loop cp_loop

Câu hỏi 8
Hoàn thành

Đạt điểm 1,00

Match the following

Load LODSB/W Loads AL/AX register with content of a memory location

Compare CMPSB/W Compares two series of bytes or words

Copy MOVSB/W Copy a series of bytes from source to destination memory

Search SCASB/W Compare value in AL with bytes or words in memory


and
compare
Câu hỏi 9
Hoàn thành

Đạt điểm 1,00

Part of memory as shown in figure

The value of BX register follows the execution of MOV BX, [1D49] is F57F. What is the endian type of this computer system

Select one:
big-endian

non-endian

little-endian

level-endian

Câu hỏi 10
Hoàn thành

Đạt điểm 1,00

Write mask byte (in hex) to set bit 6th, 4th of a byte value with OR instruction (LSB is the 1st bit).

Answer: 28 14

Câu hỏi 11
Hoàn thành

Đạt điểm 1,00

Select correct match for AX (Decimal) at watch points:

MOV AX, 1BC 444


MOV CL, 2

SHL AX, CL 444*4


watch point #1: 1942
ADD AX, 166
watch point #2: 485
SHR AX, CL

watch point #3: 121


SHR AX, CL

......

watch point #2: 266


sai
watch point #1: 1064 sai
watch point #3: 266
sai
Câu hỏi 12
Hoàn thành

Đạt điểm 1,00

the memory stack area of a program shown in figure (16-bit real mode)

Address 1d50 1d51 1d52 1d53


Value AF 90 71 DA
The value of sp register is 0x1d52. What is the value of sp after the execution of push si

Answer: 90

Câu hỏi 13
Hoàn thành

Đạt điểm 1,00

Which are the correct operations for LODSW instruction if DF is reset (=0)

Select one or more:


Load 16-bit value at memory location pointed by [esi] into ax
Load 16-bit value at memory location pointed by [edi] into ax
increase esi by 2

decrease edi by 2

Câu hỏi 14
Hoàn thành

Đạt điểm 1,00

Match the definition of flag bits in PSW

determine whether an external interrupts are to be ignored or processed IF DF


the processor switches to single-step mode
TF CF
contains the carry of 0 or 1 from the leftmost bit after an arithmetic operation CF TF
determine the direction for moving or comparing data between memory areas
DF IF
Câu hỏi 15
Hoàn thành

Đạt điểm 1,00

The following sequence of instructions are executed. What is the correct value of AX, CX, DX at watch point?

MOV AX,0x0020

MOV CX,0x0010
MUL CL

watch point:

AX =
0x0200
Đúng mà ảo vl
DX
0x0000 Đúng mà ảo vl
CX =
0x0010 Đúng mà ảo vl

Câu hỏi 16
Hoàn thành

Đạt điểm 1,00

Given a code snippet:


int n = 10;

do {

n--;
} while (n > 0);

Which ones are the equivalent logic sequence of instructions in Assembly

Select one or more:


mov cx, 10

a_label:

.....
loop a_label

mov cx, 10
a_label:

.....

dec cx
loop a_label

mov cx, 10

a_label:
.....

dec cx

cmp cx,0
jz a_label

mov cx, 10

a_label:
dec cx

cmp cx, 0

jz e_label
jmp a_label

e_label:
Câu hỏi 17
Hoàn thành

Đạt điểm 1,00

EAX now stored a 32-bit IP address of a host. The network ID (netID) is 24 bit and can be extracted from IP byte anding with a 32-bit mask.
Write correct instruction to extract netID from EAX register.

Note: Immediate value must be written in hex

Answer: and EAX,FFFFF000

Câu hỏi 18
Hoàn thành

Đạt điểm 1,00

Which are the correct actions for SCASW string operation if DF is set (=1)

Select one or more:


compare the value in eax register with 16-bit value at the memory location pointed by esi and set/clear flag bits accordingly
increase edi by 2

decrease edi by 2

compare the value in ax register with 16-bit value at the memory location pointed by edi and set/clear flag bits accordingly

Câu hỏi 19
Hoàn thành

Đạt điểm 1,00

Write mask byte (in hex) to set lower 4 bits in a byte value with OR instruction (LSB is the 1st bit).

Answer: 28 ==> 0F

◄ code

Chuyển tới...

You might also like