Hsslive-7 Control Statements
Hsslive-7 Control Statements
If .. else if switch
Any relational condition Only quality condition
can be checked can be checked.
else block is executed if default block is executed
all conditions are false if all cases are false
2
Write the syntax of switch statement ?
switch (expression)
{
case constant 1: statement block 1;
break;
case constant 2: statement block 2;
break;
.
.
default : statement block n;
}
3
Differentiate between entry-controlled loop and
exit controlled loop.
4
Write the syntax of while loop. ?
initialisation ;
while(condition)
{
body of the loop;
updation;
}
5
Write the syntax of for loop. ?
6
List the four components of a loop statements.
1. Initialisation
2. Condition
3. loop body
4. Updation
7
There are three looping statements in c++.?
a) Which is the exit – controlled loop ?
b) How does it differ from an entry controlled loop?
Answer :
a) do while
b) In exit – controlled loop, the conditon is evaluated only after
executing body of the loop.