Weekend Sale - Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: sntaclus

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?

A.

3:00 – difference: 2

B.

2:00 – difference: 1

C.

4:00 – difference: 3

D.

4:00 – difference: 2

Given the code fragment:

public static void main (String [ ] args) throws IOException {

BufferedReader br = new BufferedReader (new InputStremReader (System.in));

System.out.print (“Enter GDP: “);

//line 1

}

Which code fragment, when inserted at line 1, enables the code to read the GDP from the user?

A.

int GDP = Integer.parseInt (br.readline());

B.

int GDP = br.read();

C.

int GDP = br.nextInt();

D.

int GDP = Integer.parseInt (br.next());

Given the content of Operator.java, EngineOperator.java, and Engine.java files:

and the code fragment:

What is the result?

A.

The Engine.java file fails to compile.

B.

The EngineOperator.java file fails to compile.

C.

The Operator.java file fails to compile.

D.

ON OFF

Given:

IntStream stream = IntStream.of (1,2,3);

IntFunction inFu= x -> y -> x*y;//line n1

IntStream newStream = stream.map(inFu.apply(10));//line n2

newStream.forEach(System.out::print);

Which modification enables the code fragment to compile?

A.

Replace line n1 with:IntFunction inFu = x -> y -> x*y;

B.

Replace line n1 with:IntFunction inFu = x -> y -> x*y;

C.

Replace line n1 with:BiFunction inFu = x -> y -> x*y;

D.

Replace line n2 with:IntStream newStream = stream.map(inFu.applyAsInt (10));

Given:

class FuelNotAvailException extends Exception { }

class Vehicle {

void ride() throws FuelNotAvailException {//line n1

System.out.println(“Happy Journey!”);

}

}

class SolarVehicle extends Vehicle {

public void ride () throws Exception {//line n2

super ride ();

}

}

and the code fragment:

public static void main (String[] args) throws FuelNotAvailException, Exception {

Vehicle v = new SolarVehicle ();

v.ride();

}

Which modification enables the code fragment to print Happy Journey!?

A.

Replace line n1 with public void ride() throws FuelNotAvailException {

B.

Replace line n1 with protected void ride() throws Exception {

C.

Replace line n2 with void ride() throws Exception {

D.

Replace line n2 with private void ride() throws FuelNotAvailException {

Given the code fragment:

List colors = Arrays.asList(“red”, “green”, “yellow”);

Predicate test = n - > {

System.out.println(“Searching…”);

return n.contains(“red”);

};

colors.stream()

.filter(c -> c.length() >= 3)

.allMatch(test);

What is the result?

A.

Searching…

B.

Searching…Searching…

C.

Searching…Searching…Searching…

D.

A compilation error occurs.

Given the code fragment:

List codes = Arrays.asList (“DOC”, “MPEG”, “JPEG”);

codes.forEach (c -> System.out.print(c + “ “));

String fmt = codes.stream()

.filter (s-> s.contains (“PEG”))

.reduce((s, t) -> s + t).get();

System.out.println(“\n” + fmt);

What is the result?

A.

DOC MPEG JPEGMPEGJPEG

B.

DOC MPEG MPEGJPEGMPEGMPEGJPEG

C.

MPEGJPEGMPEGJPEG

D.

The order of the output is unpredictable.

Given the code fragment:

public static void main (String[] args) throws IOException {

BufferedReader brCopy = null;

try (BufferedReader br = new BufferedReader (new FileReader(“employee.txt”))) { //

line n1

br.lines().forEach(c -> System.out.println(c));

brCopy = br;//line n2

}

brCopy.ready(); //line n3;

}

Assume that the ready method of the BufferedReader, when called on a closed BufferedReader, throws an exception, and employee.txt is accessible and contains valid text.

What is the result?

A.

A compilation error occurs at line n3.

B.

A compilation error occurs at line n1.

C.

A compilation error occurs at line n2.

D.

The code prints the content of the employee.txt file and throws an exception at line n3.

Given the code fragment:

Map books = new TreeMap<>();

books.put (1007, “A”);

books.put (1002, “C”);

books.put (1003, “B”);

books.put (1003, “B”);

System.out.println (books);

What is the result?

A.

{1007=A, 1003=B, 1002=C}

B.

{1007=A, 1003=B, 1003=B, 1002=C}

C.

{1007=A, 1002=C, 1003=B, 1003=B}

D.

{1002=C, 1003=B, 1007=A}

Given the code fragment:

Stream> iStr= Stream.of (

Arrays.asList (“1”, “John”),

Arrays.asList (“2”, null)0;

Stream< nInSt = iStr.flatMapToInt ((x) -> x.stream ());

nInSt.forEach (System.out :: print);

What is the result?

A.

1John2null

B.

12

C.

A NullPointerException is thrown at run time.

D.

A compilation error occurs.