Program Control Structures: Conditional Control Structures Flashcards

1
Q

Whether the indentation exists or not, the compiler will, by default, associate an else with the closest previous unpaired if.

A

True

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

Break statements are used when you want your program flow to come out of the switch body.

A

True

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

The default case can be used for performing a task when none of the cases is true.

A

True

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

If no break appears, the flow of control will fall through to subsequent cases until a break is reached.

A

True

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

In switch, if there is a match, the associated block of code is executed

A

True

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

A break can save a lot of execution time because it “ignores” the execution of all the rest of the code in the switch block.

A

True

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

Which of the following must be present in the switch construct?

A

expression in () after switch

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

If no break appears, the flow of control will fall through to subsequent cases until a break is reached

A

True

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

To make the multiple statements become a compound statement, enclosed the statements with brackets [].

A

False curly brackets is the right answer.

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

The constant-expression for a case may be a floating point number.

A

False

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

In switch, the value of the expression is compared with the values of each case.

A

True

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

Whenever a break statement is encountered in the switch body, the execution flow would directly come out of the switch, ignoring rest of the cases

A

True

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

Each case is followed by the value to be compared to and a semicolon.

A

True

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

The break statement causes an exit ________.

A

Innermost loop or switch

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

Nested switch statements should be avoided as it makes program more complex and less readable.

A

True

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

When you have the default keyword in your switch, you are required to place a break statement.

A

False

17
Q

As soon as a true condition is found, the statement associated with it is executed, and the rest of the ladder is bypassed.

A

True

18
Q

the program is wrong when in switch statement it uses string

A
19
Q

List of Program Control Structures:

A
  1. Sequential
  2. Selection
  3. Repetition
  4. Invocation
20
Q

The normal flow of control for all programs is

A

Sequential

21
Q

is used to select which statements are
performed next based on a condition

A

Selection

22
Q

is used to repeat a set of statements

A

Repetition