Assembly Quiz 3 – Flashcards

question
Identify valid suffix characters used in integer constants.
answer
h, q, o, d, b, r, t, y.
question
Is A5h a valid hexadecimal constant?
answer
No
question
Does the multiplication operator * have a higher precedence than the division operator / in integer expressions?
answer
No
question
Write a constant expression that divides 10 by 3 and returns the integer remainder.
answer
Expression: 10 MOD 3.
question
Show an example of a valid real number constant with an exponent.
answer
Real number constant: +3.5E-02.
question
Must string constants be enclosed in single quotes?
answer
No, they can also be enclosed in double quotes
question
Reserved words can be instruction mnemonics, attributes, operators, predefined symbols, and __________.
answer
Directives
question
What is the maximum length of an identifier?
answer
247 characters
question
An identifier cannot begin with a numeric digit.
answer
True
question
Assembly language identifiers are (by default) case insensitive.
answer
True
question
Assembler directives execute at runtime.
answer
False
question
Assembler directives can be written in any combination of uppercase and lowercase letters.
answer
True
question
Name the four basic parts of an assembly language instruction.
answer
Label, mnemonic, operand(s), comment.
question
MOV is an example of an instruction mnemonic.
answer
True
question
A code label is followed by a colon (:), but a data label does not have a colon.
answer
True
question
Show an example of a block comment.
answer
Code example: Comment ! This is a comment This is also a comment !
question
Why would it not be a good idea to use numeric addresses when writing instructions that access variables?
answer
Because the addresses coded in the instructions would have to be updated whenever new variables were inserted before existing ones.
question
In the AddSub program (Section 3.2), what is the meaning of the INCLUDE directive?
answer
The INCLUDE directive copies necessary definitions and setup information from the Irvine32.inc text file. The data from this file is inserted into the data stream read by the assembler.
question
In the AddSub program, what does the .CODE directive identify?
answer
Marks the beginning of the code segment.
question
What are the names of the segments in the AddSub program?
answer
code, data, and stack.
question
In the AddSub program, how are the CPU registers displayed?
answer
By calling the DumpRegs procedure.
question
In the AddSub program, which statement halts the program?
answer
The exit statement
question
Which directive begins a procedure?
answer
The PROC directive
question
Which directive ends a procedure?
answer
The ENDP directive
question
What is the purpose of the identifier in the END statement?
answer
It marks the last line of the program to be assembled, and the label next to END identifies the program's entry point (where execution begins).
question
What does the PROTO directive do?
answer
PROTO declares the name of a procedure that is called by the current program.
question
What types of files are produced by the assembler?
answer
Object .OBJ and listing .LST files.
question
The linker extracts assembled procedures from the link library and inserts them in the executable program.
answer
True
question
When a program's source code is modified, it must be assembled and linked again before it can be executed with the changes.
answer
True
question
Which operating system component reads and executes programs?
answer
Loader
question
What types of files is produced by the linker?
answer
Executable .EXE
question
Create an uninitialized data declaration for a 16-bit signed integer.
answer
var1 SWORD ?
question
Create an uninitialized data declaration for an 8-bit unsigned integer.
answer
var2 BYTE ?
question
Create an uninitialized data declaration for an 8-bit signed integer.
answer
var3 SBYTE ?
question
Create an uninitialized data declaration for a 64-bit integer.
answer
var4 QWORD ?
question
Which data type can hold a 32-bit signed integer?
answer
SDWORD
question
Declare a 32-bit signed integer variable and initialize it with the smallest possible negative decimal value.
answer
var5 SDWORD -2147483648
question
Declare an unsigned 16-bit integer variable named wArray that uses three initializers.
answer
wArray WORD 10, 20, 30
question
Declare a string variable containing the name of your favorite color. Initialize it as a nullterminated string.
answer
myColor BYTE "blue", 0
question
Declare an uninitialized array of 50 unsigned doublewords named dArray.
answer
dArray DWORD 50 DUP(?)
question
Declare a string variable containing the word "TEST" repeated 500 times.
answer
myTestString BYTE 500 DUP("TEST")
question
Declare an array of 20 unsigned bytes named bArray and initialize all elements to zero.
answer
bArray BYTE 20 DUP(0)
question
Show the order of individual bytes in memory (lowest to highest) for the following doubleword variable: val1 DWORD 87654321h
answer
21h, 43h, 65h, 87h
question
Declare a symbolic constant using the equal-sign directive that contains the ASCII code (08h) for the Backspace key.
answer
BACKSPACE = 08h
question
Declare a symbolic constant named SecondsInDay using the equal-sign directive and assign it an arithmetic expression that calculates the number of seconds in a 24-hour period.
answer
SecondsInDay = 24 * 60 * 60
question
Write a statement that causes the assembler to calculate the number of bytes in the following array, and assign the value to a symbolic constant named ArraySize: myArray WORD 20 DUP(?)
answer
ArraySize = ($ - myArray)
question
Show how to calculate the number of elements in the following array, and assign the value to a symbolic constant named ArraySize: myArray DWORD 30 DUP(?)
answer
ArraySize =($ - myArray) / TYPE DWORD
question
Use a TEXTEQU expression to redefine "PROC" as "PROCEDURE."
answer
PROCEDURE TEXTEQU
question
Use TEXTEQU to create a symbol named Sample for a string constant, and then use the symbol when defining a string variable named MyString.
answer
Code example: Sample TEXTEQU MyString BYTE Sample
question
Use TEXTEQU to assign the symbol SetupESI to the following line of code: mov esi,OFFSET myArray
answer
SetupESI TEXTEQU
1 of

Unlock all answers in this set

