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