Ensurepass.com : Ensure you pass the IT Exams
2018 Jan Oracle Official New Released 1z0-809
100% Free Download! 100% Pass Guaranteed!
http://www.EnsurePass.com/1z0-809.html
Java SE 8 Programmer II
Question No: 31
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?
-
The program executes successfully and the STUDENT table is updated with one record.
-
The program executes successfully and the STUDENT table is NOT updated with any record.
-
A SQLException is thrown as runtime.
-
A NullPointerException is thrown as runtime.
Answer: D
Question No: 32
public class StringReplace {
public static void main(String[] args) { String message = quot;Hi everyone!quot;;
System.out.println(quot;message = quot; message.replace(quot;equot;, quot;Xquot;)); }
}
What is the result?
-
message = Hi everyone!
-
message = Hi XvXryonX!
-
A compile time error is produced.
-
A runtime error is produced.
-
message =
-
message = Hi Xveryone!
Answer: B
Question No: 33
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?
-
An exception is thrown at run time.
-
2:MyPic.jpeg: MyPic.jpeg
-
1:Pics:/Pics/ MyPic.jpeg
-
2:Pics: MyPic.jpeg
Answer: C
Question No: 34
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:
Listlt;Countrygt; couList = Arrays.asList (
new Country (“Japan”, Country.Continent.ASIA), new Country (“Italy”, Country.Continent.EUROPE),
new Country (“Germany”, Country.Continent.EUROPE)); Maplt;Country.Continent, Listlt;Stringgt;gt; regionNames = couList.stream ()
.collect(Collectors.groupingBy (Country ::getRegion, Collectors.mapping(Country::getName, Collectors.toList())))); System.out.println(regionNames);
What is the output?
-
{EUROPE = [Italy, Germany], ASIA = [Japan]}
-
{ASIA = [Japan], EUROPE = [Italy, Germany]}
-
{EUROPE = [Germany, Italy], ASIA = [Japan]}
-
{EUROPE = [Germany], EUROPE = [Italy], ASIA = [Japan]}
Answer: A
Question No: 35
Given the code fragment:
Listlt;Stringgt; str = Arrays.asList (“my”, “pen”, “is”, “your’, “pen”); Predicatelt;Stringgt; test = s -gt; {
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?
-
0 : 0 : pen
-
0 : 1 : pen
C. 0 : 0 : 0 : 0 : 0 : pen
D. 0 : 1 : 2 : 3 : 4 :
E. A compilation error occurs.
Answer: E
Question No: 36
The protected modifier on a Field declaration within a public class means that the field
.
-
Cannot be modified
-
Can be read but not written from outside the class
-
Can be read and written from this class and its subclasses only within the same package
-
Can be read and written from this class and its subclasses defined in any package
Answer: D
Reference:
http://beginnersbook.com/2013/05/java-access-modifiers/
Question No: 37
A method is declared to take three arguments. A program calls this method and passes only two arguments. What is the results?
-
Compilation fails.
-
The third argument is given the value null.
-
The third argument is given the value void.
-
The third argument is given the value zero.
-
The third argument is given the appropriate falsy value for its declared type. F) An exception occurs when the method attempts to access the third argument.
Answer: A
Question No: 38
Which statement is true about the single abstract method of the java.util.function.Function interface?
-
It accepts one argument and returns void.
-
It accepts one argument and returns boolean.
-
It accepts one argument and always produces a result of the same type as the argument.
-
It accepts an argument and produces a result of any data type.
Answer: C
Reference: http://winterbe.com/posts/2014/03/16/java-8-tutorial/ (functions)
Question No: 39
Given:
public final class IceCream { public void prepare() {}
}
public class Cake {
public final void bake(int min, int temp) {} public void mix() {}
}
public class Shop {
private Cake c = new Cake (); private final double discount = 0.25;
public void makeReady () { c.bake(10, 120); }
}
public class Bread extends Cake {
public void bake(int minutes, int temperature) {} public void addToppings() {}
}
Which statement is true?
-
A compilation error occurs in IceCream.
-
A compilation error occurs in Cake.
-
A compilation error occurs in Shop.
-
A compilation error occurs in Bread
-
All classes compile successfully.
Answer: D
Question No: 40
Given:
What is the result?
-
Marrown String out of limits JesOran
-
Marrown String out of limits Array out of limits
-
Marrown String out of limits
-
Marrown NanRed JesOran
Answer: A
100% Ensurepass Free Download!
–Download Free Demo:1z0-809 Demo PDF
100% Ensurepass Free Guaranteed!
–1z0-809 Dumps
EnsurePass | ExamCollection | Testking | |
---|---|---|---|
Lowest Price Guarantee | Yes | No | No |
Up-to-Dated | Yes | No | No |
Real Questions | Yes | No | No |
Explanation | Yes | No | No |
PDF VCE | Yes | No | No |
Free VCE Simulator | Yes | No | No |
Instant Download | Yes | No | No |
100-105 Dumps VCE PDF
200-105 Dumps VCE PDF
300-101 Dumps VCE PDF
300-115 Dumps VCE PDF
300-135 Dumps VCE PDF
300-320 Dumps VCE PDF
400-101 Dumps VCE PDF
640-911 Dumps VCE PDF
640-916 Dumps VCE PDF
70-410 Dumps VCE PDF
70-411 Dumps VCE PDF
70-412 Dumps VCE PDF
70-413 Dumps VCE PDF
70-414 Dumps VCE PDF
70-417 Dumps VCE PDF
70-461 Dumps VCE PDF
70-462 Dumps VCE PDF
70-463 Dumps VCE PDF
70-464 Dumps VCE PDF
70-465 Dumps VCE PDF
70-480 Dumps VCE PDF
70-483 Dumps VCE PDF
70-486 Dumps VCE PDF
70-487 Dumps VCE PDF
220-901 Dumps VCE PDF
220-902 Dumps VCE PDF
N10-006 Dumps VCE PDF
SY0-401 Dumps VCE PDF