Question 51

Given the code fragment:

Which statement is true?
  • Question 52

    Given the code fragment:
    List<String> str = Arrays.asList ("my", "pen", "is", "your', "pen");
    Predicate<String> test = s -> {
    int i = 0;
    boolean result = s.contains ("pen");
    System.out.print(i++) + ":");
    return result;
    };
    str.stream()
    .filter(test)
    .findFirst()
    .ifPresent(System.out ::print);
    What is the result?
  • Question 53

    Assume customers.txtis accessible and contains multiple lines.
    Which code fragment prints the contents of the customers.txtfile?
    Stream<String> stream = Files.find (Paths.get ("customers.txt"));
  • Question 54

    Given the code fragment:

    What is the result?
  • Question 55

    Given the code fragment:
    ZonedDateTime depart = ZonedDateTime.of(2015, 1, 15, 3, 0, 0, 0, ZoneID.of("UTC-7")); ZonedDateTime arrive = ZonedDateTime.of(2015, 1, 15, 9, 0, 0, 0, ZoneID.of("UTC-5")); long hrs = ChronoUnit.HOURS.between(depart, arrive); //line n1 System.out.println("Travel time is" + hrs + "hours");
    What is the result?