0% found this document useful (0 votes)
2 views6 pages

Java Quiz Questions and Answers

The document contains a series of Java quiz questions covering various topics such as debugging, return types, literals, expressions, loops, class methods, variable shadowing, interfaces, keywords, and memory management. Each question provides multiple-choice answers to test knowledge of Java programming concepts. It serves as a resource for individuals preparing for Java-related assessments or enhancing their understanding of the language.

Uploaded by

veeresh2006.cta
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views6 pages

Java Quiz Questions and Answers

The document contains a series of Java quiz questions covering various topics such as debugging, return types, literals, expressions, loops, class methods, variable shadowing, interfaces, keywords, and memory management. Each question provides multiple-choice answers to test knowledge of Java programming concepts. It serves as a resource for individuals preparing for Java-related assessments or enhancing their understanding of the language.

Uploaded by

veeresh2006.cta
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Java Quiz Questions

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

a. JVM
b. JRE
c. JDK
d. JDB

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

a. Object
b. int
c. long
d. void

Which of the following is a valid long literal?

a. ABH8097
b. L990023
c. 904423
d. 0xnf029L

What does the expression float a = 35 / 0 return?

a. 0
b. Not a Number
c. Infinity
d. Run time exception

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


Java Quiz Questions

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

a. 24
b. 23
c. 20
d. 25

Which of the following for loop declaration is not valid?

a. for ( int i = 99; i >= 0; i / 9 )


b. for ( int i = 7; i <= 77; i += 7 )
c. for ( int i = 20; i >= 2; - -i )
d. for ( int i = 2; i <= 20; i = 2* i )

What does the expression float a = 35 / 0 return?

a. 0
b. Not a Number
c. Infinity
d. Run time exception

Which method of the [Link] is used to determine the name of a class represented by the
class object as a String?

a. getClass()
b. intern()
c. getName()
d. toString()

In which process, a local variable has the same name as one of the instance variables?

a. Serialization
b. Variable Shadowing
c. Abstraction
d. Multi-threading
Java Quiz Questions
An interface with no fields or methods is known as a ______.

a. Runnable Interface
b. Marker Interface
c. Abstract Interface
d. CharSequence Interface

Which of the following is an immediate subclass of the Panel class?

a. Applet class
b. Window class
c. Frame class
d. Dialog class

Which option is false about the final keyword?

a. A final method cannot be overridden in its subclasses.


b. A final class cannot be extended.
c. A final class cannot extend other classes.
d. A final method can be inherited.

Which of these classes are the direct subclasses of the Throwable class?

a. RuntimeException and Error class


b. Exception and VirtualMachineError class
c. Error and Exception class
d. IOException and VirtualMachineError class

In which memory a String is stored, when we create a string using new operator?

a. Stack
b. String memory
c. Heap memory
d. Random storage space

Which of the following is a marker interface?


Java Quiz Questions

a. Runnable interface
b. Remote interface
c. Readable interface
d. Result interface

Which of the following is a reserved keyword in Java?

a. object
b. strictfp
c. main
d. system

Which keyword is used for accessing the features of a package?

a. package
b. import
c. extends
d. export

In java, jar stands for_____.

a. Java Archive Runner


b. Java Application Resource
c. Java Application Runner
d. None of the above

Which of the following is false?

a. The [Link] stands for the runtime jar


b. It is an optional jar file
c. It contains all the compiled class files
d. All the classes available in [Link] is known to the JVM

What is the initial quantity of the ArrayList list?


Java Quiz Questions

a. 5
b. 10
c. 0
d. 100

Which of the following is a mutable class in java?

a. [Link]
b. [Link]
c. [Link]
d. [Link]

What is meant by the classes and objects that dependents on each other?

a. Tight Coupling
b. Cohesion
c. Loose Coupling
d. None of the above

How many threads can be executed at a time?

a. Only one thread


b. Multiple threads
c. Only main (main() method) thread
d. Two thread

If three threads trying to share a single object at the same time, which condition will arise in
this scenario?

a. Time-Lapse
b. Critical situation
c. Race condition
d. Recursion
Java Quiz Questions

You might also like