Friday, December 25, 2020

1z0-809 Dumps PDF - 100% Success with Valid Q&A | Realexamdumps.com


Question #:1


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


A. A compilation error occurs.

B. Java EEJava ME

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

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


Answer: B


Question #:2


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.getInt(“Id”));

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

17.System.out.println(“Price:“ + rs.getDouble(“Price”));

18. System.out.println(Quantity:“ + rs.getInt(“Quantity”));

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?


A. An exception is thrown at runtime.

B. Compilation fails.

C. The code prints Error.

D. The code prints information about Item 110.


Answer: D


Question #:3


Given the code fragment:

9. Connection conn = DriveManager.getConnection(dbURL, userName, passWord);

10. String query = “SELECT id FROM Employee”;

11. try (Statement stmt = conn.createStatement()) {

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

13.stmt.executeQuery(“SELECT id FROM Customer”);

14. while (rs.next()) {

15. //process the results

16.System.out.println(“Employee ID: “+ rs.getInt(“id”));

17.}

18. } catch (Exception e) {

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

20. }

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 and Customer tables are available and each table has id column with a few records and the SQL

queries are valid.

What is the result of compiling and executing this code fragment?


A. The program prints employee IDs.

B. The program prints customer IDs.

C. The program prints Error.

D. compilation fails on line 13.


Answer: C


Question #:4


Given the code fragment:

Stream<Path> 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?


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.


Answer: C


Question #:5


Given the code fragment:

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

Predicate<String> 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.


Answer: C


No comments:

Post a Comment