Online Exam Quiz

questionQuestion  1 to 30

What is the default value of a local variable in Java?

  • 0
  • null
  • FALSE
  • No default value
Mark for review

Which package contains the Random class?

  • java.util
  • java.lang
  • java.io
  • java.net
Mark for review

Which exception is thrown when a division by zero occurs?

  • NullPointerException
  • ArithmeticException
  • ArrayIndexOutOfBoundsException
  • NumberFormatException
Mark for review

Which of the following is not a Java feature?

  • Object-oriented
  • Use of pointers
  • Portable
  • Dynamic
Mark for review

Which method is used to stop the execution of a thread?

  • stop()
  • wait()
  • sleep()
  • terminate()
Mark for review

Which method is used to perform some action when the object is to be destroyed?

  • delete()
  • finalize()
  • none()
  • destroy()
Mark for review

Which method is used to terminate a thread in Java?

  • stop()
  • terminate()
  • end()
  • interrupt()
Mark for review

Which keyword is used to inherit a class in Java?

  • extend
  • inherit
  • extends
  • implements
Mark for review

What is the return type of the hashCode() method?

  • int
  • long
  • String
  • boolean
Mark for review

Which method can be used to start a thread execution?

  • run()
  • start()
  • init()
  • resume()
Mark for review

What is the use of the this keyword in Java?

  • To refer to the current object
  • To refer to the parent class object
  • To refer to the class variable
  • None of the above
Mark for review

What does the AWT stand for?

  • All Window Tools
  • Abstract Window Toolkit
  • Abstract Windows Toolkit
  • All Windows Toolkit
Mark for review

Which of these is used to create an object of a class?

  • Constructor
  • method
  • object
  • class
Mark for review

Which one of the following is not a valid component of the Java environment?

  • JDK
  • JVM
  • JIT
  • JDB
Mark for review

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

  • Infinity
  • NaN
  • 0
  • ArithmeticException
Mark for review

Which of the following is the default value of a boolean variable?

  • TRUE
  • FALSE
  • null
  • undefined
Mark for review

Which of these classes are immutable in Java?

  • String
  • StringBuffer
  • StringBuilder
  • None of the above
Mark for review

What is a correct way to synchronize a method in Java?

  • synchronized void method()
  • synchronized(method)
  • sync void method()
  • void synchronized method()
Mark for review

Which of the following statements is true?

  • JRE is a subset of JDK
  • JDK is a subset of JRE
  • JVM is a subset of JRE
  • JRE and JDK are subsets of JVM
Mark for review

What does the JVM stand for?

  • Java Virtual Machine
  • Java Variable Machine
  • Java Verified Machine
  • Java Visual Machine
Mark for review

Which keyword is used to prevent inheritance of a class?

  • final
  • static
  • abstract
  • const
Mark for review

Which of the following is used to handle exceptions in Java?

  • try-catch block
  • finally block
  • throw statement
  • All of the above
Mark for review

What is the output of 5/2 in Java?

  • 2.5
  • 2
  • 3
  • 2
Mark for review

Which method can be used to find the length of a string in Java?

  • getSize()
  • sizeOf()
  • lengthOf()
  • length()
Mark for review

Which of the following is not an access modifier in Java?

  • public
  • private
  • protected
  • default
Mark for review

Which of the following is a reserved keyword in Java?

  • array
  • goto
  • constant
  • var
Mark for review

Which of the following is a marker interface in Java?

  • Runnable
  • Serializable
  • Remote
  • ResultSet
Mark for review

Which interface is used to store key-value pairs in Java?

  • Map
  • Set
  • List
  • Collection
Mark for review

Which class is used to read from a file in Java?

  • FileReader
  • FileWriter
  • BufferedWriter
  • PrintWriter
Mark for review

Which of these packages contains the Exception class?

  • java.io
  • java.lang
  • java.util
  • java.net
Mark for review

blinkerOnline

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • Answered
  • Not Answered
  • Marked for Review