๐Ÿงช Java MCQ Quiz Hub

Java Mcq Question Set 2

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

Which is the predefined package





โœ… Correct Answer: 1

Java intermediate code is known as





โœ… Correct Answer: 1

Which command is used for interpretation of java program





โœ… Correct Answer: 1

What is meaning of jar





โœ… Correct Answer: 3

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





โœ… Correct Answer: 2

What do you mean by javap





โœ… Correct Answer: 4

What is jdb





โœ… Correct Answer: 4

Java is known as _______stage language





โœ… Correct Answer: 2

Which driver is called as thin-driver in JDBC





โœ… Correct Answer: 4

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





โœ… Correct Answer: 3

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





โœ… Correct Answer: 2

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





โœ… Correct Answer: 1

Interfaces helps in which type of inheritance





โœ… Correct Answer: 1

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





โœ… Correct Answer: 1

Which command disassembles a class file





โœ… Correct Answer: 3

In which we clone the object and their constituent parts





โœ… Correct Answer: 1

Which driver is efficient and always preferable for using JDBC applications





โœ… Correct Answer: 4

Executable applet is





โœ… Correct Answer: 1

Which keyword is used while using interface





โœ… Correct Answer: 4

Which keyword represents object of the present class





โœ… Correct Answer: 1

Hot java is





โœ… Correct Answer: 1

javah stands for





โœ… Correct Answer: 2

Main method parameter has which type of data type





โœ… Correct Answer: 3

How many keywords are available in java





โœ… Correct Answer: 2

Smallest individual unit in java program is known as





โœ… Correct Answer: 1

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





โœ… Correct Answer: 4

The object is created with "new" keyword





โœ… Correct Answer: 2

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





โœ… Correct Answer: 1

A package is a collection of





โœ… Correct Answer: 1

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?





โœ… Correct Answer: 3

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





โœ… Correct Answer: 4

Choose the correct statement : Restriction on static methods are-





โœ… Correct Answer: 4

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





โœ… Correct Answer: 2

In Java arrays are





โœ… Correct Answer: 1

Which one of the following is a valid statement?





โœ… Correct Answer: 3

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); } }





โœ… Correct Answer: 1

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] + " "); } }





โœ… Correct Answer: 2

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]); } }





โœ… Correct Answer: 1

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





โœ… Correct Answer: 2

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





โœ… Correct Answer: 4

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];





โœ… Correct Answer: 2

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





โœ… Correct Answer: 1

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





โœ… Correct Answer: 1

toString() method is defined in





โœ… Correct Answer: 2

The String method compareTo() returns





โœ… Correct Answer: 3

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





โœ… Correct Answer: 3