Online Exam Quiz

questionQuestion  1 to 30

Which of the following is a thread-safe collection class?

  • java.util.ArrayList
  • java.util.Vector
  • java.util.HashSet
  • java.util.TreeSet
Mark for review

Which of these methods is used to remove all elements from a collection?

  • clear()
  • removeAll()
  • delete()
  • deleteAll()
Mark for review

Which of these operators can be used to concatenate two or more String objects?

  • +
  • &
  • -
  • %
Mark for review

What is the default value of byte variable in Java?

  • 0
  • 0
  • null
  • undefined
Mark for review

Which method in String class can be used to create a formatted string in Java?

  • format()
  • create()
  • printf()
  • sprintf()
Mark for review

Which method is used to start a thread execution in Java?

  • init()
  • start()
  • run()
  • resume()
Mark for review

Which of these is a marker interface?

  • Runnable
  • Serializable
  • Comparable
  • Cloneable
Mark for review

Which of the following is not a valid declaration of a String?

  • String s1 = null;
  • String s2 = "null";
  • String s3 = (String) "abc";
  • String s4 = 'abc';
Mark for review

Which method is used to add elements to a collection?

  • add()
  • append()
  • insert()
  • push()
Mark for review

Which of these is a valid declaration of a char?

  • char ch = 'ab';
  • char ch = 'a';
  • char ch = 'a'';
  • char ch = a;
Mark for review

Which of these is an interface in Java?

  • Runnable
  • RunnableThread
  • SerializableThread
  • SerializableRun
Mark for review

What is the implicit return type of constructor?

  • void
  • int
  • float
  • None of the mentioned
Mark for review

Which of these keywords is used to handle exceptions in Java?

  • try
  • catch
  • finally
  • all of the mentioned
Mark for review

Which of the following cannot be stored in a Collection?

  • Objects
  • Primitive data types
  • Arrays
  • User-defined classes
Mark for review

What is the result of the expression 13 & 25?

  • 38
  • 25
  • 8
  • 16
Mark for review

Which of these classes are synchronized?

  • ArrayList
  • Vector
  • HashMap
  • HashSet
Mark for review

Which keyword is used to prevent inheritance of a class in Java?

  • final
  • finally
  • finalize
  • static
Mark for review

Which method is used to write characters to a file in Java?

  • write()
  • writeChars()
  • print()
  • println()
Mark for review

Which method in Thread class is used to pause the execution of a thread for a specific time?

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

Which collection class allows you to grow or shrink its size and provides indexed access to its elements, but whose methods are not synchronized?

  • java.util.HashSet
  • java.util.LinkedHashSet
  • java.util.List
  • java.util.ArrayList
Mark for review

Which of the following is used to find and fix bugs in Java programs?

  • JVM
  • JRE
  • JDK
  • JDB
Mark for review

What is the size of int data type in Java?

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

Which of these is not a method of the java.lang.String class?

  • length()
  • compareTo()
  • toString()
  • valueOf()
Mark for review

Which method is used to compare two strings in Java?

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

Which of these classes is used to generate random numbers in Java?

  • Random
  • RandomGenerator
  • RandomGen
  • Randomize
Mark for review

Which of the following is true about Java?

  • Java is a platform-independent language
  • Java is a language dependent on a platform
  • Java is a procedure-oriented language
  • Java does not support OOPS concept
Mark for review

Which method is called by the garbage collector in Java?

  • finalize()
  • final()
  • finally()
  • all of the mentioned
Mark for review

Which package is automatically imported into every Java program?

  • java.lang
  • java.util
  • java.io
  • java.net
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 child class object
  • To refer to the object of the same class
Mark for review

Which of these is not a type of inheritance in Java?

  • Single inheritance
  • Multiple inheritance
  • Multilevel inheritance
  • Hierarchical inheritance
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