Online Exam Quiz

questionQuestion  1 to 30

What is the size of an int variable in Java?

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

Which package is directly available to our class without importing it?

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

What is the default encoding for an InputStreamReader?

  • UTF-8
  • ASCII
  • ISO-8859-1
  • UTF-16
Mark for review

Which of these data types is used to store text in Java?

  • int
  • float
  • char
  • String
Mark for review

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

  • package
  • import
  • include
  • namespace
Mark for review

Which method is used to write bytes to an output stream?

  • read()
  • write()
  • print()
  • display()
Mark for review

Which of the following is not a valid data type in Java?

  • int
  • float
  • double
  • real
Mark for review

Which method of the String class can be used to test if two strings are equal?

  • equals()
  • isEqual()
  • same()
  • matches()
Mark for review

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

  • IOException
  • ServletException
  • NullPointerException
  • IllegalStateException
Mark for review

Which of the following is true about Java?

  • Java is platform-independent
  • Java is a procedural language
  • Java does not support multithreading
  • Java is not object-oriented
Mark for review

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

  • put()
  • get()
  • size()
  • length()
Mark for review

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

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

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

  • package
  • import
  • extends
  • implements
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 method is used to perform some action when an object is to be destroyed?

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

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

  • Intent
  • Activity
  • Services
  • Action
Mark for review

Which of the following is a marker interface?

  • Serializable
  • Cloneable
  • Remote
  • All of the above
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 is used to compare two strings in Java?

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

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

  • Object
  • int
  • long
  • void
Mark for review

Which of these methods is used to find the length of a string in Java?

  • length()
  • size()
  • getLength()
  • getSize()
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 method is used to start a thread in Java?

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

What does JVM stand for?

  • Java Very Machine
  • Java Virtual Machine
  • Java Verified Machine
  • Java Variable Machine
Mark for review

Which operator is used for concatenation of strings in Java?

  • +
  • -
  • *
  • /
Mark for review

Which of the following is used to handle exceptions in Java?

  • try-catch
  • throw
  • throws
  • All of the above
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

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

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 of these is a correct interface not used in the Collection framework?

  • Set
  • SortedList
  • List
  • Map
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