Test your understanding of Java basics and find the output with this MCQ practice set 3 1. What is the output? System.out.println(10 + 20 + “Java”); 30Java Java30 Error 1020Java None 2. What is the output? class A{int x=5;}class Main{public static void main(String[] args){A obj1=new A();A obj2=obj1;obj2.x=10;System.out.println(obj1.x);}} 10 null Error 5 None 3. What is the output? System.out.println(5 + 2 * 3); 15 16 11 21 None 4. What is the output? System.out.println(10 / 3); 4 3.33 3 error None 5. What is the output? int x = 5;System.out.println(x++ + ++x); 14 13 12 11 None 6. What is the output? class A{void show(){ System.out.print(“A”); }}class Main{public static void main(String[] args){A obj=new A();obj.show();}} Error 0 null A None 7. What is the output? String s=“Java”;System.out.println(s.length()); 4 error 3 5 None 8. What is the output? class A{void show(){ System.out.print(“A”); }}class B extends A{void show(){ System.out.print(“B”); }}class Main{public static void main(String[] args){A obj=new B();obj.show();}} B AB A ERROR None 9. What is the output? class A{A(){ System.out.print(“Constructor”); }}class Main{public static void main(String[] args){A obj=new A();}} Constructor Error Nothing null None 10. What is the output? int x = 10;System.out.println(x– + –x); 19 18 17 20 None 11. What is the output? int x=2;switch(x){case 1: System.out.print(“A”); break;case 2: System.out.print(“B”); break;case 3: System.out.print(“C”);} ERROR C B BC None 12. What is the output? for(int i=1;i<=3;i++){if(i==2) break;System.out.print(i);} 12 1 23 123 None 13. What is the output? int x=2;switch(x){case 1: System.out.print(“A”);case 2: System.out.print(“B”);case 3: System.out.print(“C”);} B ABC BC C None 14. What is the output? int arr[]=new int[]{1,2,3};System.out.println(arr[1]); 3 1 2 error None 15. What is the output? String s=“Java”;System.out.println(s.equalsIgnoreCase(“java”)); Error false true 0 None 16. What is the output? int x = 3;System.out.println(++x * 2); 6 10 8 12 None 17. What is the output? int x = 4;System.out.println(x++ * 2); 10 8 16 12 None 18. What is the output? System.out.println(“Java” + “10″ + “20″); Java30 30Java Java1020 Error None 19. What is the output? int i=1;while(i<=3){System.out.print(i);i++;} 012 123 321 error None 20. What is the output? int a = 10;System.out.println(a += 5 * 2); 30 25 20 15 None Time’s up