Which of this statement is incorrect?
a) switch statement is more efficient than a set of nested ifs
b) two case constants in the same switch can have identical values
c) switch statement can only test for equality, whereas if statement can
evaluate any type of boolean expression
d) it is possible to create a nested switch statements
Answers
Answered by
0
Answer:
c is incorrect
Explanation:
a switch stament can use all logical expressions
Answered by
0
In the Switch statement, two case constants in the same switch can have identical values is incorrect
Switch statement
- A switch statement allows a variable to be compared against a list of values for equality.
- The switch expression must be of an integer or character type and the case value must be an integer or character constant.
- The switch statement allows us to execute multiple operations for the different possible values of a single variable, which is cumbersome in nested ifs.
- It is permissible to nest switch statements.
However, no two constant-expression values within the same switch statement can have the same value.
Similar questions