Go Back on 1z0-809 Exam
Available in 1, 3, 6 and 12 Months Free Updates Plans
PDF: $15 $60

Test Engine: $20 $80

PDF + Engine: $25 $99

1z0-809 Practice Test


Page 7 out of 26 Pages

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?


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.





D.
  

A NullPointerException is thrown as runtime.



public class StringReplace {
public static void main(String[] args) {
String message = "Hi everyone!";
System.out.println("message = " + message.replace("e", "X")); }
}
What is the result?


A.

message = Hi everyone!


B.

message = Hi XvXryonX!


C.

A compile time error is produced.


D.

A runtime error is produced.


E.

message =


F.

message = Hi Xveryone!





B.
  

message = Hi XvXryonX!



Given the code fragment:
Path p1 = Paths.get(“/Pics/MyPic.jpeg”);
System.out.println (p1.getNameCount() +
“:” + p1.getName(1) +
“:” + p1.getFileName());
Assume that the Pics directory does NOT exist.
What is the result?


A.

An exception is thrown at run time.


B.

2:MyPic.jpeg: MyPic.jpeg


C.

1:Pics:/Pics/ MyPic.jpeg


D.

2:Pics: MyPic.jpeg





C.
  

1:Pics:/Pics/ MyPic.jpeg



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<Country> couList = Arrays.asList (
new Country (“Japan”, Country.Continent.ASIA),
new Country (“Italy”, Country.Continent.EUROPE),
new Country (“Germany”, Country.Continent.EUROPE));
Map<Country.Continent, List<String>> regionNames = couList.stream ()
collect(Collectors.groupingBy (Country ::getRegion,
Collectors.mapping(Country::getName, Collectors.toList()))));
System.out.println(regionNames);
What is the output?


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]}





A.
  

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



Given the code fragment:
List<String> str = Arrays.asList (“my”, “pen”, “is”, “your’, “pen”);
Predicate<String> test = s -> {
int i = 0;
boolean result = s.contains (“pen”);
System.out.print(i++) + “:”);
return result;
};
str.stream()
.filter(test)
.findFirst()
.ifPresent(System.out ::print);
What is the result?


A.

0 : 0 : pen


B.

0 : 1 : pen


C.

0 : 0 : 0 : 0 : 0 : pen


D.

0 : 1 : 2 : 3 : 4 :


E.

A compilation error occurs.





E.
  

A compilation error occurs.




Page 7 out of 26 Pages
Previous