Black Friday - Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: 65percent

Welcome To DumpsPedia

1z0-809 Sample Questions Answers

Questions 4

You have been asked to create a ResourceBundle which uses a properties file to localize an application.

Which code example specifies valid keys of menu1 and menu2 with values of File Menu and View Menu?

Options:

A.

File MenuView Menu

B.

menu1File Menumenu2View Menu

C.

menu1, File Menu, menu2, View Menu

D.

menu1 = File Menumenu2 = View Menu

Buy Now
Questions 5

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 6

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?

Options:

A.

1John2null

B.

12

C.

A NullPointerException is thrown at run time.

D.

A compilation error occurs.

Buy Now
Questions 7

Given the code fragments:

class ThreadRunner implements Runnable {

public void run () { System.out.print (“Runnable”) ; }

}

class ThreadCaller implements Callable {

Public String call () throws Exception {return “Callable”; )

}

and

ExecutorService es = Executors.newCachedThreadPool ();

Runnable r1 = new ThreadRunner ();

Callable c1 = new ThreadCaller ();

// line n1

es.shutdown();

Which code fragment can be inserted at line n1 to start r1 and c1 threads?

Options:

A.

Future f1 = (Future) es.submit (r1);es.execute (c1);

B.

es.execute (r1);Future f1 = es.execute (c1) ;

C.

Future f1 = (Future) es.execute(r1);Future f2 = (Future) es.execute(c1);

D.

es.submit(r1);Future f1 = es.submit (c1);

Buy Now
Questions 8

Given the Greetings.properties file, containing:

and given:

What is the result?

Options:

A.

Compilation fails.

B.

GOODBY_MSG

C.

Hello, everyone!

D.

Goodbye everyone!

E.

HELLO_MSG

Buy Now
Questions 9

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:

A.

2 : 30

B.

4 : 0

C.

4 : 70

D.

4 : 602 : 303 : 201 : 10

E.

The program prints nothing.

Buy Now
Questions 10

Given the code fragments:

and

What is the result?

Options:

A.

FranceOptional[NotFound]

B.

Optional [France]Optional [NotFound]

C.

Optional[France]Not Found

D.

FranceNot Found

Buy Now
Questions 11

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 12

Given:

and the code fragment:

What is the result?

Options:

A.

[Java EE: Helen:Houston][Java ME: Jessy:Chicago, Java ME: Mark:Chicago]

B.

Java EEJava ME

C.

[Java ME: Jessy:Chicago, Java ME: Mark:Chicago][Java EE: Helen:Houston]

D.

A compilation error occurs.

Buy Now
Questions 13

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 14

Given the code fragment:

Assume that:

The required database driver is configured in the classpath.

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

The Employee table has a column ID of type integer and the SQL query matches one record.

What is the result?

Options:

A.

Compilation fails at line 14.

B.

Compilation fails at line 15.

C.

The code prints the employee ID.

D.

The code prints Error.

Buy Now
Questions 15

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 16

Given the code fragment:

Which two code fragments, when inserted at line n1 independently, result in the output PEEK: Unix?

Options:

A.

.anyMatch ();

B.

.allMatch ();

C.

.findAny ();

D.

.noneMatch ();

E.

.findFirst ();

Buy Now
Questions 17

Given the code fragments:

class Employee {

Optional

address;

Employee (Optional

address) {

this.address = address;

}

public Optional

getAddress() { return address; }

}

class Address {

String city = “New York”;

public String getCity { return city: }

public String toString() {

return city;

}

}

and

Address address = new Address;

Optional

addrs1 = Optional.ofNullable (address);

Employee e1 = new Employee (addrs1);

String eAddress = (addrs1.isPresent()) ? addrs1.get().getCity() : “City Not

available”;

System.out.println(eAddress);

What is the result?

Options:

A.

New York

B.

City Not available

C.

null

D.

A NoSuchElementException is thrown at run time.

Buy Now
Questions 18

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!?

Options:

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 {

Buy Now
Questions 19

Given:

final class Folder {//line n1

//line n2

public void open () {

System.out.print(“Open”);

}

}

public class Test {

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

try (Folder f = new Folder()) {

f.open();

}

}

}

Which two modifications enable the code to print Open Close? (Choose two.)

Options:

A.

Replace line n1 with:class Folder implements AutoCloseable {

B.

Replace line n1 with:class Folder extends Closeable {

C.

Replace line n1 with:class Folder extends Exception {

D.

At line n2, insert:final void close () {System.out.print(“Close”);}

E.

At line n2, insert:public void close () throws IOException {System.out.print(“Close”);}

Buy Now
Questions 20

Given the code fragments:

and

What is the result?

Options:

A.

null

B.

A compilation error occurs.

C.

DogCatMouse

D.

[Dog, Cat, Mouse]

Buy Now
Questions 21

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

and the code fragment:

What is the result?

Options:

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

Buy Now
Questions 22

Given the code fragment:

What is the result?

Options:

A.

A compilation error occurs at line n1.

B.

A compilation error occurs at line n2.

C.

The code reads the password without echoing characters on the console.

D.

A compilation error occurs because the IOException isn’t declared to be thrown or caught?

Buy Now
Questions 23

Given the code fragment:

What is the result?

Options:

A.

A compilation error occurs at line n2.

B.

3

C.

2

D.

A compilation error occurs at line n1.

Buy Now
Questions 24

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 25

Given the code fragment:

Assume that dbURL, userName, and password are valid.

Which code fragment can be inserted at line n1 to enable the code to print Connection Established?

Options:

A.

Properties prop = new Properties();prop.put (“user”, userName);prop.put (“password”, password);con = DriverManager.getConnection (dbURL, prop);

B.

con = DriverManager.getConnection (userName, password, dbURL);

C.

Properties prop = new Properties();prop.put (“userid”, userName);prop.put (“password”, password);prop.put(“url”, dbURL);con = DriverManager.getConnection (prop);

D.

con = DriverManager.getConnection (dbURL);con.setClientInfo (“user”, userName);con.setClientInfo (“password”, password);

Buy Now
Questions 26

Which statement is true about the single abstract method of the java.util.function.Function interface?

Options:

A.

It accepts one argument and returns void.

B.

It accepts one argument and returns boolean.

C.

It accepts one argument and always produces a result of the same type as the argument.

D.

It accepts an argument and produces a result of any data type.

Buy Now
Questions 27

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 28

Given the content:

and the code fragment:

What is the result?

Options:

A.

username = Entrez le nom d’utilisateurpassword = Entrez le mot de passe

B.

username = Enter User Namepassword = Enter Password

C.

A compilation error occurs.

D.

The program prints nothing.

Buy Now
Questions 29

Given the definition of the Emp class:

public class Emp

private String eName;

private Integer eAge;

Emp(String eN, Integer eA) {

this.eName = eN;

this.eAge = eA;

}

public Integer getEAge () {return eAge;}

public String getEName () {return eName;}

}

and code fragment:

Listli = Arrays.asList(new Emp(“Sam”, 20), New Emp(“John”, 60), New Emp(“Jim”, 51));

Predicate agVal = s -> s.getEAge() <= 60;//line n1

li = li.stream().filter(agVal).collect(Collectors.toList());

Stream names = li.stream()map.(Emp::getEName);//line n2

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

What is the result?

Options:

A.

Sam John Jim

B.

John Jim

C.

A compilation error occurs at line n1.

D.

A compilation error occurs at line n2.

Buy Now
Exam Code: 1z0-809
Exam Name: Java SE 8 Programmer II
Last Update: Dec 1, 2023
Questions: 196
$56  $159.99
$42  $119.99
$35  $99.99
buy now 1z0-809