[Free] 2018(Jan) EnsurePass Testinsides Oracle 1z0-809 Dumps with VCE and PDF 21-30

By | January 25, 2018

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: 21

Given:

Ensurepass 2018 PDF and VCE

  1. X XX

  2. X Y X

  3. Y Y X

  4. Y YY

Answer: D

Question No: 22

Given the code fragment:

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

BufferedReader br = new BufferedReader (new InputStremReader (System.in)); System.out.print (“Enter GDP: “);

//line 1

}

Which code fragment, when inserted at line 1, enables the code to read the GDP from the user?

  1. int GDP = Integer.parseInt (br.readline());

  2. int GDP = br.read();

  3. int GDP = br.nextInt();

  4. int GDP = Integer.parseInt (br.next());

Answer: C

Question No: 23

Given:

class UserException extends Exception { }

class AgeOutOfLimitException extends UserException { } and the code fragment:

class App {

public void doRegister(String name, int age) throws UserException, AgeOutOfLimitException { if (name.length () lt; 6) {

throw new UserException ();

} else if (age gt;= 60) {

throw new AgeOutOfLimitException ();

} else {

System.out.println(“User is registered.”);

}

}

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

App t = new App (); t.doRegister(“Mathew”, 60);

}

}

What is the result?

  1. User is registered.

  2. An AgeOutOfLimitException is thrown.

  3. A UserException is thrown.

  4. A compilation error occurs in the main method.

Answer: A

Question No: 24

Which statement is true about java.time.Duration?

  1. It tracks time zones.

  2. It preserves daylight saving time.

  3. It defines time-based values.

  4. It defines date-based values.

Answer: C

Reference: http://tutorials.jenkov.com/java-date-time/duration.html#accessing-the-time-of- a-duration

Question No: 25

Given the code fragment:

public void recDelete (String dirName) throws IOException { File [ ] listOfFiles = new File (dirName) .listFiles();

if (listOfFiles ! = null amp;amp; listOfFiles.length gt;0) { for (File aFile : listOfFiles) {

if (aFile.isDirectory ()) {

recDelete (aFile.getAbsolutePath ());

} else {

if (aFile.getName ().endsWith (“.class”)) aFile.delete ();

}

}

}

}

Assume that Projects contains subdirectories that contain .class files and is passed as an argument to the recDelete () method when it is invoked.

What is the result?

  1. The method deletes all the .class files in the Projects directory and its subdirectories.

  2. The method deletes the .class files of the Projects directory only.

  3. The method executes and does not make any changes to the Projects directory.

  4. The method throws an IOException.

Answer: B

Question No: 26

Given the code fragment:

class CallerThread implements Callablelt;Stringgt; { String str;

public CallerThread(String s) {this.str=s;} public String call() throws Exception { return str.concat(“Call”);

}

}

and

public static void main (String[] args) throws InterruptedException, ExecutionException

{

ExecutorService es = Executors.newFixedThreadPool(4); //line n1 Future f1 = es.submit (newCallerThread(“Call”));

String str = f1.get().toString(); System.out.println(str);

}

Which statement is true?

  1. The program prints Call Call and terminates.

  2. The program prints Call Call and does not terminate.

  3. A compilation error occurs at line n1.

  4. An ExecutionException is thrown at run time.

Answer: B

Question No: 27

Given the for loop construct:

for ( expr1 ; expr2 ; expr3 ) { statement;

}

Which two statements are true?

  1. This is not the only valid for loop construct; there exits another form of for loop constructor.

  2. The expression expr1 is optional. it initializes the loop and is evaluated once, as the loop begin.

  3. When expr2 evaluates to false, the loop terminates. It is evaluated only after each iteration through the loop.

  4. The expression expr3 must be present. It is evaluated after each iteration through the loop.

Answer: B,C Explanation:

The for statement have this forms: for (init-stmt; condition; next-stmt) { body

}

There are three clauses in the for statement.

The init-stmt statement is done before the loop is started, usually to initialize an iteration variable.

The condition expression is tested before each time the loop is done. The loop isn#39;t executed if the boolean expression is false (the same as the while loop).

The next-stmt statement is done after the body is executed. It typically increments an iteration variable.

Question No: 28

Given:

Ensurepass 2018 PDF and VCE

What is the result?

A. 100

210

  1. Compilation fails due to an error in line n1

  2. Compilation fails due to an error at line n2

  3. Compilation fails due to an error at line n3

Answer: C

Question No: 29

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

  1. Replace line n1 with public void ride() throws FuelNotAvailException {

  2. Replace line n1 with protected void ride() throws Exception {

  3. Replace line n2 with void ride() throws Exception {

  4. Replace line n2 with private void ride() throws FuelNotAvailException {

Answer: B

Question No: 30

Given:

public class ScopeTest { int j, int k;

public static void main(String[] args) {

ew ScopeTest().doStuff(); } void doStuff() {

nt x = 5; oStuff2();

System.out.println(quot;xquot;);

}

void doStuff2() { nt y = 7;

ystem.out.println(quot;yquot;);

or (int z = 0; z lt; 5; z ) { ystem.out.println(quot;zquot;);

ystem.out.println(quot;yquot;);

}

Which two items are fields?

  1. j

  2. k

  3. x

  4. y

  5. z

Answer: A,B

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

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.