Online Exam Quiz

questionQuestion  1 to 30

Which keyword is used to prevent inheritance of a class?

  • final
  • static
  • abstract
  • const
Mark for review

Which of these access specifiers can be used for a main() method?

  • public
  • private
  • protected
  • default
Mark for review

What is the purpose of the wait(), notify(), and notifyAll() methods in Java?

  • To perform inter-thread communication
  • To perform thread synchronization
  • To handle exceptions
  • None of the above
Mark for review

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

  • FileReader
  • FileWriter
  • BufferedWriter
  • PrintWriter
Mark for review

Which of these cannot be used for a variable name in Java?

  • identifier
  • keyword
  • validVariableName
  • $variableName
Mark for review

Which exception is thrown when java is out of memory?

  • MemoryError
  • OutOfMemoryError
  • MemoryOutOfBoundsException
  • MemoryFullException
Mark for review

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

  • Infinity
  • NaN
  • 0
  • ArithmeticException
Mark for review

Which method is used to terminate a thread in Java?

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

Which package contains the Random class?

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

Which keyword is used to declare a constant variable?

  • final
  • static
  • const
  • immutable
Mark for review

Which keyword is used to inherit a class in Java?

  • extend
  • inherit
  • extends
  • implements
Mark for review

Which of the following is a superclass of every class in Java?

  • ArrayList
  • Abstract class
  • Object class
  • String class
Mark for review

Which method is used to get the length of an array?

  • length()
  • size()
  • length
  • getSize()
Mark for review

What is the implicit return type of a constructor?

  • void
  • int
  • No return type
  • None of the above
Mark for review

Which method is used to compare two strings in Java?

  • equals()
  • ==
  • compare()
  • compareTo()
Mark for review

Which method is used to convert a string to an integer in Java?

  • parseInt()
  • parseInteger()
  • toInt()
  • toInteger()
Mark for review

Which of the following is not an OOPS concept in Java?

  • Polymorphism
  • Inheritance
  • Compilation
  • Encapsulation
Mark for review

Which of the following is a marker interface?

  • Serializable
  • Cloneable
  • Remote
  • All of the above
Mark for review

Which of the following is not a primitive data type in Java?

  • int
  • String
  • float
  • boolean
Mark for review

Which of these methods are used to register a thread in a thread scheduler?

  • run()
  • start()
  • register()
  • None of the above
Mark for review

Which of these classes are immutable in Java?

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

Which of these methods is used to register a thread in a thread scheduler?

  • run()
  • start()
  • register()
  • None of the above
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 a valid flow control statement?

  • if
  • continue
  • exit
  • break
Mark for review

What is the range of the short data type in Java?

  • -128 to 127
  • -32768 to 32767
  • -2147483648 to 2147483647
  • None of the above
Mark for review

What is the use of the super 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

Which method is used to start a thread in Java?

  • run()
  • start()
  • init()
  • begin()
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

Which of these are selection statements in Java?

  • if()
  • for()
  • continue
  • break()
Mark for review

Which operator is considered to be with the highest precedence?

  • =
  • ==
  • ? :
  • ++
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