adplus-dvertising
frame-decoration

Question

Which of the following statements are correct?

1. A switch statement can act on numerical as well as Boolean types.
2. A switch statement can act on characters, strings and enumerations types.
3. We cannot declare variables within a case statement if it is not enclosed by { }.
4. The foreach statement is used to iterate through the collection to get the desired information and should be used to change the contents of the collection to avoid unpredictable side effects.
5. All of the expressions of the for statement are not optional.

a.

1, 2

b.

2, 3

c.

3, 5

d.

4, 5

Answer: (a).1, 2

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Which of the following statements are correct? 1. A switch statement can act on numerical as well as Boolean types. 2. A switch statement can act on characters, strings...