Midterm Exam Flashcards

Get me prepared for midterm exam covering Chapter 1 to 4

1
Q

What is an assembler?

A

A utility program that converts assembly language source code programs into machine language.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does a linker do?

A

A utility program that combines individual files created by an assembler into a single executable program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the function of a debugger?

A

Lets you trace the execution of a program and examine contents of registers and memory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How does assembly language relate to machine language?

A

Assembly language consists of statements written with short mnemonics, and has a one-to-one relationship with machine language.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the native machine language of a computer referred to as?

A

Language L0.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is Language L1?

A

A more human-friendly language constructed above machine language.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the two ways programs written in L1 can run?

A
  • Interpretation
  • Translation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a virtual machine?

A

An abstraction that allows programs written in higher-level languages to run on different hardware.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does the term ‘MSB’ stand for?

A

Most Significant Bit.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does ‘LSB’ stand for?

A

Least Significant Bit.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is binary addition?

A

The process of adding binary digits, where the outcomes include carrying over when both bits are 1.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the hexadecimal system?

A

A base-16 number system where each digit corresponds to 4 binary bits.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How are signed integers represented in binary?

A

Using two’s complement notation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the Boolean NOT operation?

A

Inverts (reverses) a boolean value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the truth table for the AND operator?

A

The output is true only when both inputs are true.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does the OR operator do?

A

The output is false only when both inputs are false.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is a truth table?

A

A table that shows all the inputs and outputs of a Boolean function.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What are the main components of a CPU?

A
  • Registers
  • High-frequency clock
  • Control unit
  • Arithmetic logic unit (ALU)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What is the instruction execution cycle?

A
  • Fetch
  • Decode
  • Fetch operands
  • Execute
  • Store output
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What is a cache hit?

A

When data to be read is already in cache memory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What is a cache miss?

A

When data to be read is not in cache memory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What is an operand?

A

A value that is either an input or an output to an operation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What is the purpose of general-purpose registers?

A

To hold values used in operations and to optimize speed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What does the EIP register do?

A

Contains the address of the next instruction to be executed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What are status flags?

A

Flags that reflect the outcomes of arithmetic and logic operations performed by the CPU.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

What does the MOV instruction do?

A

Moves (assigns) one value to another.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

What is a label in assembly language?

A

Acts as a place marker for code and data, marking the address of the instruction.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

What are directives in assembly language?

A

Commands recognized by the assembler, used to declare code, data areas, and select memory models.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

What is an integer constant?

A

A numerical value that can be represented in binary, decimal, hexadecimal, or octal.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

What is a character constant?

A

A single character enclosed in single or double quotes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

How is an identifier defined in assembly language?

A

A programmer-chosen name to identify a variable, constant, procedure, or code label.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

What is the difference between directives and instructions?

A

Directives are not executed at runtime, while instructions are.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

What is the template for an assembly language program?

A
  • .386
  • .model flat,stdcall
  • .stack 4096
  • .data
  • .code
  • main PROC
  • INVOKE ExitProcess,0
  • main ENDP
  • END main
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

What is the purpose of a data definition statement?

A

Sets aside storage in memory for a variable and optionally assigns a name.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

Define BYTE and SBYTE data types.

A
  • BYTE: 8-bit unsigned integer
  • SBYTE: 8-bit signed integer
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

What is the syntax for a data definition statement?

A

[name] directive initializer [, initializer] …

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

Provide an example of defining a DWORD variable.

A

count DWORD 12345

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

True or False: MASM prevents initializing a BYTE with a negative value.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

List the largest and smallest values for SBYTE.

A
  • Largest: +127
  • Smallest: -128
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

What does the DUP operator do?

A

Allocates space for an array or string.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

Fill in the blank: A string is implemented as an array of _____ and is often null-terminated.

A

[characters]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q

What is the purpose of the .data directive?

A

To declare an uninitialized data segment.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
Q

What is the result of the instruction ‘mov eax, val1’ if val1 is 10000h?

A

EAX = 10000h

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
44
Q

Explain the MOV instruction in assembly language.

A

Copies data from a source operand to a destination operand.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
Q

What are the three basic types of operands in assembly language?

A
  • Immediate
  • Register
  • Memory
46
Q

What is the syntax for the MOV instruction?

A

MOV destination, source

47
Q

Fill in the blank: The instruction pointer register (IP, EIP, or RIP) cannot be a _____ operand.

A

[destination]

48
Q

What does the MOVZX instruction do?

A

Zero-extends a smaller value into a larger destination.

49
Q

What does the MOVSX instruction do?

A

Sign-extends a smaller value into a larger destination.

50
Q

What is the purpose of the XCHG instruction?

A

Exchanges the values of two operands.

51
Q

True or False: Two memory operands are permitted in the XCHG instruction.

52
Q

Define the OFFSET operator.

A

Returns the distance of a variable from the beginning of its enclosing segment.

53
Q

What does the TYPE operator return?

A

The size, in bytes, of a single element of a data declaration.

54
Q

List the sizes returned by the TYPE operator for BYTE, WORD, DWORD, and QWORD.

A
  • BYTE: 1
  • WORD: 2
  • DWORD: 4
  • QWORD: 8
55
Q

What happens when you apply the NEG instruction to a value?

A

Reverses the sign of an operand.

56
Q

What is the syntax for adding two values in assembly language?

A

ADD destination, source

57
Q

