Free 1z0-809 – Java SE 8 Programmer II Practice Test Question

Free demo downloads

Loading demo links...

Showing 4–6 of 15 questions

Question 4

Given:

Which two interfaces can you use to create lambda expressions? (Choose two.)

Select all that apply, then click Submit answer.

  • ○

    T

  • ○

    R

  • ○

    P

  • ○

    S

  • ○

    Q

  • ○

    U

Question 5

Given:

and the code fragment:

Which two code fragments, when inserted at line n1 independently, enable the code to print TruckCarBike?

Select all that apply, then click Submit answer.

  • ○

    .sorted ((v1, v2) -> v1.getVId() < v2.getVId())

  • ○

    .sorted (Comparable.comparing (Vehicle: :getVName)).reversed ()

  • ○

    .map (v -> v.getVid())
    .sorted ()

  • ○

    .sorted((v1, v2) -> Integer.compare(v1.getVId(), v2.getVid()))

  • ○

    .sorted(Comparator.comparing ((Vehicle v) -> v.getVId()))

Question 6

Given:

public enum USCurrency {

PENNY (1),

NICKLE(5),

DIME (10), QUARTER(25); private int value;

public USCurrency(int value) { this.value = value;

}

public int getValue() {return value;}

} public class Coin {

public static void main (String[] args) { USCurrency usCoin =new USCurrency.DIME;

System.out.println(usCoin.getValue()):

}

}

Which two modifications enable the given code to compile? (Choose two.)

Select all that apply, then click Submit answer.

  • ○

    Nest the USCurrency enumeration declaration within the Coin class.

  • ○

    Make the USCurrency enumeration constructor public.

  • ○

    Remove the new keyword from the instantion of usCoin.

  • ○

    Make the getValue() method public.

  • ○

    Add the final keyword in the declaration of value.