Online Exam Quiz

questionQuestion  1 to 30

Which of the following is not a valid flow control statement?

  • if
  • continue
  • exit
  • break
Mark for review

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

  • identifier
  • keyword
  • validVariableName
  • $variableName
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 of these is an interface in the Collections Framework?

  • ArrayList
  • HashSet
  • LinkedList
  • Set
Mark for review

Which of the following is a marker interface?

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

Which of these packages contains the Exception class?

  • java.io
  • java.lang
  • java.util
  • java.net
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 of the following is a valid constructor of the String class?

  • String(String str)
  • String()
  • String(char[] charArray)
  • All of the above
Mark for review

Which method is used to find the character at a specific index in a string?

  • charAt()
  • getChar()
  • indexOf()
  • char()
Mark for review

What is the default value of a local variable?

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

What is the use of the instanceof keyword in Java?

  • To compare two objects
  • To create an instance of a class
  • To check if an object is an instance of a specific class
  • None of the above
Mark for review

Which keyword is used to inherit a class in Java?

  • implements
  • extends
  • inherits
  • imports
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 class is the parent class of all classes in Java?

  • java.lang.Object
  • java.lang.String
  • java.lang.System
  • java.lang.Exception
Mark for review

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

  • static
  • final
  • const
  • immutable
Mark for review

What is the output of "Hello".concat("World") in Java?

  • Hello World
  • HelloWorld
  • Hello+World
  • Hello World!
Mark for review

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

  • parseInt()
  • parseInteger()
  • toInt()
  • toInteger()
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 the following is a marker interface in Java?

  • Runnable
  • Serializable
  • Remote
  • ResultSet
Mark for review

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

  • finalize()
  • init()
  • start()
  • constructor
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

How many times is the do while loop guaranteed to execute?

  • 0
  • 1
  • 2
  • infinite
Mark for review

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

  • int
  • Object
  • long
  • void
Mark for review

Which of the following is a valid long literal?

  • 0x99ffL
  • ABCDE
  • 0x99ff
  • 99ffL
Mark for review

What is the size of an int variable in Java?

  • 8 bits
  • 16 bits
  • 32 bits
  • 64 bits
Mark for review

What is the size of a char variable in Java?

  • 8 bits
  • 16 bits
  • 32 bits
  • 64 bits
Mark for review

Which method is used to compare two strings for equality?

  • equals()
  • compareTo()
  • ==
  • compare()
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 of the following is not a reserved keyword in Java?

  • class
  • int
  • get
  • if
Mark for review

Which package contains the Random class?

  • java.util
  • java.lang
  • java.io
  • 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