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

What does the JVM stand for?

  • Java Virtual Machine
  • Java Variable Machine
  • Java Verified Machine
  • Java Visual Machine
Mark for review

Which method is used to compare two strings for equality?

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

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

  • TRUE
  • FALSE
  • null
  • undefined
Mark for review

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

  • Infinity
  • NaN
  • 0
  • ArithmeticException
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 of these is used to create an object of a class?

  • Constructor
  • method
  • object
  • class
Mark for review

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

  • import
  • package
  • extends
  • implements
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

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 these are selection statements in Java?

  • if()
  • for()
  • continue
  • break()
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 find the character at a specific index in a string?

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

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

  • JDK
  • JVM
  • JIT
  • JDB
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 not a primitive data type in Java?

  • int
  • String
  • float
  • boolean
Mark for review

Which method can be used to find the length of a string in Java?

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

Which keyword is used to inherit a class in Java?

  • extend
  • inherit
  • extends
  • implements
Mark for review

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

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

Which of the following statements is true?

  • JRE is a subset of JDK
  • JDK is a subset of JRE
  • JVM is a subset of JRE
  • JRE and JDK are subsets of JVM
Mark for review

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

  • void
  • int
  • String
  • Object
Mark for review

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

  • public
  • private
  • protected
  • default
Mark for review

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

  • finalize()
  • init()
  • start()
  • constructor
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 a valid long literal?

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

Which of the following is a marker interface?

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

What is used to achieve multiple inheritance in Java?

  • Interfaces
  • Abstract classes
  • Both
  • 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 not a Java feature?

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

Which keyword is used to declare a constant variable?

  • final
  • static
  • const
  • immutable
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