Summer Special Sale - Limited Time 60% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: 575363r9

Welcome To DumpsPedia

1z0-809 Sample Questions Answers

Questions 4

Given the code fragment:

What is the result?

Options:

A.

Word: why what when

B.

Word: why Word: why what Word: why what when

C.

Word: why Word: what Word: when

D.

Compilation fails at line n1.

Buy Now
Questions 5

Given:

and the command:

java Product 0

What is the result?

Options:

A.

An AssertionError is thrown.

B.

A compilation error occurs at line n1.

C.

New Price: 0.0

D.

A NumberFormatException is thrown at run time.

Buy Now
Questions 6

Given:

public class Test {

private T t;

public T get () {

return t;

}

public void set (T t) {

this.t = t;

}

public static void main (String args [ ] ) {

Test type = new Test<>();

Test type 1 = new Test ();//line n1

type.set(“Java”);

type1.set(100);//line n2

System.out.print(type.get() + “ “ + type1.get());

}

}

What is the result?

Options:

A.

Java 100

B.

java.lang.string@java.lang.Integer@

C.

A compilation error occurs. To rectify it, replace line n1 with:Test type1 = new Test<>();

D.

A compilation error occurs. To rectify it, replace line n2 with:type1.set (Integer(100));

Buy Now
Questions 7

Which two reasons should you use interfaces instead of abstract classes? (Choose two.)

Options:

A.

You expect that classes that implement your interfaces have many common methods or fields, or require access modifiers other than public.

B.

You expect that unrelated classes would implement your interfaces.

C.

You want to share code among several closely related classes.

D.

You want to declare non-static on non-final fields.

E.

You want to take advantage of multiple inheritance of type.

Buy Now
Questions 8

Given:

and the code fragment:

What is the result?

Options:

A.

truetrue

B.

falsetrue

C.

falsefalse

D.

truefalse

Buy Now
Questions 9

Given:

class CheckClass {

public static int checkValue (String s1, String s2) {

return s1 length() – s2.length();

}

}

and the code fragment:

String[] strArray = new String [] {“Tiger”, “Rat”, “Cat”, “Lion”}

//line n1

for (String s : strArray) {

System.out.print (s + “ “);

}

Which code fragment should be inserted at line n1 to enable the code to print Rat Cat Lion Tiger?

Options:

A.

Arrays.sort(strArray, CheckClass : : checkValue);

B.

Arrays.sort(strArray, (CheckClass : : new) : : checkValue);

C.

Arrays.sort(strArray, (CheckClass : : new).checkValue);

D.

Arrays.sort(strArray, CheckClass : : new : : checkValue);

Buy Now
Questions 10

Given the content:

and given the code fragment:

Which two code fragments, when inserted at line 1 independently, enable the code to print “Wie geht’s?”

Options:

A.

currentLocale = new Locale (“de”, “DE”);

B.

currentLocale = new Locale.Builder ().setLanguage (“de”).setRegion (“DE”).build();

C.

currentLocale = Locale.GERMAN;

D.

currentlocale = new Locale();currentLocale.setLanguage (“de”);currentLocale.setRegion (“DE”);

E.

currentLocale = Locale.getInstance(Locale.GERMAN,Locale.GERMANY);

Buy Now
Questions 11

Given the code fragment:

Path path1 = Paths.get(“/app/./sys/”);

Path res1 = path1.resolve(“log”);

Path path2 = Paths.get(“/server/exe/”);

Path res1 = path2.resolve(“/readme/”);

System.out.println(res1);

System.out.println(res2);

What is the result?

Options:

A.

/app/sys/log/readme/server/exe

B.

/app/log/sys/server/exe/readme

C.

/app/./sys/log/readme

D.

/app/./sys/log/server/exe/readme

Buy Now
Questions 12

Given:

and the code fragment:

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

Options:

A.

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

B.

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

C.

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

D.

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

E.

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

Buy Now
Questions 13

Given:

