Online Exam Quiz

questionQuestion  1 to 30

What is the output of System.out.println("Hello".charAt(1));?

  • H
  • e
  • l
  • o
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

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 of the following is used to create a new instance of an array in Java?

  • new
  • create
  • instantiate
  • allocate
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 method is used to stop a thread in Java?

  • stop()
  • end()
  • terminate()
  • kill()
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

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

  • TRUE
  • FALSE
  • 0
  • null
Mark for review

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

  • break
  • continue
  • exit
  • return
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 not a primitive data type in Java?

  • int
  • float
  • boolean
  • String
Mark for review

Which method must be implemented by all threads in Java?

  • run()
  • start()
  • stop()
  • sleep()
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 of the following is a reserved word in Java?

  • main
  • System
  • new
  • print
Mark for review

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

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

Which keyword is used to define a subclass in Java?

  • subclass
  • inherits
  • extends
  • implements
Mark for review

What is the output of System.out.println(Math.min(3, 7));?

  • 3
  • 7
  • 0
  • Error
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 of the following is a marker interface?

  • Serializable
  • Cloneable
  • Remote
  • All of the above
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 of the following is not a keyword in Java?

  • strictfp
  • null
  • instanceof
  • native
Mark for review

Which of the following is not a valid Java identifier?

  • _myVariable
  • $myVariable
  • 123myVariable
  • myVariable123
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 interface is used to store a collection of elements in Java?

  • List
  • Set
  • Map
  • All of the above
Mark for review

Which of the following is not a Java feature?

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

What is the base class for all exceptions in Java?

  • Throwable
  • Exception
  • RuntimeException
  • Error
Mark for review

Which operator is used for comparing two values?

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

Which method is used to start a thread execution?

  • run()
  • start()
  • execute()
  • launch()
Mark for review

What is the superclass of all classes in Java?

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

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