Chapter 6 - Conditional Processing Flashcards

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
Q

What instruction is used to compare signed values in assembly?

A

CMP

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

What does the instruction ‘JG’ do?

A

Jump if greater (signed)

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

What does the instruction ‘JA’ do?

A

Jump if above (unsigned)

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

What condition must be met for ‘JLE’ to transfer control?

A

EAX is less than or equal to Val1 (signed)

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

What condition must be met for ‘JBE’ to transfer control?

A

EAX is below or equal to Val1 (unsigned)

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

What does the instruction ‘JZ’ check for?

A

Jump if zero (ZF = 1)

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

What does ‘JAE’ stand for?

A

Jump if above or equal (unsigned)

32
Q

In the context of conditional jumps, what does ‘JE’ mean?

A

Jump if equal

33
Q

What do the instructions ‘LOOPZ’ and ‘LOOPE’ have in common?

A

They both loop if zero (ZF = 1)

34
Q

What is the purpose of the ‘LOOPNZ’ instruction?

A

Loop if not zero (ZF = 0)

35
Q

What is the function of the ‘CMP’ instruction?

A

Compare two values

36
Q

Fill in the blank: The instruction ‘______’ is used to compare two unsigned values.

37
Q

What is a key characteristic of the ‘JNE’ instruction?

A

Jump if not equal

38
Q

What does the instruction ‘TEST’ do?

A

Logical AND operation with setting flags

39
Q

True or False: The ‘CMP’ instruction can only compare signed integers.

40
Q

What is the purpose of the XOR instruction in the encryption example?

A

To transform every character in a string into a new value

41
Q

What is required for a ‘WHILE’ loop to execute?

A

The loop condition must be true

42
Q

What does ‘JA’ check for in conditional structures?

A

Jump if op1 > op2 (unsigned)

43
Q

What is the syntax for the ‘LOOPZ’ instruction?

A

LOOPZ destination

44
Q

What is the result of using ‘XOR’ for encryption?

A

Encrypts a message by transforming its characters

45
Q

What does ‘JAE’ check for?

A

Jump if op1 >= op2 (unsigned)

46
Q

What happens if the condition for ‘JNG’ is not met?

A

The jump is not taken

47
Q

What is the effect of the ‘MOV’ instruction?

A

Copies data from one location to another

48
Q

What kind of values do the instructions ‘JBE’ and ‘JAE’ deal with?

A

Unsigned values

49
Q

What is the purpose of the ‘CMP’ instruction in the lottery example?

A

To check if the user’s number matches any winning number

50
Q

What does the ‘JGE’ instruction check?

A

Jump if greater or equal (signed)

51
Q

What does ‘JNL’ do?

A

Jump if not less (signed)

52
Q

What is the significance of the Zero flag (ZF)?

A

Indicates whether the last operation resulted in zero

53
Q

True or False: ‘LOOP’ decrements the ECX register.

54
Q

What does the instruction ‘JAE’ do?

A

Jump if above or equal (unsigned)

55
Q

Fill in the blank: The ‘______’ instruction is used to check for even parity.

56
Q

What does ‘JLE’ check for?

A

Jump if less than or equal (signed)

57
Q

What is a common use for the ‘CMP’ instruction?

A

To compare two operands before a conditional jump

58
Q

What is a finite-state machine (FSM)?

A

A graph structure that changes state based on some input

Also called a state-transition diagram

59
Q

What are the components of a graph representing an FSM?

A

Nodes and edges

Nodes are squares or circles, edges are lines with arrows between the circles

60
Q

What is a directed graph in relation to FSM?

A

A more general structure of which FSM is a specific instance

61
Q

What are the three basic states represented by nodes in an FSM?

A
  • Start state
  • Terminal state(s)
  • Nonterminal state(s)
62
Q

What does an FSM accept?

A

Any sequence of symbols that puts it into an accepting (final) state

63
Q

What can an FSM be used to recognize?

A

A sequence of characters governed by language rules (called a regular expression)

64
Q

What are the advantages of using a finite-state machine?

A
  • Provides visual tracking of program’s flow of control
  • Easy to modify
  • Easily implemented in assembly language
65
Q

What does JE stand for in assembly language?

A

Jump if equal

66
Q

What does JZ indicate in assembly language?

A

Jump if zero flag = 1

67
Q

What are some high-level conditional control flow directives in MASM?

A
  • JE
  • JNE
  • JC
  • JZ
  • JNC
  • JP
  • JG
  • JL
  • JNG
  • JA
  • JB
  • JNA
68
Q

What is the purpose of CMP in assembly language?

A

Compares operands using implied subtraction and sets condition flags

69
Q

What are bitwise instructions used for?

A

Manipulating individual bits in operands

Examples include AND, OR, XOR, NOT, TEST

70
Q

What is the function of conditional jumps in assembly?

A

Control the flow of execution based on the evaluation of conditions

71
Q

Fill in the blank: The flowchart is a ______ tool.

A

logic diagramming

72
Q

True or False: High-level conditional control flow directives in MASM can be used in 64-bit mode.

73
Q

What does LOOPZ do in assembly language?

A

Loops while zero flag is set

74
Q

What does LOOPNZ do in assembly language?

A

Loops while zero flag is not set

75
Q

What does the instruction call DisplayErrorMsg do?

A

Displays an error message for invalid input found

76
Q

What is the purpose of a state-transition diagram?

A

To visually represent the state changes in a finite-state machine

77
Q

What is the significance of the leading + or - sign in the FSM for signed integers?

A

Indicates whether the integer is positive or negative