Online Exam Quiz

questionQuestion  1 to 30

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

  • 0
  • 1
  • 2
  • infinite
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

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

Which package contains the Random class?

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

Which method is used to convert a string to lowercase in Java?

  • toLowerCase()
  • toLower()
  • lower()
  • toLowerString()
Mark for review

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

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

Which operator is used to create an object in Java?

  • new
  • create
  • object
  • instance
Mark for review

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

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

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

  • import
  • package
  • extends
  • implements
Mark for review

What is the purpose of the System.gc() method?

  • To start the garbage collector
  • To stop the garbage collector
  • To request the garbage collector to run
  • None of the above
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 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 return type of the hashCode() method in the Object class?

  • int
  • Object
  • long
  • void
Mark for review

Which of the following is not a reserved keyword in Java?

  • class
  • int
  • get
  • if
Mark for review

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

  • public
  • private
  • protected
  • default
Mark for review

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

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

What is used to achieve multiple inheritance in Java?

  • Interfaces
  • Abstract classes
  • Both
  • None 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

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 keyword is used to define a constant variable in Java?

  • static
  • final
  • const
  • immutable
Mark for review

Which method is used to start a thread in Java?

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

Which of the following is a reserved keyword in Java?

  • array
  • goto
  • constant
  • var
Mark for review

Which exception is thrown when java is out of memory?

  • MemoryError
  • OutOfMemoryError
  • MemoryOutOfBoundsException
  • MemoryFullException
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 output of 5/2 in Java?

  • 2.5
  • 2
  • 3
  • 2
Mark for review

Which of the following is not a Java feature?

  • Object-oriented
  • Use of pointers
  • Platform independent
  • Secure
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 superclass of every class in Java?

  • ArrayList
  • Abstract class
  • Object class
  • String class
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

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

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