Online Exam Quiz

questionQuestion  1 to 30

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

  • class
  • package
  • interface
  • implements
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

What does the 'static' keyword mean in Java?

  • The variable or method is specific to an instance of a class
  • The variable or method is specific to the class
  • The variable or method can be accessed anywhere
  • None of the above
Mark for review

Which of the following is not a wrapper class in Java?

  • Integer
  • Double
  • Character
  • int
Mark for review

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

  • volatile
  • variable
  • var
  • volatileVar
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 is the valid declaration within an interface definition?

  • public double methoda();
  • public final double methoda();
  • static void methoda(double d1);
  • protected void methoda(double d1);
Mark for review

Which method is used to compare two strings in Java?

  • equals()
  • compare()
  • compareTo()
  • equalsIgnoreCase()
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 these data types is used to store text in Java?

  • int
  • float
  • char
  • String
Mark for review

Which of these is a mechanism for cleaning the internal state of an object before it is removed from memory?

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

Which of these exceptions is thrown when the servlet is not initialized properly?

  • IOException
  • ServletException
  • NullPointerException
  • IllegalStateException
Mark for review

Which keyword is used to inherit a class in Java?

  • extends
  • implements
  • inherits
  • super
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 used to create a thread in Java?

  • Runnable interface
  • Thread class
  • Both A and B
  • None of the above
Mark for review

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

  • abstract
  • class
  • interface
  • extends
Mark for review

Which keyword is used to declare a constant in Java?

  • const
  • static
  • final
  • abstract
Mark for review

Which of the following statements is true about Java?

  • Java is a platform-independent language
  • Java is a procedural language
  • Java is a pure object-oriented language
  • Java supports both procedural and object-oriented programming
Mark for review

What is the size of an int variable in Java?

  • 4 bytes
  • 8 bytes
  • 2 bytes
  • 1 byte
Mark for review

Which method is used to start a thread in Java?

  • run()
  • start()
  • begin()
  • init()
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 of the following is a reserved keyword in Java?

  • array
  • goto
  • null
  • constant
Mark for review

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

  • Intent
  • Activity
  • Services
  • Action
Mark for review

Which of these methods is a part of the Object class in Java?

  • toString()
  • equals()
  • hashCode()
  • All of the above
Mark for review

Which is not a valid way to declare an array in Java?

  • int arr[] = new int[5];
  • int arr[] = {1, 2, 3, 4, 5};
  • int arr[];
  • int arr[5] = new int[];
Mark for review

Which of the following is used to create a static method in Java?

  • static
  • method
  • function
  • procedure
Mark for review

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

  • interface
  • class
  • implements
  • extends
Mark for review

Which of the following is used to create a final class in Java?

  • final
  • class
  • interface
  • extends
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

Which collection class allows you to access its elements by associating a key with an element's value, and provides synchronization?

  • java.util.ArrayList
  • java.util.HashMap
  • java.util.Hashtable
  • java.util.TreeMap
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