Download Oracle.1z0-809.PracticeTest.2018-04-09.61q.vcex

Download Exam

File Info

Exam Java SE 8 Programmer II
Number 1z0-809
File Name Oracle.1z0-809.PracticeTest.2018-04-09.61q.vcex
Size 65 KB
Posted Apr 09, 2018
Download Oracle.1z0-809.PracticeTest.2018-04-09.61q.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 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: A



Question 2

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



Question 3

Given:
class Book { 
    int id; 
    String name; 
    public Book (int id, String name)  { 
        this.id = id; 
        this.name = name; 
    } 
    public boolean equals (Object obj) {           //line n1 
        boolean output = false; 
        Book b = (Book) obj; 
        if (this.name.equals(b name))} 
            output = true; 
        } 
        return output; 
    } 
and the code fragment:
Book b1 = new Book (101, “Java Programing”); 
Book b2 = new Book (102, “Java Programing”); 
System.out.println (b1.equals(b2));                 //line n2 
Which statement is true?


  1. The program prints true.
  2. The program prints false.
  3. A compilation error occurs. To ensure successful compilation, replace line n1 with: 
    boolean equals (Book obj)  {
  4. A compilation error occurs. To ensure successful compilation, replace line n2 with: 
    System.out.println (b1.equals((Object) b2));
Correct answer: C



Question 4

Given the content of /resourses/Message.properties:
welcome1=”Good day!” 
and given the code fragment:
Properties prop = new Properties (); 
FileInputStream fis = new FileInputStream (“/resources/Message.properties”); 
prop.load(fis); 
System.out.println(prop.getProperty(“welcome1”)); 
System.out.println(prop.getProperty(“welcome2”, “Test”));//line n1 
System.out.println(prop.getProperty(“welcome3”)); 
What is the result? 


  1. Good day!
    Test
    followed by an Exception stack trace
  2. Good day!
    followed by an Exception stack trace
  3. Good day!
    Test
    null
  4. A compilation error occurs at line n1.
Correct answer: D



Question 5

Which action can be used to load a database driver by using JDBC3.0?


  1. Add the driver class to the META-INF/services folder of the JAR file.
  2. Include the JDBC driver class in a jdbc.properties file.
  3. Use the java.lang.Class.forName method to load the driver class.
  4. Use the DriverManager.getDriver method to load the driver class.
Correct answer: D



Question 6

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?


  1. An exception is thrown at run time. 
  2. 2:MyPic.jpeg: MyPic.jpeg
  3. 1:Pics:/Pics/ MyPic.jpeg
  4. 2:Pics: MyPic.jpeg
Correct answer: C



Question 7

Given the code fragments:
class MyThread implements Runnable { 
    private static AtomicInteger count = new AtomicInteger (0); 
    public void run ()   { 
        int x = count.incrementAndGet(); 
        System.out.print (x+” “); 
    } 
and 
Thread thread1 = new Thread(new MyThread()); 
Thread thread2 = new Thread(new MyThread()); 
Thread thread3 = new Thread(new MyThread()); 
Thread [] ta = {thread1, thread2, thread3}; 
for (int x= 0; x < 3; x++)   { 
    ta[x].start(); 
Which statement is true?


  1. The program prints 1 2 3 and the order is unpredictable.
  2. The program prints 1 2 3.
  3. The program prints 1 1 1.
  4. A compilation error occurs.
Correct answer: B



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



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



Question 10

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;
    } 
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(scr)); 
What is the result? 


  1. [Java EE: Helen:Houston]
    [Java ME: Jessy:Chicago, Java ME: Mark:Chicago]
  2. Java EE
    Java ME
  3. [Java ME: Jessy:Chicago, Java ME: Mark:Chicago]
    [Java EE: Helen:Houston]
  4. A compilation error occurs.
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