class Vehicle implements Comparable{

int vno;

String name;

public Vehicle (int vno, String name) {

this.vno = vno,;

this.name = name;

}

public String toString () {

return vno + “:” + name;

}

public int compareTo(Vehicle o) {

return this.name.compareTo(o.name);

}

and this code fragment:

Set vehicles = new TreeSet <> ();

vehicles.add(new Vehicle (10123, “Ford”));

vehicles.add(new Vehicle (10124, “BMW”));

System.out.println(vehicles);

What is the result?

Options:

A.

[10123:Ford, 10124:BMW]

B.

[10124:BMW, 10123:Ford]

C.

A compilation error occurs.

D.

A ClassCastException is thrown at run time.

Buy Now
Questions 14

Given the code fragment:

BiFunction val = (t1, t2) -> t1 + t2;//line n1

System.out.println(val.apply(10, 10.5));

What is the result?

Options:

A.

20

B.

20.5

C.

A compilation error occurs at line n1.

D.

A compilation error occurs at line n2.

Buy Now
Questions 15

Given the code fragments:

class MyThread implements Runnable {

private static AtomicInteger count = new AtomicInteger (0);

public void run () {

int x = count.incrementAndGet();

System.out.print (x+” “);

}

}

and

Thread thread1 = new Thread(new MyThread());

Thread thread2 = new Thread(new MyThread());

Thread thread3 = new Thread(new MyThread());

Thread [] ta = {thread1, thread2, thread3};

for (int x= 0; x < 3; x++) {

ta[x].start();

}

Which statement is true?

Options:

A.

The program prints 1 2 3 and the order is unpredictable.

B.

The program prints 1 2 3.

C.

The program prints 1 1 1.

D.

A compilation error occurs.

Buy Now
Questions 16

Which two are elements of a singleton class? (Choose two.)

Options:

A.

a transient reference to point to the single instance

B.

a public method to instantiate the single instance

C.

a public static method to return a copy of the singleton reference

D.

a private constructor to the class

E.

a public reference to point to the single instance

Buy Now
Questions 17

Given the code fragments:

class TechName {

String techName;

TechName (String techName) {

this.techName=techName;

}

}

and

List tech = Arrays.asList (

new TechName(“Java-“),

new TechName(“Oracle DB-“),

new TechName(“J2EE-“)

);

Stream stre = tech.stream();

//line n1

Which should be inserted at line n1 to print Java-Oracle DB-J2EE-?

Options:

A.

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

B.

stre.map(a-> a.techName).forEach(System.out::print);

C.

stre.map(a-> a).forEachOrdered(System.out::print);

D.

stre.forEachOrdered(System.out::print);

Buy Now
Questions 18

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:

A.

100, Robin, HR101, Peter, HR

B.

E. A compilation error occurs at line n1.

C.

101, Peter, HR200, Mary, AdminServices

D.

100, Robin, HR200, Mary, AdminServices101, Peter, HR

Buy Now
Questions 19

Given the code fragment:

Map books = new TreeMap<>();

books.put (1007, “A”);

books.put (1002, “C”);

books.put (1001, “B”);

books.put (1003, “B”);

System.out.println (books);

What is the result?

Options:

A.

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

B.

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

C.

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

D.

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

Buy Now
Questions 20

What is the result?

Options:

A.

A compilation error occurs at line 7.

B.

100

C.

A compilation error occurs at line 8.

D.

A compilation error occurs at line 15.

Buy Now
Questions 21

Given:

Item table

• ID, INTEGER: PK

• DESCRIP, VARCHAR(100)

• PRICE, REAL

• QUANTITY< INTEGER

And given the code fragment:

9. try {

10.Connection conn = DriveManager.getConnection(dbURL, username, password);

11. String query = “Select * FROM Item WHERE ID = 110”;

12. Statement stmt = conn.createStatement();

13. ResultSet rs = stmt.executeQuery(query);

14.while(rs.next()) {

15.System.out.println(“ID:“ + rs.getString(1));

16.System.out.println(“Description:“ + rs.getString(2));

17.System.out.println(“Price:“ + rs.getString(3));

18. System.out.println(Quantity:“ + rs.getString(4));

19.}

20. } catch (SQLException se) {

21. System.out.println(“Error”);

22. }

Assume that:

The required database driver is configured in the classpath.

The appropriate database is accessible with the dbURL, userName, and passWord exists.

The SQL query is valid.

What is the result?

Options:

A.

An exception is thrown at runtime.

B.

Compilation fails.

C.

The code prints Error.

D.

The code prints information about Item 110.

Buy Now
Questions 22

Given:

interface Rideable {Car getCar (String name); }

class Car {

private String name;

public Car (String name) {

this.name = name;

}

}

Which code fragment creates an instance of Car?

Options:

A.

Car auto = Car (“MyCar”): : new;

B.

Car auto = Car : : new;Car vehicle = auto : : getCar(“MyCar”);

C.

Rideable rider = Car : : new;Car vehicle = rider.getCar(“MyCar”);

D.

Car vehicle = Rideable : : new : : getCar(“MyCar”);

Buy Now
Questions 23

Given the code fragment:

Which is the valid definition of the Course enum?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Buy Now
Questions 24

Which statement is true about java.util.stream.Stream?

Options:

A.

A stream cannot be consumed more than once.

B.

The execution mode of streams can be changed during processing.

C.

Streams are intended to modify the source data.

D.

A parallel stream is always faster than an equivalent sequential stream.

Buy Now
Questions 25

Which two statements are true about localizing an application? (Choose two.)

Options:

A.

Support for new regional languages does not require recompilation of the code.

B.

Textual elements (messages and GUI labels) are hard-coded in the code.

C.

Language and region-specific programs are created using localized data.

D.

Resource bundle files include data and currency information.

E.

Language codes use lowercase letters and region codes use uppercase letters.

Buy Now
Questions 26

Given the code fragment:

List empDetails = Arrays.asList(“100, Robin, HR”,

“200, Mary, AdminServices”,

“101, Peter, HR”);

empDetails.stream()

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

.sorted()

.forEach(System.out::println); //line n1

What is the result?

Options:

A.

100, Robin, HR101, Peter, HR

B.

E. A compilation error occurs at line n1.

C.

100, Robin, HR101, Peter, HR200, Mary, AdminServices

D.

100, Robin, HR200, Mary, AdminServices101, Peter, HR

Buy Now
Questions 27

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?

Options:

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}

