Download Oracle.1z0-809.CertKiller.2019-04-18.70q.vcex

Download Exam

File Info

Exam Java SE 8 Programmer II
Number 1z0-809
File Name Oracle.1z0-809.CertKiller.2019-04-18.70q.vcex
Size 4 MB
Posted Apr 18, 2019
Download Oracle.1z0-809.CertKiller.2019-04-18.70q.vcex

How to open VCEX & EXAM Files?

Files with VCEX & EXAM extensions can be opened by ProfExam Simulator.

Purchase

Coupon: MASTEREXAM
With discount: 20%






Demo Questions

Question 1

Given the definition of the Vehicle class:
Class Vehhicle { 
    int distance;        //line n1 
    Vehicle (int x) { 
        this distance = x; 
    } 
    public void increSpeed(int time)   {    //line n2 
        int timeTravel = time;            //line n3 
        class Car { 
            int value = 0; 
            public void speed () { 
                value = distance /timeTravel; 
                System.out.println (“Velocity with new speed”+value+”kmph”); 
            } 
        } 
        new Car().speed(); 
    } 
and this code fragment:
Vehicle v = new Vehicle (100); 
v.increSpeed(60); 
What is the result?


  1. Velocity with new speed
  2. A compilation error occurs at line n1.
  3. A compilation error occurs at line n2.
  4. A compilation error occurs at line n3.
Correct answer: A



Question 2

Given the code fragment:
List<Integer> values = Arrays.asList (1, 2, 3); 
values.stream () 
    .map(n -> n*2)        //line n1 
    .peek(System.out::print)    //line n2
    .count(); 
What is the result?


  1. 246
  2. The code produces no output.
  3. A compilation error occurs at line n1.
  4. A compilation error occurs at line n2.
Correct answer: A



Question 3

Given:
1. abstract class Shape  { 
2.     Shape ( )   { System.out.println  (“Shape”);     } 
3.     protected void area ( ) { System.out.println  (“Shape”);     } 
4. } 
5.  
6. class Square extends Shape  { 
7.     int side; 
8.     Square int side { 
9.        /* insert code here */ 
10.         this.side = side; 
11.     } 
12.     public void area ( ) { System.out.println  (“Square”);     } 
13.     } 
14. class Rectangle extends Square { 
15.     int len, br; 
16.     Rectangle (int x, int y)   { 
17.         /* insert code here */ 
18.         len = x, br = y; 
19.     } 
20. void area ( ) { System.out.println  (“Rectangle”);     } 
21. } 
Which two modifications enable the code to compile? (Choose two.)


  1. At line 1, remove abstract
  2. At line 9, insert super ( );
  3. At line 12, remove public
  4. At line 17, insert super (x);
  5. At line 17, insert super (); super.side = x;
  6. At line 20, use public void area ( ) {
Correct answer: DF



Question 4

Given:
class Sum extends RecursiveAction   {                 //line n1 
    static final int THRESHOLD_SIZE  = 3; 
    int stIndex, lstIndex; 
    int [ ] data; 
    public Sum (int [ ]data, int start, int end)   { 
        this.data = data; 
        this stIndex = start; 
        this. lstIndex = end; 
    } 
    protected void compute ( )    { 
        int sum = 0; 
        if (lstIndex – stIndex <= THRESHOLD_SIZE)  { 
            for (int i = stIndex; i < lstIndex; i++)   { 
                sum += data [i]; 
            } 
            System.out.println(sum); 
        } else { 
            new Sum (data, stIndex + THRESHOLD_SIZE, lstIndex).fork( ); 
            new Sum (data, stIndex, 
                    Math.min  (lstIndex, stIndex + THRESHOLD_SIZE) 
                    ).compute (); 
        } 
    } 
and the code fragment:
ForkJoinPool fjPool = new ForkJoinPool ( ); 
int data [ ] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} 
fjPool.invoke (new Sum (data, 0, data.length)); 
and given that the sum of all integers from 1 to 10 is 55. 
Which statement is true?


  1. The program prints several values that total 55.
  2. The program prints 55.
  3. A compilation error occurs at line n1.
  4. The program prints several values whose sum exceeds 55.
Correct answer: C



Question 5

Given the code fragments:
4. void doStuff() throws ArithmeticException, NumberFormatException, Exception   { 
5.     if (Math.random() >-1 throw new Exception (“Try again”); 
6. } 
and 
24. try { 
25.     doStuff ( ):
26. } catch (ArithmeticException | NumberFormatException | Exception e)  { 
27.     System.out.println (e.getMessage()); } 
28. catch (Exception e)    { 
29.     System.out.println (e.getMessage()); } 
30. } 
Which modification enables the code to print Try again?


  1. Comment the lines 28, 29 and 30.
  2. Replace line 26 with: 
        } catch (Exception | ArithmeticException | NumberFormatException e) {
  3. Replace line 26 with: 
        } catch (ArithmeticException | NumberFormatException e) {
  4. Replace line 27 with: 
        throw e;
Correct answer: C



Question 6

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); 


  1. {EUROPE = [Italy, Germany], ASIA = [Japan]}
  2. {ASIA = [Japan], EUROPE = [Italy, Germany]}
  3. {EUROPE = [Germany, Italy], ASIA = [Japan]}
  4. {EUROPE = [Germany], EUROPE = [Italy], ASIA = [Japan]}
Correct answer: B



Question 7

Given the code fragment:
Map<Integer, String> books = new TreeMap<>(); 
books.put (1007, “A”); 
books.put (1002, “C”); 
books.put (1001, “B”); 
books.put (1003, “B”); 
System.out.println (books); 
What is the result? 


  1. {1007 = A, 1002 = C, 1001 = B, 1003 = B}
  2. {1001 = B, 1002 = C, 1003 = B, 1007 = A} 
  3. {1002 = C, 1003 = B, 1007 = A}
  4. {1007 = A, 1001 = B, 1003 = B, 1002 = C}
Correct answer: B
Explanation:
Reference: TreeMap inherits SortedMap and automatically sorts the element's key
Reference: TreeMap inherits SortedMap and automatically sorts the element's key



Question 8

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());
Correct answer: A



Question 9

Given the code fragment:
Path source = Paths.get (“/data/december/log.txt”); 
Path destination = Paths.get(“/data”); 
Files.copy (source, destination); 
and assuming that the file /data/december/log.txt is accessible and contains:
10-Dec-2014 – Executed successfully 
What is the result?


  1. A file with the name log.txt is created in the /data directory and the content of the /data/december/log.txt file is copied to it.
  2. The program executes successfully and does NOT change the file system.
  3. A FileNotFoundException is thrown at run time.
  4. A FileAlreadyExistsException is thrown at run time.
Correct answer: D



Question 10

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?


  1. The program executes successfully and the STUDENT table is updated with one record.
  2. The program executes successfully and the STUDENT table is NOT updated with any record.
  3. A SQLException is thrown as runtime.
  4. A NullPointerException is thrown as runtime.
Correct answer: C









CONNECT US

Facebook

Twitter

PROFEXAM WITH A 20% DISCOUNT

You can buy ProfExam with a 20% discount!



HOW TO OPEN VCEX FILES

Use ProfExam Simulator to open VCEX files