Chapter 6 - Conditional Processing Flashcards

(77 cards)

1
Q

What flag is set when the result of an operation equals zero?

A

Zero flag

The Zero flag is set when the destination equals zero.

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

What flag is set when an instruction generates a result that is too large for the destination operand?

A

Carry flag

The Carry flag is set when an unsigned value is out of range.

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

What flag indicates that the destination operand is negative?

A

Sign flag

The Sign flag is set if the destination operand is negative and clear if positive.

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

What flag is set when an instruction generates an invalid signed result?

A

Overflow flag

The Overflow flag is determined by XORing bit 7 carry with bit 6 Carry.

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

What flag is set when an instruction generates an even number of 1 bits in the low byte of the destination operand?

A

Parity flag

The Parity flag reflects the evenness of 1 bits in the low byte.

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

What flag is set when an operation produces a carry out from bit 3 to bit 4?

A

Auxiliary Carry flag

This flag indicates a carry between specific bits.

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

What operation does the AND instruction perform?

A

Boolean AND operation

The AND instruction performs a bitwise AND between two operands.

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

What happens to the Overflow and Carry flags after an AND instruction?

A

Cleared

The AND instruction always clears the Overflow and Carry flags.

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

What operation does the OR instruction perform?

A

Boolean OR operation

The OR instruction performs a bitwise OR between two operands.

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

What does the XOR instruction do?

A

Boolean exclusive-OR operation

The XOR instruction performs a bitwise exclusive OR between two operands.

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

What is the result of the NOT instruction?

A

One’s complement

The NOT instruction toggles (inverts) all bits in an operand.

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

What type of searches utilize techniques from propositional logic?

A

Boolean searches

Boolean searches use AND, OR, and NOT to filter search results.

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

What does the AND connective do in Boolean searches?

A

Matches records containing both search terms

The AND connective is used to find results that include all specified terms.

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

What does the OR connective do in Boolean searches?

A

Matches one or both search terms

OR is the broadest operator and returns any results containing either term.

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

What does the NOT connective do in Boolean searches?

A

Excludes a particular search term

The NOT operator filters out unwanted terms from search results.

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

What instruction performs a nondestructive AND operation?

A

TEST instruction

TEST does not modify the destination operand but affects the Zero flag.

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

What does the CMP instruction do?

A

Compares destination and source operands

CMP performs nondestructive subtraction of source from destination.

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

What flags does the CMP instruction affect?

A

Overflow, Sign, Zero, Carry, Auxiliary Carry, Parity flags

These flags indicate the result of the comparison.

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

What does the JC instruction do?

A

Jump to a label if the Carry flag is set

JC is a conditional jump based on the Carry flag.

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

What does the JZ instruction do?

A

Jump to a label if the Zero flag is set

JZ is a conditional jump based on the Zero flag.

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

What does the JG instruction do?

A

Jump if greater (signed comparison)

JG checks if the left operand is greater than the right for signed values.

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

What does the JA instruction do?

A

Jump if above (unsigned comparison)

JA is used for unsigned comparisons to check if the first operand is greater.

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

What is the purpose of the JNL instruction?

A

Jump if not less

JNL checks if the left operand is greater than or equal to the right.

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

What is the purpose of the JL instruction?

A

Jump if less

