Advanced Java Programming
Java Collections, I/O Streams, and String Methods
Questions
Which of the following methods in Map.Entry interface in Java returns the value for the map entry?
- getKey()
- getValue()
- hashCode()
- none of these
Which of the following methods, declared by Map interface, returns a Set that contains the entries in the Map interface?
- containsKey()
- containsValue()
- entrySet()
- none of these
In Java, which of the following is implemented by extending AbstractSequentialList class?
- AbstractCollection
- AbstractList
- LinkedList
- None of these
Which of the following in collection classes in Java implements a set stored in a tree and also extends AbstractSet class?
- ArrayList
- TreeSet
- AbstractSet
- HashSet
Which of the following methods in ListIterator class returns true if there is a next element otherwise returns false?
- add()
- hasPrevious()
- next()
- hasNext()
Which of the following methods in SortedMap interface returns the invoking sorted maps comparator?
- comparator()
- firstKey()
- headMap()
- none of these
Which of the following methods in stack class java returns the element on the top of the stack, but does not remove it?
- empty()
- peek()
- pop()
- none of these
Which of the following methods in vector class of java returns the capacity of the vector?
- addElement()
- clone()
- capacity()
- none of these
Which of the following methods in vector class of java returns the string equivalent of the vector?
- size()
- compareTo()
- toString()
- none of these
Which of the following classes in java allows one or more characters to be returned to the input stream?
- PushbackReader
- BufferedWriter
- BufferedReader
- None of these
Which of the following in Java counts the number of lines in the input stream?
- LineNumberReader
- InputStreamReader
- FilterReader
- None of these
Which of the following methods is used in string class of java to extract a single character from a string?
- getChars()
- charAt()
- getBytes()
- none of these
Which of the following in java contains print() and println() methods?
- Reader
- Writer
- PrintWriter
- None of these
Which of the following statements about equals() method and '==' operator in java is correct?
- The method and the operator perform the same operation.
- The method and the operator perform different operations.
- There is no equals() method supported by java.
- None of these
Which of the following methods in string class of java searches for the last occurrence of a character or substring?
- indexOf()
- substring()
- lastIndexOf()
- none of these