Question 1
Question text
State True or False
When using eclipse whichever classes are needed for the present class can be imported automatically.
Feedback
Question 2
Question text
switch(a)
{
default:
System.out.println("Welcome");
}
Of which data types can the variable ‘a’ be?
1. long
2. byte
3. int
4. char
5. float
6. short
Feedback
The variable used in a switch statement can be a byte, short, int, char or String type only.
Question 3
Question text
Predict the output.
public class Test {
public static void main(String args[])
{
int a = 2, b = 0;
for ( ; b < 20; ++b) {
if (b % a == 0)
continue;
else if (b == 10)
break;
else
System.out.print(b + " ");
}
}
}
Feedback
Whenever b is even the first if statement is true so continue statement gets executed. Hence when b is odd and less than 20, it gets printed.
Question 4
Question text
What will be the output of the following code?
int i=20;
if(i>10)
{
System.out.println( "The value of i is "+i);
i++;
if(i%2!=0)
break;
}
Feedback
Question 5
Question text
In Eclipse IDE, if we provide a workspace, it should already exist. If not, it will not open.
Comments
Post a Comment