Ch-6 Decision Control Structure (Java)
Ch-6 Decision Control Structure (Java)
SUBJECT – COMPUTER
CHAPTER – 6 , Decision Control structure
a. If the condition mentioned with if-else is not true the control will move to else part and execute
the statements inside it without executing the statements inside the IF part.
b. If there will be no curly braces { } after If Condition then by default if statement considers the
immediate one statement to be associated with ‘if’
c. We will enclose the block of statements to be get executed within the curly braces ‘{}’ symbol.
d. In IF – ELSE –IF statement when there are multiple options given from which a decision has to be
made. These statements are executed from the top to down. As soon as one of the conditions
given with ‘If’ is true, the statements associated with ‘If’ are executed, and the rest of the ladder
is bypassed. If none of the conditions is true, then the final ‘else’ statement is executed.
e. In a ‘Switch Statement’ if the value of expression matches with the constant then the control
will move to the matching constant case define within the SWITCH and execute the block of
statements mention under it.
f. Break statement will exit the SWITCH statement by moving the control of execution to the
closing curly braces of SWITCH.
g. The statements which are repeating/executing number of time until the condition becomes
false is called Iteration statement.
h. Only one time
i. Jump statements transfer control to other parts of the program, break and continue are jump
statements in Java like Break, continue.
j. Selection is used for making decisions and branching statements where as Repetition is used for
executing the statements number of times until the condition becomes False.
k. If none of the case mentioned inside the Switch matches with the given constant then the
default case will get executed.
a. Output: 7
8
9
b. Output: 8
c. Output: 7
6
d. Output: 8
9
e. Output: 7
6
5
4
3
2
1
0
-1 (will go infinite) called non terminating loop.
f. Output: 7
9
g. No Output as the condition becomes false. (0>=7)
h. No Output as the condition becomes false. (7<0)
i. No Output as the condition becomes false. (1>=20)
Answer 8: The while loop will get executed only SIX(6) times therefore it have 6 iteration.
Answer 9:-If statement is a decision statement. It is used to decide whether a certain statement or block
of statement will be executed or not. If a certain condition is true, then a statement or block of
statements is executed otherwise not/ move to else part.
If statement
If- Else statement
If-else-If statement
Switch statements
Write the syntax of all the above statements from page no. 98,99,101,103