Online Exam Quiz

questionQuestion  1 to 30

What is the implicit return type of a constructor?

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

Which method must be implemented by all threads?

  • run()
  • start()
  • stop()
  • main()
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 method is used to find the character at a specific index in a string?

  • charAt()
  • getChar()
  • indexOf()
  • char()
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 of the following is not a Java feature?

  • Object-oriented
  • Use of pointers
  • Platform independent
  • Secure
Mark for review

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

  • TRUE
  • FALSE
  • 0
  • 1
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

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

  • TRUE
  • FALSE
  • null
  • undefined
Mark for review

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

  • int
  • Object
  • long
  • void
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 size of an int variable in Java?

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

Which package contains the Random class?

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

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

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

  • 3030
  • 102030
  • 30
  • 102030
Mark for review

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

  • finalize()
  • init()
  • start()
  • constructor
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 the following is a valid declaration of an array?

  • int[] arr;
  • int arr[];
  • int[] arr = new int[10];
  • All of the above
Mark for review

Which of the following is a marker interface in Java?

  • Runnable
  • Serializable
  • Remote
  • ResultSet
Mark for review

Which of the following is a reserved keyword in Java?

  • array
  • goto
  • constant
  • var
Mark for review

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

  • Hello World
  • HelloWorld
  • Hello+World
  • Hello World!
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 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 stop the execution of a thread?

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

Which of the following is a wrapper class in Java?

  • int
  • float
  • char
  • Integer
Mark for review

Which package contains the Random class?

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

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

  • int
  • long
  • String
  • boolean
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 marker interface?

  • Serializable
  • Cloneable
  • Remote
  • All 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