Tuesday, July 13, 2021

Java Quiz-1

Java Multiple Choice Questions

1. Which of the following is not a primitive data type?

A.byte
B.Integer
C.double
D.long


2. In Java, Which of the following does not have a superclass?

A.System
B.String
C.Object
D.Date


3. All elements of an Array have same ____________?

A.index
B.value
C.data type and scope
D.none


4. A variable becomes a Constant if it has a ______________ modifier.

A.static
B.abstract
C.final
D.const


5. Which of the following can be used to copy data from one array to another?

A.System.clone
B.System.arraycopy
C.java.lang.clone
D.none


6. Which of the following option leads to the portability and security of Java?

A.Bytecode is executed by JVM
B.The applet makes the Java code secure and portable
C.Use of exception handling
D.Dynamic binding between objects


7. Which of the following is not a Java features?

A.Dynamic
B.Architecture Neutral
C.Use of pointers
D.Object-oriented


8. _____ is used to find and fix bugs in the Java programs.

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


9. What is the return type of the hashCode() method in the Object class?

A.Object
B.int
C.long
D.void


10. Which of the following is a valid long literal?

A.ABH8097
B.L990023
C.904423
D.0xnf029L


11. What does the expression float a = 40 / 0 return?

A.NaN
B.0
C.Infinity
D.Arithmetic Exception


12. Evaluate the following Java expression, if x=3, y=5, and z=10:


++z + y - y + z + x++

A.24
B.23
C.20
D.25


13. Which of the following tool is used to generate API documentation in HTML format from doc comments in source code?

A.javap tool
B.javaw command
C.Javadoc tool
D.javah command


14. Which option is false about the final keyword?

A.A final method cannot be overridden in its subclasses.
B.A variable declared as final becomes a constant
C.A final class cannot be extended
D.A final method can be overrriden


15. Which of the following is a reserved keyword in Java?

A.object
B.extends
C.strictfp
D.system