Computer Science - Object Oriented Programming Using C++ - Discussion

Discussion Forum : Object Oriented Programming Using C++ - Section 1 (Q.No. 5)
5.
The use of the break statement in a switch statement is
optional
compulsory
not allowed. It gives an error message
to check an error
None of the above
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
26 comments Page 2 of 3.

K.lalitha said:   1 decade ago
In some cases it is optional and in some cases it is compulsory. If we use break statement where the condition is true then the next conditions will not execute.

Rahma said:   1 decade ago
I think if we do not use a break statement the code will be executed and compiler not gives error but the output will never be understandable by the user.

Soujanya said:   1 decade ago
I think it is compulsory because if we use break statement we will get proper output otherwise all the statements get executed.

Qamar said:   1 decade ago
Its optional in the sense that it is allowed in the language to skip break statement and compiler will not raise an error.

SIRAGIRI said:   10 years ago
In case if one needs to exit from the current case break statement is compulsory if not it is optional.

Arjita said:   7 years ago
Break statement is to stop the case so it is not compulsary we can use something else to end the case.

Mebrie said:   6 years ago
If we don't use break in each condition then give output all result print when execute the program.

Manisha said:   1 decade ago
Actually it's compulsory for proper output if we not written it then we not got proper output.

Sonu said:   1 decade ago
If you not write it, it will ok, but all statements from other cases also get executed.

Diana said:   1 decade ago
If break is optional, then what is the purpose of using a switch statement?


Post your comments here:

Your comments will be displayed after verification.