©BRIGHSTARS 2024/2025 ALL RIGHTS RESERVED.
COMSC 260 Test 3 Exam Questions With
Correct Answers.
Suppose a program is supposed to write to memory letter/digit pairs, where the letter comes first
and the digit comes second. Each pairing of a capital letter (A - Z) and a digit (0 - 9) should be
written to memory in the following order: A0, A1, ...., A9, B0, B1, .... B9, ...., Y0, Y1, .... Y9,
Z0, Z1, .... Z9*
In addition, the total number of pairings should be stored in num_of_pairs.
*Remember if you were to actually run this in visual studio, you would see the ASCII codes in
memory itself, and the characters ('A', '0', etc.) off to the side
The start of this program is as follows:
LETTERS = 26
DIGITS = 10
.data
outer_loop DWORD ?
pair WORD ?
num_of_pairs DWORD ?
.code
main proc
1|Page
, ©BRIGHSTARS 2024/2025 ALL RIGHTS RESERVED.
mov outer_loop, LETTERS
mov ah, '0'
mov al, 'A'
mov pair, ax
mov num_of_pairs, 1
Which of the options below is the correct continuation of this program?
NOTE: inc is the increment instruction -- it increments the value of i - Answer✔B-)
mov ecx, DIGITS-1
jmp L2
L1:
mov outer_loop, ecx
mov ecx, DIGITS-1
mov ah, '0'
mov al, BYTE PTR pair
inc al
mov pair, ax
inc num_of_pairs
L2:
inc BYTE PTR [pair+1]
inc num_of_pairs
loop L2
mov ecx, outer_loop
loop L1
2|Page
, ©BRIGHSTARS 2024/2025 ALL RIGHTS RESERVED.
All of the options below will cause an infinite loop* EXCEPT*:
C-)
mov ecx, -1
L1:
mov eax, ecx
inc ecx
loop L1
A-)
mov ecx, 0
L1:
mov eax, ecx
inc ecx
loop L1
D-)
mov ecx, -1
L1:
mov eax, ecx
dec ecx
loop L1
B-)
mov ecx, 0
L1:
mov eax, ecx
3|Page
, ©BRIGHSTARS 2024/2025 ALL RIGHTS RESERVED.
dec ecx
loop L1 - Answer✔*A-)*
*mov ecx, 0*
*L1:*
*mov eax, ecx*
*inc ecx*
*loop L1*
For which of the options below will the jump to OddParity be taken only when the parity of the
number in al is odd?
*D-) and al, al*
* jnp OddParity*
B-) or al, 11111111b
jnp OddParity
C-) and al, al
jp OddParity
A-) or al, 11111111b
jp OddParity - Answer✔*and al, al*
*jnp OddParity*
Suppose a program starts with the following instructions:
mov ebx, 0
mov bl, 11111111b
4|Page