Online Exam Quiz

questionQuestion  1 to 30

Which of the following is a marker interface in Java?

  • Runnable
  • Serializable
  • Remote
  • ResultSet
Mark for review

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

  • void
  • int
  • String
  • Object
Mark for review

What is the default encoding for Java source files?

  • ASCII
  • UTF-8
  • ISO-8859-1
  • UTF-16
Mark for review

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

  • public
  • private
  • protected
  • default
Mark for review

Which of the following is a marker interface?

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

Which method must be implemented by all threads?

  • run()
  • start()
  • stop()
  • main()
Mark for review

What is the use of the finalize() method?

  • To clean up resources
  • To start garbage collection
  • To end the program
  • None of the above
Mark for review

What is the default value of an instance variable in Java?

  • 0
  • null
  • Depends on the data type
  • 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 the following is not a primitive data type in Java?

  • int
  • String
  • float
  • boolean
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 the following is a marker interface?

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

Which method can be used to make the main thread wait for all child threads to finish?

  • sleep()
  • join()
  • wait()
  • notify()
Mark for review

Which keyword is used to define a constant variable in Java?

  • static
  • final
  • const
  • immutable
Mark for review

Which is the correct declaration of an abstract class?

  • abstract class MyClass {}
  • class abstract MyClass {}
  • MyClass abstract class {}
  • None of the above
Mark for review

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

  • JDK
  • JVM
  • JIT
  • JDB
Mark for review

Which keyword is used to inherit a class in Java?

  • implements
  • extends
  • inherits
  • imports
Mark for review

What is the range of short data type in Java?

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

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

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

What is the use of the static keyword in Java?

  • To create a constant variable
  • To define a method as a class method
  • To make a class method private
  • None of the above
Mark for review

Which package contains the Random class?

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

What is the purpose of the hashCode() method?

  • To compare two objects
  • To generate a unique integer for an object
  • To clone an object
  • To get the memory address of an object
Mark for review

Which of the following is a wrapper class in Java?

  • int
  • float
  • char
  • Integer
Mark for review

What is the return type of the main method in Java?

  • void
  • int
  • String
  • None of the above
Mark for review

Which of these are selection statements in Java?

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

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

  • Constructor
  • method
  • object
  • class
Mark for review

Which method is called when an object is created in Java?

  • finalize()
  • init()
  • start()
  • constructor
Mark for review

What will be the output of System.out.println(10 + 20 + "30");?

  • 3030
  • 102030
  • 30
  • 102030
Mark for review

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

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

Which of these is not a method of the Math class?

  • min()
  • max()
  • floor()
  • roundOff()
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