Online Exam Quiz

questionQuestion  1 to 30

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

  • strictfp
  • method
  • function
  • procedure
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 not a reserved keyword in Java?

  • interface
  • enum
  • goto
  • NULL
Mark for review

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

  • abstract
  • class
  • interface
  • extends
Mark for review

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

  • synchronized
  • sync
  • lock
  • thread
Mark for review

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

  • add()
  • remove()
  • size()
  • length()
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 of the String class can be used to test if two strings are equal?

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

Which operator is used for concatenation of strings in Java?

  • +
  • -
  • *
  • /
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 handle exceptions in Java?

  • try-catch block
  • if-else statement
  • switch-case statement
  • for loop
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 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

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 these classes is a part of Java's Collections framework?

  • Stack
  • ArrayList
  • HashSet
  • All of the above
Mark for review

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

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

What does JVM stand for?

  • Java Very Machine
  • Java Virtual Machine
  • Java Verified Machine
  • Java Variable Machine
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 these is a correct interface not used in the Collection framework?

  • Set
  • SortedList
  • List
  • Map
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 the following is not a method of the String class in Java?

  • length()
  • charAt()
  • append()
  • substring()
Mark for review

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

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

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

  • IOException
  • ServletException
  • NullPointerException
  • IllegalStateException
Mark for review

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

  • length()
  • size()
  • getSize()
  • getLength()
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 the following is not a wrapper class in Java?

  • Integer
  • Float
  • Character
  • String
Mark for review

Which class is used to read characters from a file?

  • FileReader
  • BufferedReader
  • FileInputStream
  • FileWriter
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 HashMap class in Java?

  • put()
  • get()
  • size()
  • length()
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