Java/Java Multiple Choice Questions Sample Test,Sample questions

Question:
Which of the following option leads to the portability and security of Java?

1. Bytecode is executed by JVM

2. The applet makes the Java code secure and portable

3. Use of exception handling

4. Dynamic binding between objects


Question:
 In java jar stands for_____.

1. Java Archive Runner

2. Java Application Resource

3. Java Application Runner

4. None of the above


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

1. Stack

2. String memory

3. Heap memory

4. Random storage space


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





1.Object

2.int

3.long

4.void


Question:
 Which method of the Class.class is used to determine the name of a class represented by the class object as a String?

1. getClass()

2. intern()

3. getName()

4. toString()


Question:
 Which of the following creates a List of 3 visible items and multiple selections abled?

1. new List(false 3)

2. new List(3 true)

3. new List(true 3)

4. new List(3 false)


Question:
 Which of the following is a marker interface?

1. Runnable interface

2. Remote interface

3. Readable interface

4. Result interface


Question:
 Which of the following is a valid long literal?




1.ABH8097

2.L990023

3.904423

4.0xnf029L


Question:
 Which of the following is false?

1. The rt.jar stands for the runtime jar

2. It is an optional jar file

3. It contains all the compiled class files

4. All the classes available in rt.jar is known to the JVM


Question:
 Which of the following is not a Java features?

1. Dynamic

2. Architecture Neutral

3. Use of pointers

4.Object-oriented


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

1. RuntimeException and Error class

2. Exception and VirtualMachineError class

3. Error and Exception class

4. IOException and VirtualMachineError class


Question:
 Which package contains the Random class?

1.java.util package

2.java.lang package

3.java.awt package

4.java.io package


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

1.JVM

2.JRE

3.JDK

4.JDB


Question:
An interface with no fields or methods is known as a ______.

1. Runnable Interface

2.Marker Interface

3.Abstract Interface

4. CharSequence Interface


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

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

1.24

2.23

3.20

4.25


Question:
Given that Student is a class how many reference variables and objects are created by the following code?

Student studentName studentId;  
studentName = new Student();  
Student stud_class = new Student();   

1.Three reference variables and two objects are created.

2. Two reference variables and two objects are created.

3. One reference variable and two objects are created.

4. Three reference variables and three objects are created.


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

1. Serialization

2. Variable Shadowing

3. Abstraction

4. Multi-threading


Question:
The u0021 article referred to as a

1. Unicode escape sequence

2. Octal escape

3. Hexadecimal

4. Line feed


Question:
What do you mean by chained exceptions in Java?

1. Exceptions occurred by the VirtualMachineError

2. An exception caused by other exceptions

3. Exceptions occur in chains with discarding the debugging information

4. None of the above


Question:
What do you mean by nameless objects?

1. An object created by using the new keyword.

2. An object of a superclass created in the subclass.

3. An object without having any name but having a reference.

4. An object that has no reference.


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


1.0

2. Not a Number

3. Infinity

4. Run time exception


Question:
What is the use of the intern() method?

1. It returns the existing string from memory

2. It creates a new string in the database

3. It modifies the existing string in the database

4. None of the above


Question:
What is the use of w in regex?

1. Used for a whitespace character

2. Used for a non-whitespace character

3. Used for a word character

4. Used for a non-word character


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




1.package

2.import

3.extends

4.Export


Question:
Which of the following for loop declaration is not valid?

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

2. for ( int i = 7; i <= 77; i += 7 )

3. for ( int i = 20; i >= 2; - -i )

4. for ( int i = 2; i <= 20; i = 2* i )


Question:
Which of the following is a reserved keyword in Java?

1. object

2. strictfp

3. main

4.system


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

1. Applet class

2. Window class

3. Frame class

4. Dialog class


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

1. javap tool

2. javaw command

3. Javadoc tool

4. javah command


Question:
Which of the given methods are of Object class?

1. notify() wait( long msecs ) and synchronized()

2. wait( long msecs ) interrupt() and notifyAll()

3. notify() notifyAll() and wait()

4. sleep( long msecs ) wait() and notify()


Question:
Which option is false about the final keyword?.

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

2. A final class cannot be extended.

3. A final class cannot extend other classes

4. A final method can be inherited.


More MCQS

  1. Java Mcq Question Set 1
  2. Java Mcq Question Set 2
  3. Java Mcq Question Set 3
  4. Java Mcq Question Set 4
  5. Java Mcq Question Set 5
  6. Java Mcq Question Set 6
  7. Java Mcq Question Set 7
  8. Java Mcq Question Set 8
  9. Java Mcq Question Set 9
  10. Java Multiple Choice Questions
  11. DATA TYPES IN JAVA
  12. Classes ,Constructor ,Methods,Inheritance
  13. Java Multiple Choice Questions.
Search
Olete Team
Online Exam TestTop Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on Online Exam Testwebsite is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!