Online Exam Quiz

questionQuestion  1 to 30

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

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

Which of the following is not a control statement in Java?

  • break
  • continue
  • exit
  • return
Mark for review

What is the output of System.out.println("Hello World".substring(6));?

  • Hello
  • World
  • Hello World
  • World Hello
Mark for review

Which method is used to get the current date and time in Java?

  • currentTime()
  • getTime()
  • now()
  • LocalDateTime.now()
Mark for review

Which operator is used for comparing two values?

  • =
  • ==
  • !=
  • <>
Mark for review

Which access modifier makes a member accessible only within its own class?

  • public
  • protected
  • default
  • private
Mark for review

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

  • public
  • private
  • protected
  • internal
Mark for review

Which of the following is not a valid Java identifier?

  • _myVariable
  • $myVariable
  • 123myVariable
  • myVariable123
Mark for review

What is the size of an int data type in Java?

  • 4 bytes
  • 2 bytes
  • 8 bytes
  • 1 byte
Mark for review

What is the use of the 'this' keyword in Java?

  • To refer to the current object
  • To refer to a superclass object
  • To refer to a static object
  • To refer to a local variable
Mark for review

Which package contains the Random class?

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

Which of the following is true about Java's garbage collection?

  • It is manual
  • It is automatic
  • It is optional
  • None of the above
Mark for review

Which of the following is not a valid way to create an object in Java?

  • new ClassName()
  • Class.forName("ClassName").newInstance()
  • ClassName.clone()
  • ClassName.new()
Mark for review

Which keyword is used to prevent inheritance in Java?

  • stop
  • end
  • final
  • static
Mark for review

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

  • TRUE
  • FALSE
  • 0
  • null
Mark for review

Which of the following is used to handle exceptions in Java?

  • try-catch
  • if-else
  • switch-case
  • for-loop
Mark for review

What does the acronym JVM stand for?

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

Which of the following is not a primitive data type in Java?

  • int
  • float
  • boolean
  • String
Mark for review

What is the result of 10 % 3?

  • 0
  • 1
  • 2
  • 3
Mark for review

Which of the following is the correct way to handle multiple exceptions in Java 7 and later?

  • Multiple catch blocks
  • A single catch block
  • A single catch block with multiple exceptions separated by a comma (,)
  • )
Mark for review

Which method is used to stop a thread in Java?

  • stop()
  • end()
  • terminate()
  • kill()
Mark for review

Which of the following is a reserved word in Java?

  • main
  • System
  • new
  • print
Mark for review

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

  • create()
  • init()
  • constructor
  • new()
Mark for review

What does the static keyword mean in Java?

  • The variable or method belongs to the instance
  • The variable or method belongs to the class
  • The variable or method is private
  • The variable or method is final
Mark for review

Which keyword is used to define an interface in Java?

  • class
  • interface
  • implements
  • extends
Mark for review

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

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

Which keyword is used to define a subclass in Java?

  • subclass
  • inherits
  • extends
  • implements
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 used to find the absolute value of a number in Java?

  • Math.abs()
  • Math.absolute()
  • Math.absValue()
  • Math.absoluteValue()
Mark for review

Which of the following is not a keyword in Java?

  • strictfp
  • null
  • instanceof
  • native
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