JL checks if the left operand is less than the right.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What instruction is used to compare signed values in assembly?
CMP
26
What does the instruction 'JG' do?
Jump if greater (signed)
27
What does the instruction 'JA' do?
Jump if above (unsigned)
28
What condition must be met for 'JLE' to transfer control?
EAX is less than or equal to Val1 (signed)
29
What condition must be met for 'JBE' to transfer control?
EAX is below or equal to Val1 (unsigned)
30
What does the instruction 'JZ' check for?
Jump if zero (ZF = 1)
31
What does 'JAE' stand for?
Jump if above or equal (unsigned)
32
In the context of conditional jumps, what does 'JE' mean?
Jump if equal
33
What do the instructions 'LOOPZ' and 'LOOPE' have in common?
They both loop if zero (ZF = 1)
34
What is the purpose of the 'LOOPNZ' instruction?
Loop if not zero (ZF = 0)
35
What is the function of the 'CMP' instruction?
Compare two values
36
Fill in the blank: The instruction '______' is used to compare two unsigned values.
CMP
37
What is a key characteristic of the 'JNE' instruction?
Jump if not equal
38
What does the instruction 'TEST' do?
Logical AND operation with setting flags
39
True or False: The 'CMP' instruction can only compare signed integers.
False
40
What is the purpose of the XOR instruction in the encryption example?
To transform every character in a string into a new value
41
What is required for a 'WHILE' loop to execute?
The loop condition must be true
42
What does 'JA' check for in conditional structures?
Jump if op1 > op2 (unsigned)
43
What is the syntax for the 'LOOPZ' instruction?
LOOPZ destination
44
What is the result of using 'XOR' for encryption?
Encrypts a message by transforming its characters
45
What does 'JAE' check for?
Jump if op1 >= op2 (unsigned)
46
What happens if the condition for 'JNG' is not met?
The jump is not taken
47
What is the effect of the 'MOV' instruction?
Copies data from one location to another
48
What kind of values do the instructions 'JBE' and 'JAE' deal with?
Unsigned values
49
What is the purpose of the 'CMP' instruction in the lottery example?
To check if the user's number matches any winning number
50
What does the 'JGE' instruction check?
Jump if greater or equal (signed)
51
What does 'JNL' do?
Jump if not less (signed)
52
What is the significance of the Zero flag (ZF)?
Indicates whether the last operation resulted in zero
53
True or False: 'LOOP' decrements the ECX register.
True
54
What does the instruction 'JAE' do?
Jump if above or equal (unsigned)
55
Fill in the blank: The '______' instruction is used to check for even parity.
TEST
56
What does 'JLE' check for?
Jump if less than or equal (signed)
57
What is a common use for the 'CMP' instruction?
To compare two operands before a conditional jump
58
What is a finite-state machine (FSM)?
A graph structure that changes state based on some input ## Footnote Also called a state-transition diagram
59
What are the components of a graph representing an FSM?
Nodes and edges ## Footnote Nodes are squares or circles, edges are lines with arrows between the circles
60
What is a directed graph in relation to FSM?
A more general structure of which FSM is a specific instance
61
What are the three basic states represented by nodes in an FSM?
* Start state * Terminal state(s) * Nonterminal state(s)
62
What does an FSM accept?
Any sequence of symbols that puts it into an accepting (final) state
63
What can an FSM be used to recognize?
A sequence of characters governed by language rules (called a regular expression)
64
What are the advantages of using a finite-state machine?
* Provides visual tracking of program's flow of control * Easy to modify * Easily implemented in assembly language
65
What does JE stand for in assembly language?
Jump if equal
66
What does JZ indicate in assembly language?
Jump if zero flag = 1
67
What are some high-level conditional control flow directives in MASM?
* JE * JNE * JC * JZ * JNC * JP * JG * JL * JNG * JA * JB * JNA
68
What is the purpose of CMP in assembly language?
Compares operands using implied subtraction and sets condition flags
69
What are bitwise instructions used for?
Manipulating individual bits in operands ## Footnote Examples include AND, OR, XOR, NOT, TEST
70
What is the function of conditional jumps in assembly?
Control the flow of execution based on the evaluation of conditions
71
Fill in the blank: The flowchart is a ______ tool.
logic diagramming
72
True or False: High-level conditional control flow directives in MASM can be used in 64-bit mode.
False
73
What does LOOPZ do in assembly language?
Loops while zero flag is set
74
What does LOOPNZ do in assembly language?
Loops while zero flag is not set
75
What does the instruction call DisplayErrorMsg do?
Displays an error message for invalid input found
76
What is the purpose of a state-transition diagram?
To visually represent the state changes in a finite-state machine
77
What is the significance of the leading + or - sign in the FSM for signed integers?
Indicates whether the integer is positive or negative