conditionals-3 Flashcards

1
Q

What is the primary use case for switches?

A

to select one of many code blocks to be executed

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

Does the default case have to be at the bottom of the switch statement?

A

A “default” section is optional. A “default” may appear anywhere in the switch but is usually placed at the bottom.

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

What happens if there is no break statement between cases?

A

If we do not use break statement at the end of each case, program will execute all consecutive case statements until it finds next break statement or till the end of switch case block.

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