Question 66

Given the code fragment:

What is the result?
  • Question 67

    Given the code fragments :

    and

    What is the result?
  • Question 68

    Given the definition of the Country class:
    public class country {
    public enum Continent {ASIA, EUROPE}
    String name;
    Continent region;
    public Country (String na, Continent reg) {
    name = na, region = reg;
    }
    public String getName () {return name;}
    public Continent getRegion () {return region;}
    }
    and the code fragment:
    List<Country> couList = Arrays.asList (
    new Country ("Japan", Country.Continent.ASIA),
    new Country ("Italy", Country.Continent.EUROPE),
    new Country ("Germany", Country.Continent.EUROPE));
    Map<Country.Continent, List<String>> regionNames = couList.stream ()
    .collect(Collectors.groupingBy (Country ::getRegion,
    Collectors.mapping(Country::getName, Collectors.toList()))));
    System.out.println(regionNames);
    What is the output?
  • Question 69

    In 2015, daylight saving time in New York, USA, begins on March 8th at 2:00 AM. As a result, 2:00 AM
    becomes 3:00 AM.
    Given the code fragment:

    Which is the result?
  • Question 70

    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?
    Travel time is 4 hours