Top 15  Java Quiz Questions to test your skills

in 2023

A. Byte to int  B. Int to long  C. Long to int  D. Short to int

1. Automatic type conversion is possible in which of the possible cases?

Check out the answer here!

A. char[] ch = new char(5)  B. char[] ch = new char[5]  C. char[] ch = new char()  D. char[] ch = new char[]

2. Select the valid statement.

Check out the answer here!

A. The reference of the array  B. A copy of the array  C. Length of the array  D. Copy of first element

3. When an array is passed to a method, what does the method receive?

Check out the answer here!

A. At run time  B. At compile time  C. Depends on the code  D. None

4. When is the object created with new keyword?

Check out the answer here!

A. java.lang.Object  B. java.lang.String  C. java.lang.util  D. None

5. In which of the following is toString() method defined?

Check out the answer here!

A. True  B. False  C. An int value  D. None

6. compareTo() returns

Check out the answer here!

A. java.lang  B. java.awt  C. java.applet  D. java.string

7. To which of the following does the class string belong to?

Check out the answer here!

A. 3  B. 7  C. 13  D. 20

8. Total constructor string class have?

Check out the answer here!

A. 3  B. 3.0  C. 4  D. 4.0

9. Output of Math.floor(3.6)?

Check out the answer here!

A. int  B. void  C. double  D. None

10. Identify the return type of a method that does not return value.

Check out the answer here!

A. Comparator  B. EventListener  C. Set  D. Collection

11. Identify the interface used to declare core methods in Java.

Check out the answer here!

A. for(; ;)  B. for(int i = 0; i < 1; i--)  C. for(int i = 0; ;i++)  D. All of the above

12. Identify the infinite loop.

Check out the answer here!

A. JDK  B. JRE  C. JVM  D. JDB

13. Which of the following is used to find and fix program bugs?

Check out the answer here!

A. Right shift operator  B. Left shift operator  C. Zero-fill left shift  D. Zero-fill right shift

14. What does the operator >>>> do?  

Check out the answer here!

A. No return type  B. A class object in which it is defined  C. Void  D. None

15. What is the implicit return type of a constructor?

Check out the answer here!

Are you  prepared to assess your proficiency in Java?

Demonstrate your expertise by taking our quiz. Simply click on the "Try it now" button to commence. Best of luck!

Step Up Your Game with InterviewBit Web Stories

Don't miss out on the chance to upskill yourself with IntervewBit's engaging web stories.