View Mode
Q: 11

Given the code fragment: List empDetails = Arrays.asList(“100, Robin, HR”, “200, Mary, AdminServices”,“101, Peter, HR”); empDetails.stream() .filter(s-> s.contains(“r”)) .sorted() .forEach(System.out::println); //line n1 What is the result?

Options
Q: 12
Given: class Worker extends Thread { CyclicBarrier cb; public Worker(CyclicBarrier cb) { this.cb = cb; } public void run () { try { cb.await(); System.out.println(“Worker…”); } catch (Exception ex) { } } } class Master implements Runnable { //line n1 public void run () { System.out.println(“Master…”); } } and the code fragment: Master master = new Master(); //line n2 Worker worker = new Worker(cb); worker.start(); You have been asked to ensure that the run methods of both the Worker and Master classes are executed. Which modification meets the requirement?
Options
Q: 13
Given: class Student { String course, name, city; public Student (String name, String course, String city) { this.course = course; this.name = name; this.city = city; } public String toString() { return course + “:” + name + “:” + city; } public String getCourse() {return course;} public String getName() {return name;} public String getCity() {return city;} and the code fragment: List stds = Arrays.asList( new Student (“Jessy”, “Java ME”, “Chicago”), new Student (“Helen”, “Java EE”, “Houston”), new Student (“Mark”, “Java ME”, “Chicago”)); stds.stream() .collect(Collectors.groupingBy(Student::getCourse)) .forEach(src, res) -> System.out.println(res)); What is the result?
Options
Q: 14
Given the code fragment: 1Z0-809 question What is the result?
Options
Q: 15
Given: 1Z0-809 question and the code fragment: 1Z0-809 question What is the result?
Options
Q: 16
Given the code fragment: public class Foo { public static void main (String [ ] args) { Map unsortMap = new HashMap ( ); unsortMap.put (10, “z”); unsortMap.put (5, “b”); unsortMap.put (1, “d”); unsortMap.put (7, “e”); unsortMap.put (50, “j”); Map treeMap = new TreeMap (new Comparator ( ) { @Override public int compare (Integer o1, Integer o2) {return o2.compareTo (o1); } } ); treeMap.putAll (unsortMap); for (Map.Entry entry : treeMap.entrySet () ) { System.out.print (entry.getValue () + “ “); } } } What is the result?
Options
Q: 17
Given the records from the STUDENT table: 1Z0-809 question Given the code fragment: 1Z0-809 question Assume that the URL, username, and password are valid. What is the result?
Options
Q: 18
Given the code fragment: List doubles = Arrays.asList (100.12, 200.32); DoubleFunction funD = d –> d + 100.0; doubles.stream (). forEach (funD); // line n1 doubles.stream(). forEach(e –> System.out.println(e)); // line n2 What is the result?
Options
Q: 19
Given: public class product { int id; int price; public Product (int id, int price) { this.id = id; this.price = price; } public String toString() { return id + “:” + price; } } and the code fragment: List products = Arrays.asList(new Product(1, 10), new Product (2, 30), new Product (2, 30)); Product p = products.stream().reduce(new Product (4, 0), (p1, p2) -> { p1.price+=p2.price; return new Product (p1.id, p1.price);}); products.add(p); products.stream().parallel() .reduce((p1, p2) - > p1.price > p2.price ? p1 : p2) .ifPresent(System.out: :println); What is the result?
Options
Q: 20
Given the code fragment: 1Z0-809 question Which two code fragments, when inserted at line n1 independently, result in the output PEEK: Unix?
Options
Question 11 of 20 · Page 2 / 2

Premium Access Includes

  • Quiz Simulator
  • Exam Mode
  • Progress Tracking
  • Question Saving
  • Flash Cards
  • Drag & Drops
  • 3 Months Access
  • PDF Downloads
Get Premium Access
Scroll to Top

FLASH OFFER

Days
Hours
Minutes
Seconds

avail 10% DISCOUNT on YOUR PURCHASE