Page 212 - Cs_withBlue_J_C11_Flipbook
P. 212
{
c=a++ + ++b;
System.out.println(c);
}
The output is ………………… .
4. Convert to ternary operator:
if(basic_sal>=2000)
tax= 5.0/100.0*basic_sal;
else
tax= 2.5/100.0*basic_sal;
The ternary format is : …………………
5. When an 'if statement' is placed inside another 'if statement', then it is known as ………………… .
6. ………………… is a multiple-branch selection statement.
7. The flow of control is ………………… i.e. depending on the choice in switch case.
8. In do while loop, if the condition does not satisfy the loop will execute ………………… .
9. ………………… is required to send the control to the next iteration of the loop.
10. ………………… function is used to find the square root of a number.
11. ………………… function finds the smallest integer value greater than the number that is provided in the argument.
12. Math.rint() function returns the nearest value of the fractional number in ………………… .
13. Math.floor(-20.4) will return ………………… .
14. If the method does not return any value, we have to use the keyword ………………… .
15. A ………………… loop is used to increase the time of execution of the program.
C. Answer the following questions:
1. Convert the following if-else-if construct into a switch case:
if(ch == 1)
System.out.println("One");
else if(ch == 2)
System.out.println("Two");
else if(ch == 3)
System.out.println("Three");
else
System.out.println("Wrong Choice");
2. Find the output of the following code snippet:
int ch=1;
switch(ch)
{
case 1: System.out.println("Science stream");
case 2: System.out.println("With Computer ");
break;
case 3: System.out.println("With Biology");
}
3. What is wrong in the following program? Find any two errors and explain.
switch (ch)
{
case 3:
int a= 42, b = 35;
int c= a*b;
210210 Touchpad Computer Science-XI