Unlock answers
question
Identify valid suffix characters used in integer constants.
answer
h, q, o, d, b, r, t, y.
question
Is A5h a valid hexadecimal constant?
answer
No
question
Does the multiplication operator * have a higher precedence than the division operator / in integer expressions?
answer
No
question
Write a constant expression that divides 10 by 3 and returns the integer remainder.
answer
Expression: 10 MOD 3.
question
Show an example of a valid real number constant with an exponent.
answer
Real number constant: +3.5E-02.
question
Must string constants be enclosed in single quotes?
answer
No, they can also be enclosed in double quotes
question
Reserved words can be instruction mnemonics, attributes, operators, predefined symbols, and __________.
answer
Directives
question
What is the maximum length of an identifier?
answer
247 characters
question
An identifier cannot begin with a numeric digit.
answer
True
question
Assembly language identifiers are (by default) case insensitive.
answer
True
question
Assembler directives execute at runtime.
answer
False
question
Assembler directives can be written in any combination of uppercase and lowercase letters.
answer
True
question
Name the four basic parts of an assembly language instruction.
answer
Label, mnemonic, operand(s), comment.
question
MOV is an example of an instruction mnemonic.
answer
True
question
A code label is followed by a colon (:), but a data label does not have a colon.
answer
True
question
Show an example of a block comment.
answer
Code example: Comment ! This is a comment This is also a comment !
question
Why would it not be a good idea to use numeric addresses when writing instructions that access variables?
answer
Because the addresses coded in the instructions would have to be updated whenever new variables were inserted before existing ones.
question
In the AddSub program (Section 3.2), what is the meaning of the INCLUDE directive?
answer
The INCLUDE directive copies necessary definitions and setup information from the Irvine32.inc text file. The data from this file is inserted into the data stream read by the assembler.
question
In the AddSub program, what does the .CODE directive identify?
answer
Marks the beginning of the code segment.
question
What are the names of the segments in the AddSub program?
answer
code, data, and stack.
question
In the AddSub program, how are the CPU registers displayed?
answer
By calling the DumpRegs procedure.
question
In the AddSub program, which statement halts the program?
answer
The exit statement
question
Which directive begins a procedure?
answer
The PROC directive
question
Which directive ends a procedure?
answer
The ENDP directive
question
What is the purpose of the identifier in the END statement?
answer
It marks the last line of the program to be assembled, and the label next to END identifies the program's entry point (where execution begins).
question
What does the PROTO directive do?
answer
PROTO declares the name of a procedure that is called by the current program.
question
What types of files are produced by the assembler?
answer
Object .OBJ and listing .LST files.
question
The linker extracts assembled procedures from the link library and inserts them in the executable program.
answer
True
question
When a program's source code is modified, it must be assembled and linked again before it can be executed with the changes.
answer
True
question
Which operating system component reads and executes programs?
answer
Loader
question
What types of files is produced by the linker?
answer
Executable .EXE
question
Create an uninitialized data declaration for a 16-bit signed integer.
answer
var1 SWORD ?
question
Create an uninitialized data declaration for an 8-bit unsigned integer.
answer
var2 BYTE ?
question
Create an uninitialized data declaration for an 8-bit signed integer.
answer
var3 SBYTE ?
question
Create an uninitialized data declaration for a 64-bit integer.
answer
var4 QWORD ?
question
Which data type can hold a 32-bit signed integer?
answer
SDWORD
question
Declare a 32-bit signed integer variable and initialize it with the smallest possible negative decimal value.
answer
var5 SDWORD -2147483648
question
Declare an unsigned 16-bit integer variable named wArray that uses three initializers.
answer
wArray WORD 10, 20, 30
question
Declare a string variable containing the name of your favorite color. Initialize it as a nullterminated string.
answer
myColor BYTE "blue", 0
question
Declare an uninitialized array of 50 unsigned doublewords named dArray.
answer
dArray DWORD 50 DUP(?)
question
Declare a string variable containing the word "TEST" repeated 500 times.
answer
myTestString BYTE 500 DUP("TEST")
question
Declare an array of 20 unsigned bytes named bArray and initialize all elements to zero.
answer
bArray BYTE 20 DUP(0)
question
Show the order of individual bytes in memory (lowest to highest) for the following doubleword variable: val1 DWORD 87654321h
answer
21h, 43h, 65h, 87h
question
Declare a symbolic constant using the equal-sign directive that contains the ASCII code (08h) for the Backspace key.
answer
BACKSPACE = 08h
question
Declare a symbolic constant named SecondsInDay using the equal-sign directive and assign it an arithmetic expression that calculates the number of seconds in a 24-hour period.
answer
SecondsInDay = 24 * 60 * 60
question
Write a statement that causes the assembler to calculate the number of bytes in the following array, and assign the value to a symbolic constant named ArraySize: myArray WORD 20 DUP(?)
answer
ArraySize = ($ - myArray)
question
Show how to calculate the number of elements in the following array, and assign the value to a symbolic constant named ArraySize: myArray DWORD 30 DUP(?)
answer
ArraySize =($ - myArray) / TYPE DWORD
question
Use a TEXTEQU expression to redefine "PROC" as "PROCEDURE."
answer
PROCEDURE TEXTEQU
question
Use TEXTEQU to create a symbol named Sample for a string constant, and then use the symbol when defining a string variable named MyString.
answer
Code example: Sample TEXTEQU MyString BYTE Sample
question
Use TEXTEQU to assign the symbol SetupESI to the following line of code: mov esi,OFFSET myArray
answer
SetupESI TEXTEQU
Get an explanation on any task
Get unstuck with the help of our AI assistant in seconds
New