Buy Now
Questions 28

Given the code fragment:

UnaryOperator uo1 = s -> s*2;//line n1

List loanValues = Arrays.asList(1000.0, 2000.0);

loanValues.stream()

.filter(lv -> lv >= 1500)

.map(lv -> uo1.apply(lv))//line n2

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

What is the result?

Options:

A.

4000.0

B.

4000

C.

A compilation error occurs at line n1.

D.

A compilation error occurs at line n2.

Buy Now
Questions 29

Given the structure of the STUDENT table:

Student (id INTEGER, name VARCHAR)

Given:

public class Test {

static Connection newConnection =null;

public static Connection get DBConnection () throws SQLException {

try (Connection con = DriveManager.getConnection(URL, username, password)) {

newConnection = con;

}

return newConnection;

}

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

get DBConnection ();

Statement st = newConnection.createStatement();

st.executeUpdate(“INSERT INTO student VALUES (102, ‘Kelvin’)”);

}

}

Assume that:

The required database driver is configured in the classpath.

The appropriate database is accessible with the URL, userName, and passWord exists.

The SQL query is valid.

What is the result?

Options:

A.

The program executes successfully and the STUDENT table is updated with one record.

B.

The program executes successfully and the STUDENT table is NOT updated with any record.

C.

A SQLException is thrown as runtime.

D.

A NullPointerException is thrown as runtime.

Buy Now
Questions 30

You want to create a singleton class by using the Singleton design pattern.

Which two statements enforce the singleton nature of the design? (Choose two.)

Options:

A.

Make the class static.

B.

Make the constructor private.

C.

Override equals() and hashCode() methods of the java.lang.Object class.

D.

Use a static reference to point to the single instance.

E.

Implement the Serializable interface.

Buy Now
Questions 31

Given that version.txt is accessible and contains:

1234567890

and given the code fragment:

What is the result?

Options:

A.

121

B.

122

C.

135

D.

The program prints nothing.

Buy Now
Questions 32

Given:

