AllExam Dumps

DUMPS, FREE DUMPS, VCP5 DUMPS| VMWARE DUMPS, VCP DUMPS, VCP4 DUMPS, VCAP DUMPS, VCDX DUMPS, CISCO DUMPS, CCNA, CCNA DUMPS, CCNP DUMPS, CCIE DUMPS, ITIL, EXIN DUMPS,


READ Free Dumps For Oracle- 1z0-804





Question ID 21451

Given:
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class NameList {
public static void main(String[] args) {
List<String> nameList = new ArrayList<>(3);
nameList.add("John Adams");
nameList.add("George Washington");
nameList.add("Thomas Jefferson");
Collections.sort(nameList);
for (String name : nameList) {
System.out.println(name);
}
}
}

What is the result?

Option A

John Adams
George Washington
Thomas Jefferson

Option B

George Washington
John Adams
Thomas Jefferson

Option C

Thomas Jefferson
John Adams
George Washington

Option D

An exception is thrown at runtime

Option E

Compilation fails

Correct Answer B
Explanation Explanation: The program compiles and runs fine. At runtime the NameList is built and then sorted by natural Order (String >> alphabetically).


Question ID 21452

Given:
import java.util.ArrayDeque;
import java.util.Deque;
public class Counter {
public static void main(String[] args) {
Deque<String> deq = new ArrayDeque<String>(2);
deq.addFirst("one");
deq.addFirst("two");
deq.addFirst("three"); // Line 9
System.out.print(deq.pollLast());
System.out.print(deq.pollLast());
System.out.print(deq.pollLast()); // Line 12
}
}
What is the result?

Option A

An exception is thrown at runtime on line 9.

Option B

An exception is thrown at runtime on line 12

Option C

onetwonull

Option D

onetwothree

Option E

twoonenull

Option F

threetwoone

Correct Answer D
Explanation Explanation: addFirst void addFirst(E e) Inserts the specified element at the front of this deque if it is possible to do so immediately without violating capacity restrictions. When using a capacity-restricted deque, it is generally preferable to use method offerFirst (E). pollLast E pollLast() Retrieves and removes the last element of this deque, or returns null if this deque is empty. Returns: the tail of this deque, or null if this deque is empty

Send email to admin@getfreedumps for new dumps request!!!