MCQs
None.
There are four types of loop. They are while, do while, nested, for loop.
for loop with a semicolon is called as body less for loop. It is used only for incrementing the
variable values. So in this program the value is incremented and printed as 10.
Output:
$ g++ stat2.cpp
$ a.out
10
There is not a condition in the for loop, So it will loop continuously.
Because the break statement need to be presented inside a loop or a switch statement.
None.
The switch statement is used to choose the certain code to execute, So it is also called as
selective structure.
Inthis program, We are printing the numbers in reverse order but by using break statement we
stopped printing on 3.
Output:
$ g++ stat.cpp
$ a.out
543
In the conditional operator,it will predicate the output using the given condition.
There are five sequence of statements. They are Preprocessor directives,Comments,Declarations,
Function Declarations,Executable statements.