Decision Structures and Boolean Logic Flashcards

1
Q

What is another term for a decision structure?

A

Selection structure.

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

What is the role of conditionals in decision structures?

A

They control which statements are executed based on whether a condition is true or false.

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

How are decision structures combined in logical design?

A

They are used alongside sequence structures.

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

What keywords are used in pseudocode for a simple decision structure?

A

If-Then, End If.

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

What is a Boolean expression?

A

An expression that evaluates to either true or false.

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

Who introduced Boolean logic, and when?

A

George Boole in the 1800s.

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

What does the relational operator > indicate?

A

Greater than.

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

What does the relational operator <= mean?

A

Less than or equal to.

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

What is the difference between = and == in programming?

A

= is an assignment operator, while == checks for equality.

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

What does the != operator represent?

A

Not equal to.

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

How do dual alternative decision structures operate?

A

By executing different groups of statements depending on whether the Boolean expression is true or false.

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

What pseudocode structure represents dual alternative decisions?

A

If-Then-Else.

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

How are strings compared in programming?

A

By evaluating their character codes (e.g., ASCII codes) one by one.

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

What is a nested decision structure?

A

A decision structure placed inside another decision structure.

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

Why is the If-Then-Else If structure preferred over nested decision structures?

A

It is simpler to read.

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

What is a Case structure used for?

A

To determine program execution paths based on specific values or expressions.

17
Q

How does the AND operator work in Boolean logic?

A

It returns true only if both subexpressions are true.

18
Q

When does the OR operator return false?

A

When both subexpressions are false.

19
Q

What does the NOT operator do?

A

Reverses the logical value of an expression.

20
Q

How can logical operators check if a number is within a range?

A

Use the AND operator: If x >= low AND x <= high Then

21
Q

What does short-circuit evaluation mean in Boolean logic?

A

Evaluating a compound expression by stopping as soon as the outcome is determined.

22
Q

In short-circuit evaluation, which subexpression should come first with the AND operator?

A

The one most likely to be false.

23
Q

What is a Boolean variable?

A

A variable that can hold either true or false.

24
Q

How can logical operators check if a value is outside a range?

A

Use the OR operator: If x < low OR x > high Then