Page 213 - Computer science 868 Class 12
P. 213
Let’s Revisit
♦ Three categories of Java statements are - Declaration statements, Expression statements and Control flow statements.
♦ There are four types of Control flow statements. They are: Sequential, Conditional, Iiterative and Jump statements.
♦ Conditional statements are of two types. They are: if statements and switch statements.
♦ If statements are of five types. They are: Simple if statements, if-else statement, if and only if statement, if- else if statement
and nested if statement.
♦ Ternary Operator is a one lineone-line expression of if- else in Java. Same as if-else, it evaluates the condition to be tested and
depending on the result of the condition, it executes a block of code.
♦ Switch case is also known as multiple-branch selection statement.
♦ In switch case when the control moves from one case to another in the absence of “break” statement, it is known as Fall
Through.
♦ Break can also terminate the loop.
♦ There are three types of loop in Java. They are: for, while and do while.
♦ Every loop has four parts. They are: starting value/initialisation, Test condition, Increment or decrement also known as step
value and Body of the loop.
♦ Different categories of loops Delay Loop, Null Loop/Bodyless Loop, Infinite Loop/Endless Loop, Finite Loop, Nested Loop,
Fixed Iteration Loop and Unfixed Iteration Loop.
♦ Jump Statements are used to transfer the execution control of the program from one part to another part.
♦ There are three types of Jump statements. They are: break, continue and return.
MIND DRILL
Solved Questions
A. Tick ( ) the correct option:
1. int a=40; it is an example of
a. Declaration statement b. Expression statement
c. Control flow statement d. None of these
2. Which statements normally executes sequentially from top to bottom in the order that the code appears?
a. Conditional statements b. Sequential statements
c. Simple if statements d. Jump statements
3. ………………… is a one-line expression of if-else in Java.
a. Unary Operator b. Binary Operator
c. Ternary Operator d. None of these
4. String result;
if(marks>40)
result= "pass";
else
result= "fail";
The above code is converted to Ternary Operator as
a. String result = (marks > 40)? "pass" : "fail";
b. String result = (marks > 40)? "fail" : "pass";
c. String result = (marks >= 40)? "pass" : "fail";
d. String result = (marks < 40)? "pass" : "fail";
5. The Java ………………… executes one statement from multiple conditions.
a. switch statement b. multiple-branch selection statement
c. Both a and b d. None of these
211
Statements and Scope 211

