Online Exam Quiz

questionQuestion  1 to 30

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

  • void
  • int
  • String
  • None of the above
Mark for review

Which of these is used to create an object of a class?

  • Constructor
  • method
  • object
  • class
Mark for review

Which of the following is a marker interface?

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

What does the AWT stand for?

  • All Window Tools
  • Abstract Window Toolkit
  • Abstract Windows Toolkit
  • All Windows Toolkit
Mark for review

What is the size of a char variable in Java?

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

Which of these is an interface in the Collections Framework?

  • ArrayList
  • HashSet
  • LinkedList
  • Set
Mark for review

Which method is used to find the character at a specific index in a string?

  • charAt()
  • getChar()
  • indexOf()
  • char()
Mark for review

Which of the following is not a valid flow control statement?

  • if
  • continue
  • exit
  • break
Mark for review

Which of these are selection statements in Java?

  • if()
  • for()
  • continue
  • break()
Mark for review

Which of the following is a valid constructor of the String class?

  • String(String str)
  • String()
  • String(char[] charArray)
  • All of the above
Mark for review

Which operator is considered to be with the highest precedence?

  • =
  • ==
  • ? :
  • ++
Mark for review

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

  • getSize()
  • sizeOf()
  • lengthOf()
  • length()
Mark for review

Which of the following is a marker interface in Java?

  • Runnable
  • Serializable
  • Remote
  • ResultSet
Mark for review

What is a correct way to synchronize a method in Java?

  • synchronized void method()
  • synchronized(method)
  • sync void method()
  • void synchronized method()
Mark for review

Which package contains the Random class?

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

Which exception is thrown when a division by zero occurs?

  • NullPointerException
  • ArithmeticException
  • ArrayIndexOutOfBoundsException
  • NumberFormatException
Mark for review

What is the purpose of the hashCode() method?

  • To compare two objects
  • To generate a unique integer for an object
  • To clone an object
  • To get the memory address of an object
Mark for review

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

  • char ch = 'A';
  • char ch = 65;
  • char ch = '\u0041';
  • char ch = "A";
Mark for review

Which of the following is not an access modifier in Java?

  • public
  • private
  • protected
  • default
Mark for review

What is the extension of compiled java classes?

  • .java
  • .txt
  • .class
  • .js
Mark for review

Which keyword is used to declare a constant variable?

  • final
  • static
  • const
  • immutable
Mark for review

Which keyword is used to inherit a class in Java?

  • implements
  • extends
  • inherits
  • imports
Mark for review

What is the default value of an instance variable in Java?

  • 0
  • null
  • Depends on the data type
  • None of the above
Mark for review

Which package contains the Random class?

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

Which class is used to read from a file in Java?

  • FileReader
  • FileWriter
  • BufferedWriter
  • PrintWriter
Mark for review

Which of the following is not a reserved keyword in Java?

  • class
  • int
  • get
  • if
Mark for review

What is the purpose of the System.gc() method?

  • To start the garbage collector
  • To stop the garbage collector
  • To request the garbage collector to run
  • None of the above
Mark for review

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

  • Polymorphism
  • Inheritance
  • Compilation
  • Encapsulation
Mark for review

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

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

Which method is used to stop the execution of a thread?

  • stop()
  • wait()
  • sleep()
  • terminate()
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