Multiple Choice Questions
![]() Share with a Friend |
public class Test{
public static void main(String args[]){
int i = 1;
do{
i--;
}while(i > 2);
System.out.println(i);
}
}
A). 1
int i = 10;
while(i++ <= 10){
i++;
}
System.out.print(i);
A). 10
public class Test{
public static void main(String... args) throws Exception{
Integer i = 34;
int l = 34;
if(i.equals(l)){
System.out.println("true");
}else{
System.out.println("false");
}
}
}
A). true
1. public class Test{
2. public static void main(String [] args){
3. int x = 0;
4. // insert code here
5. do{ } while(x++ < y);
6. System.out.println(x);
7. }
8. }
24. Which option, inserted at line 4, produces the output 12?
1. int i = 10;
2. while(i++ <= 10){
3. i++;
4. }
5. System.out.print(i);
A). Line 5 will be never reached.