🧪 Java MCQ Quiz Hub

Java Mcq Question Set 2

Choose a topic to test your knowledge and improve your Java skills

1. Which is the predefined package




2. Java intermediate code is known as




3. Which command is used for interpretation of java program




4. What is meaning of jar




5. Which of the following command is used to compile the Java program




6. What do you mean by javap




7. What is jdb




8. Java is known as _______stage language




9. Which driver is called as thin-driver in JDBC




10. How many transaction isolation levels are defined in java.sql.Connection interface




11. Which method of java is invoked by JVM to reclaim the inaccessible memory location




12. ____ allows java code to run in the JVM to call and be called by native applications




13. Interfaces helps in which type of inheritance




14. Which method of the Applet class displays the result of applet code on screen




15. Which command disassembles a class file




16. In which we clone the object and their constituent parts




17. Which driver is efficient and always preferable for using JDBC applications




18. Executable applet is




19. Which keyword is used while using interface




20. Which keyword represents object of the present class




21. Hot java is




22. javah stands for




23. Main method parameter has which type of data type




24. How many keywords are available in java




25. Smallest individual unit in java program is known as




26. Suppose a class has public visibility. In this class we define a protected method. Which of the following statements is correct?




27. The object is created with "new" keyword




28. ate regarding the following classes? class A{private int i; protected int j; } class B extends A{ private int k; protected int m; }




29. A package is a collection of




30. A method within a class is only accessible by classes that are defined within the same package as the class of the method. Which one of the following is used to enforce such restriction?




31. Choose the correct statement public class Circle{ private double radius; public Circle(double radius){ radius = radius; } }




32. Choose the correct statement : Restriction on static methods are-




33. Name the keyword that makes a variable belong to a class, rather than being defined for each instance of the class.




34. In Java arrays are




35. Which one of the following is a valid statement?




36. What is the result of compiling and running the following code? public class Test{ public static void main(String[] args){ int[] a = new int[0]; System.out.print(a.length); } }




37. What is output of the following code: public class Test{public static void main(String[] args){ int[] x = {120, 200, 016 }; for(int i = 0; i < x.length; i++)System.out.print(x[i] + " "); } }




38. What will be the output? public class Test{ public static void main(String[] arg{ int[] a = new int[4]; a[1] = 1; a = new int[2]; System.out.println("a[1] is " + a[1]); } }




39. When you pass an array to a method, the method receives ________ .




40. Which will legally declare, construct, and initialize an array?




41. What is the value of a[1] after the following code is executed? int[] a = {0, 2, 4, 1, 3}; for(int i = 0; i < a.length; i++) a[i] = a[(a[i] + 3) % a.length];




42. The output of the following fraction of code is public class Test{ public static void main(String args[]){ String s1 = new String("Hello"); String s2 = new String("Hellow"); System.out.printl




43. Output : public class Test{ public static void main(String args[]){ String x = "hellow"; int y = 9; System.out.println(x += y); } }




44. toString() method is defined in




45. The String method compareTo() returns




46. What will be the output? String str1 = "abcde"; System.out.println(str1.substring(1, 3));