01. What is a common reason for a stream pipeline not to run?
a) The source doesn’t generate any items.
b) There are no intermediate operations.
c) The terminal operation is missing.
d) None of the above
02. How do you find out the locale of the running program?
d) None of the above
03. What technique allows multiple variables from the same class to be shared across all instances of a class?
04. Under which circumstances does Files.deleteIfExists() not throw an exception?
a) The file system suddenly becomes unavailable.
b) The path does not exist.
c) The path represents a non-empty directory.
d) The process does not have write access to a path.
05. Which NIO.2 method is most similar to the legacy java.io.File.listFiles() method?
06. Suppose that you need to work with a collection of elements that need to be sorted in their natural order, and each element has a unique string associated with its value. Which of the following collections classes in the java.util package best suit your needs for this scenario?
a) Array List
b) Hash Map
c) Hash Set
d) Tree Map
e) Tree Set
07. Which of the following statements are true, assuming a and b are String objects?
a) If a.equals(b) is true, a.hashCode() == b.hashCode() is always true.
b) If a.equals(b) is true, a.hashCode() == b.hashCode() is sometimes but not always true.
c) If a.equals(b) is false, a.hashCode() == b.hashCode() can never be true.
d) If a.equals(b) is false, a.hashCode() == b.hashCode() can sometimes be true.
08. Choose the class that is least likely to be marked Serializable.
a) A class that holds data about the amount of rain that has fallen in a given year
b) A class that manages the memory of running processes in an application
c) A class that stores information about apples in an orchard
d) A class that tracks the amount of candy in a gumball machine
09. What best describes a reduction?
a) An intermediate operation where it filters the stream it receives
b) An intermediate operation where it mathematically divides each element in the stream
c) A terminal operation where a single value is generated by reading each element in the prior step in a stream pipeline
d) A terminal operation where one element is returned from the prior step in a stream pipeline without reading all the elements
10. When localizing an application, which type of data varies in presentation depending on locale?