1z0-809 Exam Question 11

Given:
public class Emp {
String fName;
String lName;
public Emp (String fn, String ln) {
fName = fn;
lName = ln;
}
public String getfName() { return fName; }
public String getlName() { return lName; }
}
and the code fragment:
List<Emp> emp = Arrays.asList (
new Emp ("John", "Smith"),
new Emp ("Peter", "Sam"),
new Emp ("Thomas", "Wale"));
emp.stream()
//line n1
.collect(Collectors.toList());
Which code fragment, when inserted at line n1, sorts the employees list in descending order of fNameand then ascending order of lName?
.sorted (Comparator.comparing(Emp::getfName).reserved().thenComparing
  • 1z0-809 Exam Question 12

    Given the code fragment:
    Stream<List<String>> iStr= Stream.of (
    Arrays.asList ("1", "John"),
    Arrays.asList ("2", null)0;
    Stream<<String> nInSt = iStr.flatMapToInt ((x) -> x.stream ());
    nInSt.forEach (System.out :: print);
    What is the result?
  • 1z0-809 Exam Question 13

    Given:
    class ImageScanner implements AutoCloseable {
    public void close () throws Exception {
    System.out.print ("Scanner closed.");
    }
    public void scanImage () throws Exception {
    System.out.print ("Scan.");
    throw new Exception("Unable to scan.");
    }
    }
    class ImagePrinter implements AutoCloseable {
    public void close () throws Exception {
    System.out.print ("Printer closed.");
    }
    public void printImage () {System.out.print("Print."); }
    }
    and this code fragment:
    try (ImageScanner ir = new ImageScanner();
    ImagePrinter iw = new ImagePrinter()) {
    ir.scanImage();
    iw.printImage();
    } catch (Exception e) {
    System.out.print(e.getMessage());
    }
    What is the result?
  • 1z0-809 Exam Question 14

    Given the code fragment:

    What is the result?
  • 1z0-809 Exam Question 15

    Which statement is true about the DriverManagerclass?