Decision Structures and Boolean Logic Flashcards

1
Q

What is a selection structure?

A

A selection structure controls statement execution based on conditions.

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

What determines the execution flow in decision structures?

A

True/False evaluation.

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

What is the role of conditionals in decision structures?

A

Conditionals execute statements only if conditions are met.

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

How do decision structures combine with sequence structures?

A

Decision structures are used alongside sequence structures to control execution flow.

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

What is the basic structure of an If-Then statement in pseudocode?

A

An If-Then structure contains a condition and associated statements, ending with “End If”.

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

What are Boolean expressions used for?

A

Boolean expressions evaluate to true or false.

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

What do relational operators do?

A

Relational operators compare two values.

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

What relational operator is used for equality comparison?

A

== is used for equality comparison.

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

What is the purpose of the If-Then-Else structure?

A

It executes one block if true and another if false.

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

How are strings compared in decision structures?

A

Strings are compared using ASCII codes, character by character.

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

What are nested decision structures?

A

They are decisions inside another decision, testing multiple conditions.

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

What is the advantage of using an If-Then-Else If structure?

A

It improves readability over nested If-Then structures.

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

What is the case structure in decision making?

A

A switch-like structure where the execution path depends on a matching value or expression.

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

What does the AND logical operator require in a compound expression?

A

Both conditions must be true.

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

What is short-circuit evaluation in logical operators?

A

It optimizes performance by evaluating the most likely condition first.

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

How do you check if a value is inside a range using logical operators?

A

Use AND to check if a value is within a range, e.g., If x >= 20 AND x <= 40.

17
Q

How do you check if a value is outside a range using logical operators?

A

Use OR to check if a value is outside a range, e.g., If x < 20 OR x > 40.

18
Q

What are Boolean variables used for?

A

Boolean variables hold true/false values and are used as flags to track conditions.

19
Q

How do you set a Boolean variable based on a condition?

A

Set a Boolean variable to True or False based on the condition, e.g., Set salesQuotaMet = True.