Online Exam Quiz

questionQuestion  1 to 30

Which of the following is not a valid Java identifier?

  • _myVar
  • $myVar
  • 123myVar
  • myVar123
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?

  • HashSet
  • LinkedHashSet
  • ArrayList
  • TreeSet
Mark for review

Which of the following is not a valid method of the Stack class in Java?

  • push()
  • pop()
  • size()
  • length()
Mark for review

Which of the following is a valid declaration of a byte?

  • byte b = 128;
  • byte b = 0;
  • byte b = -129;
  • byte b = 256;
Mark for review

In Java, what is the correct syntax to output "Hello World"?

  • System.out.println("Hello World");
  • print("Hello World");
  • echo("Hello World");
  • Console.WriteLine("Hello World");
Mark for review

Which of the following is not a valid method of the Math class in Java?

  • abs()
  • ceil()
  • floor()
  • round()
Mark for review

Which of the following is not a valid method of the TreeSet class in Java?

  • add()
  • remove()
  • size()
  • length()
Mark for review

Which of the following is not a valid access modifier in Java?

  • public
  • private
  • protected
  • package
Mark for review

Which of these classes is not part of Java?s Collection framework?

  • HashMap
  • Hashtable
  • TreeMap
  • LinkedList
Mark for review

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

  • class
  • package
  • interface
  • implements
Mark for review

Which of the following is not a Java keyword?

  • static
  • Boolean
  • void
  • private
Mark for review

Which of these is not a valid component of the Android architecture?

  • Intent
  • Activity
  • Services
  • Action
Mark for review

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

  • Object
  • int
  • long
  • void
Mark for review

What is the use of the 'final' keyword in Java?

  • To define constants
  • To prevent method overriding
  • To prevent inheritance
  • All of the above
Mark for review

Which keyword is used to inherit a class in Java?

  • extends
  • implements
  • inherit
  • this
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 start a thread in Java?

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

Which method can be defined only once in a program?

  • main method
  • finalize method
  • static method
  • private method
Mark for review

Which of the following is used to create a volatile variable in Java?

  • volatile
  • variable
  • var
  • volatileVar
Mark for review

Which of the following is not a valid method of the Vector class in Java?

  • add()
  • remove()
  • size()
  • length()
Mark for review

Which of the following is used to create a synchronized block in Java?

  • synchronized
  • sync
  • lock
  • thread
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 perform some action when an object is to be destroyed?

  • finalize()
  • delete()
  • remove()
  • destructor()
Mark for review

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

  • TRUE
  • FALSE
  • null
  • 0
Mark for review

Which of the following is not a type of loop in Java?

  • for
  • while
  • do-while
  • repeat-until
Mark for review

What is the superclass of all classes in Java?

  • java.lang.String
  • java.lang.Object
  • java.lang.System
  • java.lang.Class
Mark for review

Which of the following is used to create an object in Java?

  • new
  • create
  • object
  • instance
Mark for review

Which of the following is used to read data from a file in Java?

  • FileReader
  • FileWriter
  • FileInputStream
  • FileOutputStream
Mark for review

Which of the following is not a type of constructor?

  • Default constructor
  • No-argument constructor
  • Parameterized constructor
  • Copy constructor
Mark for review

Which class is used to read characters from a file?

  • FileReader
  • BufferedReader
  • FileInputStream
  • FileWriter
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