Online Exam Quiz

questionQuestion  1 to 30

What is the base class of all classes in Java?

  • Object
  • Class
  • Base
  • Root
Mark for review

Which class is used to read characters in Java?

  • FileReader
  • FileInputStream
  • BufferedInputStream
  • DataInputStream
Mark for review

Which of the following is a valid declaration of a char in Java?

  • char ch = 'A';
  • char ch = "A";
  • char ch = A;
  • char ch = 'A"';
Mark for review

What does JVM stand for in Java?

  • Java Variable Model
  • Java Virtual Machine
  • Java Visual Model
  • Java Version Machine
Mark for review

Which of these classes are used by Byte streams for input and output operation?

  • InputStream
  • ObjectInputStream
  • Reader
  • InputStreamReader
Mark for review

Which method in the Servlet interface is called once to initialize the servlet?

  • init()
  • start()
  • initServlet()
  • service()
Mark for review

Which of the following is true about a constructor in Java?

  • It can be inherited
  • It cannot be overloaded
  • It does not have a return type
  • It is called explicitly
Mark for review

When a thread is created and started, what is its initial state?

  • Ready
  • Running
  • Waiting
  • Sleeping
Mark for review

Which method is used to return the name of a thread?

  • getName()
  • getId()
  • getThread()
  • getThreadName()
Mark for review

Which of the following methods is used to start a thread execution?

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

Which of the following is true about a static method?

  • It can access instance variables
  • It can be overridden
  • It cannot be called from a static context
  • It can be called using the class name
Mark for review

Which of the following is not a Java feature?

  • Object-oriented
  • Use of pointers
  • Portable
  • Dynamic
Mark for review

What is the main purpose of the Java ClassLoader?

  • To load classes at runtime
  • To compile Java code
  • To execute bytecode
  • To interpret Java code
Mark for review

Which of these methods deletes all the elements from invoking collection?

  • clear()
  • reset()
  • delete()
  • refresh()
Mark for review

In which package is the JDBC API included?

  • javax.swing
  • java.net
  • java.sql
  • java.util
Mark for review

Which method must be implemented by all threads?

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

Which of these methods can be used to make the main thread wait for all child threads to finish?

  • sleep()
  • isAlive()
  • join()
  • stop()
Mark for review

What is the use of the final keyword in Java?

  • To mark a class as not extendable
  • To mark a method as not overridable
  • To mark a variable as constant
  • All of the above
Mark for review

Which keyword is used for accessing the features of a package?

  • pkg
  • Pkg
  • import
  • Import
Mark for review

In which memory a String is stored, when we create a string using new operator?

  • Stack
  • String Pool
  • Heap memory
  • Random memory
Mark for review

Which of the following is not a valid Java keyword?

  • strictfp
  • constant
  • goto
  • native
Mark for review

What is the return type of the main method in Java?

  • void
  • int
  • String
  • float
Mark for review

Which of these access specifiers can be used for an interface?

  • public
  • protected
  • private
  • All of the above
Mark for review

Which of the following is not a valid declaration within an interface?

  • public int method();
  • void method();
  • protected void method();
  • static int method();
Mark for review

Which of the following is a checked exception?

  • NullPointerException
  • ClassCastException
  • IOException
  • ArrayIndexOutOfBoundsException
Mark for review

Which of these methods form the interface of Runnable?

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

Which of the following is not a valid Java keyword?

  • transient
  • volatile
  • const
  • synchronized
Mark for review

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

  • int
  • float
  • double
  • long
Mark for review

Which of these keywords is used to define interfaces in Java?

  • interface
  • Interface
  • intf
  • Intf
Mark for review

Which of these packages contains the exception StackOverflowError?

  • java.io
  • java.system
  • java.util
  • java.lang
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