Conditional Flow of Control
1 When is if else more advantageous then switch case.
2. Write a java code to find if the given year is a leap year (input in 4 digits)
3. What is the use of break statement.
4. What is the free flow construct.
5. What is a jump statement ? explain the three jump statements ?
6. What is the output of the following code if a =3, a=5
switch (a)
{
case 1:
System.out.println("One");
break;
case 2:
System.out.println("Two");
break;
case 3:
System.out.println("Three");
break;
case 4:
System.out.println("Four");
break;
case 5:
System.out.println("Five");
break;
case 6:
System.out.println("Six");
case 7:
System.out.println("Seven");
break;
default:
System.out.println("Error");
break }
7 Rewrite the following code using conditional operator. (_?_:_)
3. What is the use of break statement.
4. What is the free flow construct.
5. What is a jump statement ? explain the three jump statements ?
6. What is the output of the following code if a =3, a=5
switch (a)
{
case 1:
System.out.println("One");
break;
case 2:
System.out.println("Two");
break;
case 3:
System.out.println("Three");
break;
case 4:
System.out.println("Four");
break;
case 5:
System.out.println("Five");
break;
case 6:
System.out.println("Six");
case 7:
System.out.println("Seven");
break;
default:
System.out.println("Error");
break }
7 Rewrite the following code using conditional operator. (_?_:_)
if(Total>=50)
Show=’Y’;
else
Show=’N’;
Iterative Flow of Control
1.
Loop to print the sum of following series
1+1/4+1/7+1/10+1/13+1/16+1/19+1/22+1/25
2.
Loop to print the factorial of a given number
3.
Loop to display 10 star in a row
4. What is the use of Continue statement
5. What is the difference between do while and while loop.
6. Write the code to print the natural numbers between 10 to 100
7. Write the code to print the odd numbers between 10 to 100
8. Write the code to print the even numbers between 10 to 100
9. Give the output of the following code
int m =100;
while(m>0)
{
if(m<10)
break;
m=m-10;
}
System.out.println("m is "+m);
10. What is the meaning of infinite loop
11. What is a nested looping
12.
9. Give the output of the following code
int m =100;
while(m>0)
{
if(m<10)
break;
m=m-10;
}
System.out.println("m is "+m);
10. What is the meaning of infinite loop
11. What is a nested looping
12.
13. Identify the invalid names out of the following. State the
reasons if invalid
(i)
do
(ii)
des_01
(iii)
item
(iv) _product
Java Swing Controls
1. How many types of java swing controls are there in java
2. What is a container control
3. What is the difference between jCombo and jList
4. What is the difference between jText and jPassword
5. How many types of operators are there in java
6 User want to display the jTextField1 with 10% more value of amount in float type
7
6 User want to display the jTextField1 with 10% more value of amount in float type
7
No comments:
Post a Comment