What is the syntax for subtracting two values in assembly language?

A

SUB destination, source

58
Q

Fill in the blank: The _____ operator can be applied to a direct-offset operand.

59
Q

What does the LENGTHOF operator do?

A

Returns the number of elements in an array.

60
Q

What is the purpose of the SIZEOF operator?

A

Returns the size, in bytes, of a given data type.

61
Q

What is the result of the instruction ‘mov ax, [arrayW + 2]’?

62
Q

True or False: The MOV instruction can have more than two operands.

63
Q

What is a null-terminated string?

A

A string that ends with a null character (0).

64
Q

What is the significance of the .code directive?

A

Indicates the start of the code segment.

65
Q

What does the INVOKE statement do?

A

Calls a procedure.

66
Q

Fill in the blank: The instruction ‘sub eax, 1’ will result in _____ being stored in EAX.

67
Q

What does the TYPE operator return?

A

The size, in bytes, of a single element of a data declaration.

The TYPE of a byte equals 1, the TYPE of a word equals 2, the TYPE of a doubleword is 4, and the TYPE of a quadword is 8.

68
Q

What is the TYPE of a byte?

69
Q

What is the TYPE of a word?

70
Q

What is the TYPE of a doubleword?

71
Q

What is the TYPE of a quadword?

72
Q

What does the LENGTHOF operator count?

A

The number of elements in a single data declaration.

Examples include counting elements in arrays or strings.

73
Q

What is the LENGTHOF of byte1 which is declared as BYTE 10,20,30?

74
Q

What is the LENGTHOF of array1 declared as WORD 30 DUP(?),0,0?

75
Q

What is the LENGTHOF of array2 declared as WORD 5 DUP(3 DUP(?))?

76
Q

What is the LENGTHOF of array3 declared as DWORD 1,2,3,4?

77
Q

What is the LENGTHOF of digitStr declared as BYTE ‘12345678’,0?

78
Q

What does the SIZEOF operator return?

A

A value that is equivalent to multiplying LENGTHOF by TYPE.

79
Q

What is the formula for SIZEOF?

A

SIZEOF = LENGTHOF * TYPE

80
Q

What is the SIZEOF of array1?

81
Q

What is meant by a one-to-many relationship when comparing a high-level language to machine language?

A

Each high-level language statement matches multiple machine language statements.

82
Q

Name two types of applications that would be better suited to assembly language than a high-level language.

A

Device drivers and high performance graphics

83
Q

Name the four virtual machine levels named in this section, from lowest to highest.

A

digital logic, instruction set architecture, assembly language, high-level language

84
Q

Which of the following is the decimal representation of the unsigned binary integer 11111000?

85
Q

What is the value of the boolean expression ¬(F ∨ T) ?

86
Q

In the expression ¬Y ∧ Z, the NOT operation executes after the AND operation.

87
Q

How many bits are used by doubleword data type?

88
Q

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

A

Data, Address, and Control buses

89
Q

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

A

Fetch instruction, decode the instruction, execute the instruction

90
Q

In addition to EAX, EBX, ECX, and EDX, what are the names of the other 32-bit general-purpose registers?

A

ESI, EDI, ESP, EBP

91
Q

Which of the following choices lists names of CPU status flags?

A

Sign, Zero, Carry, Overflow, Parity

92
Q

Which of the following is not a reserved word in Assembly programming?

A

Directives
Instruction mnemonics
Attributes
Operators

93
Q

What are the minimum numbers of binary bits needed to represent the unsigned decimal integers 37 and 294?

A

37 requires 6 bits and 294 requires 7 bits

94
Q

What are the x86 processor’s three basic modes of operation?

A

System Management mode, Real-address mode, and Protected mode

95
Q

The EIP, or instruction pointer register contains the address of the last instruction executed.

96
Q

Which of the following lists the three basic types of operands?

A

register, immediate, memory

97
Q

In a MOV instruction, the second operand is known as the destination operand.

98
Q

The EIP register cannot be the destination operand of a MOV instruction.

99
Q

An operand notated as reg/mem32 indicates that it must be either a register of any size, or a 32-bit memory operand.

100
Q

The XCHG instruction can exchange the values of two memory operands.

101
Q

The SAHF instruction copies the contents of the AH register into the low-order byte of the EFLAGS (or RFLAGS) register.

102
Q

The following instruction sequence subtracts val4 from val2.

.data
val1 BYTE 10h
val2 WORD 8000h
val3 DWORD 0FFFFh
val4 WORD 7FFFh
.code
mov ax,val4
sub val2,ax

103
Q

If val3 is incremented by 1 using the ADD instruction, CF = 1, and ZF = 0.

104
Q

The OFFSET operator always returns a 16-bit value.

105
Q

The TYPE operator returns a value of 4 for doubleword operands.

106
Q

Which of the following operators returns the number of bytes in an operand?

107
Q

The following code will move the value 3 to EAX:

.data
array DWORD 1,2,3,4
.code
mov esi, 8
mov eax, array[esi]

108
Q

The following instruction is valid:

add WORD PTR[esi+2], 20

109
Q

The following code will move the value 2 to EAX:

.data
array DWORD 1,2,3,4
.code
mov esi,0
mov eax, array[esi*2]

110
Q

True or False?

The LOOP instruction first checks to see whether ECX is not equal to zero. Next, LOOP decrements ECX and jumps to the destination label.