Choice:
A. program print nothing
B. [][]{}
C. [xyz][]{}
D. true[xyz]{}
E. [xyz][xyz]{}
F. true[]{}
G. code does not compile
H. code compiles but throw runtime exceptions.
Explain: Supplier functional interface takes no parameter, returns an object of the defined type. Line 5 declared a Supplier returns an object of type Set<String>. HashSet::new and () -> new HashSet<String>() are method reference and corresponding lambda function. Line 9 defined a Supplier returns an object of type Map<Integer, String>. Supplier functional interface defined the method get(), which is used to get the object supplied by the supplier. An empty HashSet<Object> print a [], an empty HashMap<Integer, String> print a {}. At line 6, s1.get() returns an empty HashSet<String>, at line 7, s.add("xyz") added an element to the set, function Set's add() function returns true or false. At line 8, print(s) calls HashSet's toString() and print [xyz].