Online Exam Quiz

questionQuestion  1 to 30

Which of these is an interface in Java?

  • Runnable
  • RunnableThread
  • SerializableThread
  • SerializableRun
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 method is used to get the current thread in Java?

  • currentThread()
  • activeThread()
  • current()
  • active()
Mark for review

Which of the following cannot be stored in a Collection?

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

Which method is used to add elements to a collection?

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

Which of these is not a valid identifier in Java?

  • _abc
  • $abc
  • abc123
  • 123abc
Mark for review

Which of these methods can be used to check if a key exists in a Map?

  • contains()
  • hasKey()
  • containsKey()
  • has()
Mark for review

Which of these classes are synchronized?

  • ArrayList
  • Vector
  • HashMap
  • HashSet
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 keyword is used to prevent inheritance of a class in Java?

  • final
  • finally
  • finalize
  • static
Mark for review

Which of these keywords is used to define an abstract class in Java?

  • abstract
  • final
  • static
  • volatile
Mark for review

What is the default value of byte variable in Java?

  • 0
  • 0
  • null
  • undefined
Mark for review

Which of the following is not a Java feature?

  • Dynamic
  • Architecture Neutral
  • Use of pointers
  • Object-oriented
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 package is automatically imported into every Java program?

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

Which package contains the Random class in Java?

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

Which method of the java.util.ArrayList class is used to obtain the number of elements in an ArrayList object?

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

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

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

Which of these methods is used to obtain an iterator for a collection?

  • iterator()
  • iterate()
  • listIterator()
  • list()
Mark for review

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

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

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

  • JVM
  • JRE
  • JDK
  • JDB
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 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 of these is a marker interface?

  • Runnable
  • Serializable
  • Comparable
  • Cloneable
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 of these classes is used to generate random numbers in Java?

  • Random
  • RandomGenerator
  • RandomGen
  • Randomize
Mark for review

Which of the following is not an OOPS concept in Java?

  • Inheritance
  • Encapsulation
  • Polymorphism
  • Compilation
Mark for review

Which method is used to compare two strings in Java?

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

Which of these methods is a part of the Abstract class?

  • main()
  • abstract()
  • run()
  • None of the mentioned
Mark for review

What is the implicit return type of constructor?

  • void
  • int
  • float
  • None of the mentioned
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