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