01. Which functional interface takes a double value and has a test() method?
a) Double Consumer
b) Double Predicate
c) Double Unary Operator
d) To Double Function
02. How do you change the value of an instance variable in an immutable class?
a) Call the setter method.
b) Remove the final modifier and set the instance variable directly.
c) Use a method other than Option Call the setter method. or Remove the final modifier and set the instance variable directly..
d) You can’t.
03. 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
04. 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
05. Which of the following will print current time?
a) System.out.print(new LocalTime().now());
b) System.out.print(new LocalTime());
e) None of the above.
06. Assuming / is the root directory, which of the following are true statements?
a) /home/parrot is an absolute path.
b) /home/parrot is a directory.
c) /home/parrot is a relative path.
d) The path pointed to from a File object must exist.
e) The parent of the path pointed to by a File object must exist.
07. How do you find out the locale of the running program?
d) None of the above
08. When localizing an application, which type of data varies in presentation depending on locale?
a) Dates and Currencies
09. Which of the following statements about inheritance and object composition are correct?
a) Inheritance supports access to protected variables.
b) Object composition tends to promote greater code reuse than inheritance.
c) Inheritance relies on the has‐a principle.
d) Object composition supports method overriding at runtime.
e) Object composition requires a class variable to be declared public or accessible from a public method to be used by a class in a different package.
f) Object composition is always preferred to inheritance.
10. What best describes a reduction?
a) A terminal operation where one element is returned from the prior step in a stream pipeline without reading all the elements
b) A terminal operation where a single value is generated by reading each element in the prior step in a stream pipeline
c) An intermediate operation where it mathematically divides each element in the stream
d) An intermediate operation where it filters the stream it receives