class Book {

int id;

String name;

public Book (int id, String name) {

this.id = id;

this.name = name;

}

public boolean equals (Object obj) { //line n1

boolean output = false;

Book b = (Book) obj;

if (this.id = = b.id) {

output = true;

}

return output;

}

}

and the code fragment:

Book b1 = new Book (101, “Java Programing”);

Book b2 = new Book (102, “Java Programing”);

System.out.println (b1.equals(b2)); //line n2

Which statement is true?

Options:

A.

The program prints true.

B.

The program prints false.

C.

A compilation error occurs. To ensure successful compilation, replace line n1 with:boolean equals (Book obj) {

D.

A compilation error occurs. To ensure successful compilation, replace line n2 with:System.out.println (b1.equals((Object) b2));

Buy Now
Questions 33

Given:

1. abstract class Shape {

2. Shape ( ) { System.out.println (“Shape”); }

3. protected void area ( ) { System.out.println (“Shape”); }

4. }

5.

6. class Square extends Shape {

7. int side;

8. Square int side {

9./* insert code here */

10. this.side = side;

11. }

12. public void area ( ) { System.out.println (“Square”); }

13. }

14. class Rectangle extends Square {

15. int len, br;

16. Rectangle (int x, int y) {

17. /* insert code here */

18. len = x, br = y;

19. }

20. void area ( ) { System.out.println (“Rectangle”); }

21. }

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

Options:

A.

At line 1, remove abstract

B.

At line 9, insert super ( );

C.

At line 12, remove public

D.

At line 17, insert super (x);

E.

At line 17, insert super (); super.side = x;

F.

At line 20, use public void area ( ) {

Buy Now
Questions 34

Given the code fragment:

Which modification enables the code to print Price 5 New Price 4?

Options:

A.

Replace line n2 with .map (n -> System.out.println (“New Price” + n –1)) and remove line n3

B.

Replace line n2 with .mapToInt (n -> n – 1);

C.

Replace line n1 with .forEach (e -> System.out.print (“Price” + e))

D.

Replace line n3 with .forEach (n -> System.out.println (“New Price” + n));

Buy Now
Questions 35

Given the code fragment:

Which statement can be inserted into line n1 to print 1,2; 1,10; 2,20;?

Options:

A.

BiConsumer c = (i, j) -> {System.out.print (i + “,” + j+ “; “);};

B.

BiFunction c = (i, j) –> {System.out.print (i + “,” + j+ “; “)};

C.

BiConsumer c = (i, j) –> {System.out.print (i + “,” + j+ “; “)};

D.

BiConsumer c = (i, j) –> {System.out.print (i + “,” + j+ “; “);};

Buy Now
Questions 36

Given the code fragment:

Which should be inserted into line n1 to print Average = 2.5?

Options:

A.

IntStream str = Stream.of (1, 2, 3, 4);

B.

IntStream str = IntStream.of (1, 2, 3, 4);

C.

DoubleStream str = Stream.of (1.0, 2.0, 3.0, 4.0);

D.

Stream str = Stream.of (1, 2, 3, 4);

Buy Now
Questions 37

Given the code fragments:

and

Which two modifications enable to sort the elements of the emps list? (Choose two.)

Options:

A.

Replace line n1 withclass Person extends Comparator

B.

At line n2 insertpublic int compareTo (Person p) {return this.name.compareTo (p.name);}

C.

Replace line n1 withclass Person implements Comparable

D.

At line n2 insertpublic int compare (Person p1, Person p2) {return p1.name.compareTo (p2.name);}

E.

At line n2 insert:public int compareTo (Person p, Person p2) {return p1.name.compareTo (p2.name);}

F.

Replace line n1 withclass Person implements Comparator

Buy Now
Questions 38

Given:

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

Options:

A.

T

B.

R

C.

P

D.

S

E.

Q

F.

U

Buy Now
Questions 39

Given the code fragment:

What is the result?

Options:

A.

Java EEJava EESE

B.

Java EESE

C.

The program prints either:Java EEJava SEorJava SEJava EE

D.

Java EEJava SE

Buy Now
Questions 40

Given:

Book.java:

public class Book {

private String read(String bname) { return “Read” + bname }

}

EBook.java:

public class EBook extends Book {

public class String read (String url) { return “View” + url }

}

Test.java:

public class Test {

public static void main (String[] args) {

Book b1 = new Book();

b1.read(“Java Programing”);

Book b2 = new EBook();

b2.read(“http://ebook.com/ebook”);

}

}

What is the result?

Options:

A.

Read Java ProgrammingView http:/ ebook.com/ebook

B.

Read Java ProgrammingRead http:/ ebook.com/ebook

C.

The EBook.java file fails to compile.

D.

The Test.java file fails to compile.

Buy Now
Questions 41

Given the code fragment:

What is the result?

Options:

A.

A compilation error occurs.

B.

[Java, J2EE, J2ME, JSTL, JSP]

C.

null

D.

[Java, J2EE, J2ME, JSTL]

Buy Now
Questions 42

For which three objects must a vendor provide implementations in its JDBC driver? (Choose three.)

Options:

A.

Time

B.

Date

C.

Statement

D.

ResultSet

E.

Connection

F.

SQLException

G.

DriverManager

Buy Now
Questions 43

Given that course.txt is accessible and contains:

Course : : Java

and given the code fragment:

public static void main (String[ ] args) {

int i;

char c;

try (FileInputStream fis = new FileInputStream (“course.txt”);

InputStreamReader isr = new InputStreamReader(fis);) {

while (isr.ready()) { //line n1

isr.skip(2);

i = isr.read ();

c = (char) i;

System.out.print(c);

}

} catch (Exception e) {

e.printStackTrace();

}

}

What is the result?

Options:

A.

ur :: va

B.

ueJa

C.

The program prints nothing.

D.

A compilation error occurs at line n1.

Buy Now
Questions 44

Which action can be used to load a database driver by using JDBC3.0?

Options:

A.

Add the driver class to the META-INF/services folder of the JAR file.

B.

Include the JDBC driver class in a jdbc.properties file.

C.

Use the java.lang.Class.forName method to load the driver class.

D.

Use the DriverManager.getDriver method to load the driver class.

Buy Now
Questions 45

Given the code fragment:

Assume that the value of now is 6:30 in the morning.

What is the result?

Options:

A.

An exception is thrown at run time.

B.

0

C.

60

D.

1

Buy Now
Questions 46

Given the code fragment:

What is the result?

Options:

A.

text1text2

B.

text1text2text2text3

C.

text1

D.

[text1, text2]

Buy Now
Questions 47

Given the code fragment:

What is the result?

Options:

A.

A compilation error occurs at line n1.

B.

Logged out at: 2015-01-12T21:58:19.880Z

C.

Can’t logout

D.

Logged out at: 2015-01-12T21:58:00Z

Buy Now
Questions 48

Given the code fragment:

Which code fragment, when inserted at line n1, ensures false is printed?

Options:

A.

boolean b = cs.stream() .findAny() .get() .equals(“Java”);

B.

boolean b = cs.stream() .anyMatch (w -> w.equals (“Java”));

C.

boolean b = cs.stream() .findFirst() .get() .equals(“Java”);

D.

boolean b = cs.stream() .allMatch(w -> w.equals(“Java”));

Buy Now
Questions 49

Which code fragment is required to load a JDBC 3.0 driver?

Options:

A.

Connection con = Connection.getDriver(“jdbc:xyzdata://localhost:3306/EmployeeDB”);

B.

Class.forName(“org.xyzdata.jdbc.NetworkDriver”);

C.

Connection con = DriverManager.getConnection(“jdbc:xyzdata://localhost:3306/EmployeeDB”);

D.

DriverManager.loadDriver (“org.xyzdata.jdbc.NetworkDriver”);

Buy Now
Questions 50

Given:

public class Emp {

String fName;

String lName;

public Emp (String fn, String ln) {

fName = fn;

lName = ln;

}

public String getfName() { return fName; }

public String getlName() { return lName; }

}

and the code fragment:

List emp = Arrays.asList (

new Emp (“John”, “Smith”),

new Emp (“Peter”, “Sam”),

new Emp (“Thomas”, “Wale”));

emp.stream()

//line n1

.collect(Collectors.toList());

Which code fragment, when inserted at line n1, sorts the employees list in descending order of fName and then ascending order of lName?

Options:

A.

.sorted (Comparator.comparing(Emp::getfName).reserved().thenComparing(Emp::getlName))

B.

.sorted (Comparator.comparing(Emp::getfName).thenComparing(Emp::getlName))

C.

.map(Emp::getfName).sorted(Comparator.reserveOrder())

D.

.map(Emp::getfName).sorted(Comparator.reserveOrder().map(Emp::getlName).reserved

Buy Now
Questions 51

Given the code fragment:

ZonedDateTime depart = ZonedDateTime.of(2015, 1, 15, 1, 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?

Options:

A.

Travel time is 4 hours

B.

Travel time is 6 hours

C.

Travel time is 8 hours

D.

An exception is thrown at line n1.

Buy Now
Questions 52

Given the code fragment:

Which code fragment, when inserted at line 7, enables printing 100?

Options:

A.

Function funRef = e –> e + 10;Integer result = funRef.apply(value);

B.

IntFunction funRef = e –> e + 10;Integer result = funRef.apply (10);

C.

ToIntFunction funRef = e –> e + 10;int result = funRef.applyAsInt (value);

D.

ToIntFunction funRef = e –> e + 10;int result = funRef.apply (value);

Buy Now
Questions 53

Given:

public class Counter {

public static void main (String[ ] args) {

int a = 10;

int b = -1;

assert (b >=1) : “Invalid Denominator”;

int с = a / b;

System.out.println (c);

}

}

What is the result of running the code with the –ea option?

Options:

A.

-10

B.

0

C.

An AssertionError is thrown.

D.

A compilation error occurs.

Buy Now
Questions 54

Given the code fragment:

UnaryOperator uo1 = s -> s*2;line n1

List loanValues = Arrays.asList(1000.0, 2000.0);

loanValues.stream()

.filter(lv -> lv >= 1500)

.map(lv -> uo1.apply(lv))

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

What is the result?

Options:

A.

4000.0

B.

4000

C.

A compilation error occurs at line n1.

D.

A compilation error occurs at line n2.

Buy Now
Questions 55

Given the code fragment:

Stream files = Files.list(Paths.get(System.getProperty(“user.home”)));

files.forEach (fName -> {//line n1

try {

Path aPath = fName.toAbsolutePath();//line n2

System.out.println(fName + “:”

+ Files.readAttributes(aPath, Basic.File.Attributes.class).creationTime

());

} catch (IOException ex) {

ex.printStackTrace();

});

What is the result?

Options:

A.

All files and directories under the home directory are listed along with their attributes.

B.

A compilation error occurs at line n1.

C.

The files in the home directory are listed along with their attributes.

D.

A compilation error occurs at line n2.

Buy Now
Questions 56

Given the code fragment:

What is the result?

Options:

A.

DavidDavid[Susan, Allen]

B.

SusanSusan[Susan, Allen]

C.

SusanAllen[David]

D.

DavidAllen[Susan]

E.

SusanAllen[Susan, David]

Buy Now
Questions 57

Given:

What is the result?

Options:

A.

IT:null

B.

A NullPointerException is thrown at run time.

C.

A compilation error occurs.

D.

IT:0.0

Buy Now
Questions 58

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 couList = Arrays.asList (

new Country (“Japan”, Country.Continent.ASIA),

new Country (“Italy”, Country.Continent.EUROPE),

new Country (“Germany”, Country.Continent.EUROPE));

Map> regionNames = couList.stream ()

.collect(Collectors.groupingBy (Country ::getRegion,

Collectors.mapping(Country::getName, Collectors.toList()))));

System.out.println(regionNames);

What is the output?

Options:

A.

{EUROPE = [Italy, Germany], ASIA = [Japan]}

B.

{ASIA = [Japan], EUROPE = [Italy, Germany]}

C.

{EUROPE = [Germany, Italy], ASIA = [Japan]}

D.

{EUROPE = [Germany], EUROPE = [Italy], ASIA = [Japan]}

Buy Now
Exam Code: 1z0-809
Exam Name: Java SE 8 Programmer II
Last Update: Sep 12, 2024
Questions: 196
$64  $159.99
$48  $119.99
$40  $99.99
buy now 1z0-809