Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Chapter 3 Test Bank Note to instructors: To view the answers, select Tools | Options | View | Hidden Text in MS-Word. Last update: 9/27/2002 Copyright Kip Irvine. All rights reserved. You may use and modify this test for instructional purposes as long as you have adopted Assembly Language for Intel-Based Computers (Irvine) for your current semester course. You are welcome to edit and extract questions from this test as long as you do not reproduce or distribute the questions outside of your own classroom. Fill in the Blanks and Short Answer 1. Show an example of a valid hexadecimal integer constant. 2Bh 2. Show an example of a valid 8-bit binary integer constant. 1101010b 3. Show an example of an integer expression that performs both multiplication and modulus arithmetic. 45 * 2 MOD 3 4. What is the order of operations in the expression 6 + 25 * 4 ? addition 5. A command that is recognized and executed by the assembler while the source code is being assembled is a(n) __________. directive 6. A _________ is a word that has special meaning to the assembler and can only be used in its correct context. reserved word 7. Identify two types of labels in assembly language programs. 8. Show an example of an instruction mnemonic. Choose from: MOV, ADD, SUB, MUL, etc. 9. Which directive enables block-style comments? COMMENT negation, multiplication, code label, data label 10. In the AddSub program in Section 3.2, which statement displays the contents of the registers?call DumpRegs 11. In the AddSub program in Section 3.2, which directive marks the last line in the program? END 12. In the AddSub program in Section 3.2, which directive copies necessary definitions and setup information from a text file? INCLUDE 13. Which directive is used when defining signed 16-bit integers? SWORD 14. Which directive is used when defining unsigned 16-bit integers? WORD 15. Which directive is used when defining signed 32-bit integers? SDWORD 16. Which directive is used when defining unsigned 16-bit integers? DWORD 17. Which directive is used when defining 80-bit integers? TBYTE 18. Which directive can by used in place of the BYTE directive for unsigned integers? Irvine, Kip R. Assembly Language for Intel-Based Computers, 4th Edition DB 1 19. Write a data definition statement that creates a signed 16-bit integer named myWord and leaves its contents uninitialized. myWord SWORD ? 20. Which directive defines a segment containing only uninitialized data? .DATA? 21. Declare a symbolic constant named COUNT that equals 25. 25) COUNT = 25 (or COUNT EQU 22. Use COUNT from the previous question in a data definition statement that creates an uninitialized array of 32-bit unsigned integers named myArray. myArray DWORD COUNT DUP(?) 23. Given the following array definition, write a constant declaration named ArraySize that automatically calculates the size in bytes, of the array: ArraySize = ($ - newArray) ; parentheses optional newArray DWORD 10,20,30,40,50 Multiple-Choice 24. Which directive identifies the part of a program containing instructions? a. .DATA b. .CODE c. .STACK d. .PROG answer: b 25. Which directive(s) are used when defining both signed and unsigned 64-bit integers? a. QWORD and SQWORD b. DWORD c. QWORD d. DWORD and SDWORD answer: c 26. In the AddSub program in Section 3.2, the exit statement calls which predefined MS-Windows function to halt the program? a. HaltProgram b. ExitProcess c. OS_Return d. Exit_Program answer: b 27. Which of the following are valid data definition statements that create an array of unsigned bytes containing decimal 10, 20, and 30, named myArray. myArray BYTE 10, 20, 30 Irvine, Kip R. Assembly Language for Intel-Based Computers, 4th Edition 2 a. b. c. d. answer: 28. In the following data definition, assume that List2 begins at offset 2000h. What is the offset of the third value (5)? 2004h List2 WORD 3,4,5,6,7 a. b. c. d. answer: 29. Which letter choice shows the memory byte order, from low to high address, of the following data definition? 78h,56h,34h,12h BigVal DWORD 12345678h a. b. c. d. answer: 30. Given the following array definition, which letter choice contains a valid constant declaration named ArrayCount that automatically calculates the number of elements in the array? ArrayCount = ($ - newArray) / 4 newArray DWORD 10,20,30,40,50 a. b. c. d. answer: 31. Select a data definition statement that creates an array of 500 signed doublewords named myList and initializes each array element to the value 1. myList SDWORD 500 DUP(1) a. b. c. d. answer: Irvine, Kip R. Assembly Language for Intel-Based Computers, 4th Edition 3 32. Which of the following defines a text macro named MESSAGE that contains this string data? MESSAGE TEXTEQU <"I'm good at this!",0> "I'm good at this!",0 a. b. c. d. answer: 33. Which directive is used when defining 64-bit IEEE long reals? a. REAL4 b. REAL8 c. REAL64 d. REAL answer: b 34. A character constant must be enclosed in single quotes. F a. True b. False answer: b 35. An identifier in assembly language may not be more than 247 characters long. T a. True b. False answer: a 36. An identifier may begin with a digit. F a. True b. False answer: b 37. The following is a valid identifier: [email protected]_$ T a. True b. False answer: a 38. The following is a valid identifier: AB62$ T F a. True b. False answer: b 39. A label used for data must not end with a colon (:). T Irvine, Kip R. Assembly Language for Intel-Based Computers, 4th Edition 4 a. True b. False answer: a 40. A code label always ends with a colon (:). T a. True b. False answer: a 41. The PROC directive marks both the beginning and ending of a procedure. F a. True b. False answer: b 42. The .CODE directive must always occur before the .DATA directive. F a. True b. False answer: b 43. In the following statement, EAX is called the destination operand: T mov EAX,10000h a. True b. False answer: a 44. If the source code for an assembly language program is modified, you must run both the assembler and linker to update the program's executable code. T a. True b. False answer: a 45. The listing file does not contain a disassembly of each instruction. F a. True b. False answer: b 46. The listing file contains a list of segments and groups in a program. T a. True b. False answer: a 47. The listing file contains a list of program symbols. T a. True Irvine, Kip R. Assembly Language for Intel-Based Computers, 4th Edition 5 b. False answer: a 48. The following is a valid data definition statement: F helloStr WORD 10000h,20000h a. True b. False answer: b 49. The following is a valid data definition statement: T helloStr DWORD 2 a. True b. False answer: a 50. The following is a valid data definition statement: T str1 \ BYTE "This string is quite long!",0 a. True b. False answer: a 51. The following are both valid data definition statements: T List1 BYTE 10,20 BYTE 30,40 a. True b. False answer: a 52. The following sequence of statements is invalid: F .code mov eax,edx .data myByte BYTE 10 .code mov al,myByte a. True b. False answer: b 53. The EQU directive permits a constant to be redefined at any point in a program. F a. True b. False Irvine, Kip R. Assembly Language for Intel-Based Computers, 4th Edition 6 answer: b 54. The TEXTEQU directive permits a constant to be redefined at any point in a program. T a. True b. False answer: a (Some of the following questions have more than one correct answer. Circle all correct answers.) 55. The two types of real-number constants are: a. decimal, binary b. encoded, binary c. decimal, encoded d. BCD, ASCII answer: c 56. Which of the following are true about assembly language instructions and directives? a. a directive is executed at runtime b. an instruction is executed at runtime c. a directive is executed at assembly time d. an instruction is executed at assembly time answers: b, c 57. The basic parts of an instruction, in order from left to right, are: a. label, mnemonic, operand(s), comment b. comment, label, mnemonic, operand(s) c. label, mnemonic, comment d. mnemonic, operand(s), comment answer: a 58. Operands may be any of the following: a. constant or constant expression b. reserved word c. register name d. variable name (memory) answers: a,c,d Irvine, Kip R. Assembly Language for Intel-Based Computers, 4th Edition 7 59. Which utility program reads an assembly language source file and produces an object file? a. compiler b. linker c. assembler d. loader answer: c 60. A map file is produced by which of the following utility programs? a. assembler b. linker c. loader d. text editor answer: b 61. Which file(s) contain a human-readable listing of segment (and segment group) names? a. listing b. source c. map d. executable answers: a, c 62. Which of the following will generate assembly errors? a. var1 BYTE 1101b, 22, 35 b. var2 BYTE "ABCDE",18 c. var3 BYTE '$','98778', (line ends with comma) d. var4 BYTE 256,19,40 answers: c,d (256 is too large for a byte) 63. The byte-ordering scheme used by computers to store large integers in memory with the highorder byte at the lowest address is called: a. big endian b. byte-major c. little endian d. byte-minor answer: a Irvine, Kip R. Assembly Language for Intel-Based Computers, 4th Edition 8