Online Exam Quiz

questionQuestion  1 to 30

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 access modifier makes a member accessible only within its own class?

  • public
  • protected
  • default
  • private
Mark for review

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

  • break
  • continue
  • exit
  • return
Mark for review

Which method is used to compare two strings in Java?

  • equals()
  • compareTo()
  • ==
  • equalsIgnoreCase()
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 a reserved word in Java?

  • main
  • System
  • new
  • print
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

Which of the following is a marker interface?

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

Which operator is used for comparing two values?

  • =
  • ==
  • !=
  • <>
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 keyword is used to define an interface in Java?

  • class
  • interface
  • implements
  • extends
Mark for review

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

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

Which keyword is used to prevent inheritance in Java?

  • stop
  • end
  • final
  • static
Mark for review

Which method is used to read a line of text from the console in Java?

  • readLine()
  • read()
  • getLine()
  • nextLine()
Mark for review

Which of the following is used to generate random numbers?

  • Random class
  • Math.random()
  • java.util.Random
  • All of the above
Mark for review

What is the output of System.out.println(10 > 9 ? "true" : "false");?

  • TRUE
  • FALSE
  • 10
  • 9
Mark for review

Which of the following is not a Java feature?

  • Object-Oriented
  • Portable
  • Dynamic
  • Use of Pointers
Mark for review

Which keyword is used to define a subclass in Java?

  • subclass
  • inherits
  • extends
  • implements
Mark for review

Which method must be implemented by all threads in Java?

  • run()
  • start()
  • stop()
  • sleep()
Mark for review

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

  • int
  • long
  • String
  • float
Mark for review

Which of the following is not a keyword in Java?

  • strictfp
  • null
  • instanceof
  • native
Mark for review

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

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

What is the output of the following code? System.out.println(2 + "3");

  • 5
  • 23
  • 2 3
  • Error
Mark for review

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

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

Which exception is thrown when a divide-by-zero occurs in Java?

  • NullPointerException
  • ArithmeticException
  • ArrayIndexOutOfBoundsException
  • NumberFormatException
Mark for review

What is the superclass of all classes in Java?

  • Object
  • Class
  • Interface
  • Base
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

What is the result of 10 % 3?

  • 0
  • 1
  • 2
  • 3
Mark for review

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

  • int
  • float
  • boolean
  • String
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