Download Free Oracle 1z1-809 Exam Questions & Answer [Q15-Q38]

Share

Download Free Oracle 1z1-809 Exam Questions & Answer 

Online VALID 1z1-809 Exam Dumps File Instantly


The 1z0-809 exam covers a wide range of topics, including Java Class Design, Advanced Inheritance, Generics and Collections, Lambda Expressions, Java File I/O (NIO.2), Concurrency, JDBC, Localization, and Annotations. Candidates are also expected to have experience with Java tools and technologies, including the Java Development Kit (JDK), the Java SE 8 API documentation, and the Java Platform, Enterprise Edition (Java EE). 1z1-809 exam consists of 85 multiple-choice and multiple-select questions and has a duration of 180 minutes. A passing score of 65% or higher is required to obtain certification.

 

NEW QUESTION # 15
Given the following code for a planet object:

And the following main method:

What is the output?

  • A. Option D
  • B. Option B
  • C. Option A
  • D. Option E
  • E. Option C

Answer: A


NEW QUESTION # 16
Given:

What is the result?

  • A. A NullPointerException is thrown at run time.
  • B. A compilation error occurs.
  • C. IT:null
  • D. IT:0.0

Answer: D


NEW QUESTION # 17
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?
Good day!

  • A. A compilation error occurs at line n1.
  • B. Test
    followed by an Exceptionstack trace
    Good day!
  • C. followed by an Exceptionstack trace
    Good day!
  • D. Test
    null

Answer: D


NEW QUESTION # 18
Given:
class Vehicle {
int vno;
String name;
public Vehicle (int vno, String name) {
this.vno = vno,;
this.name = name;
}
public String toString () {
return vno + ":" + name;
}
}
and this code fragment:
Set<Vehicle> vehicles = new TreeSet <> ();
vehicles.add(new Vehicle (10123, "Ford"));
vehicles.add(new Vehicle (10124, "BMW"));
System.out.println(vehicles);
What is the result?

  • A. A compilation error occurs.
  • B. 10123 Ford 10124 BMW
  • C. 10124 BMW 10123 Ford
  • D. A ClassCastException is thrown at run time.

Answer: C


NEW QUESTION # 19
Given the code fragments:

and

What is the result?

  • A. A compilation error occurs.
  • B. [Dog, Cat, Mouse]
  • C. null
  • D. DogCatMouse

Answer: B


NEW QUESTION # 20
Given the code fragment:

Assume that the value of now is 6:30 in the morning.
What is the result?

  • A. An exception is thrown at run time.
  • B. 0
  • C. 1
  • D. 2

Answer: B


NEW QUESTION # 21
You have been asked to create a ResourceBundle which uses a properties file to localize an application.
Which code example specifies valid keys of menu1 and menu2 with values of File Menu and View Menu?

  • A. <key>menu1</key><value>File Menu</value>
    <key>menu2</key><value>View Menu</value>
  • B. <key name = 'menu1">File Menu</key>
    <key name = 'menu2">View Menu</key>
  • C. menu1 = File Menu
    menu2 = View Menu
  • D. menu1, File Menu, menu2, View Menu Menu

Answer: C


NEW QUESTION # 22
The data.doc, data.txt and data.xml files are accessible and contain text.
Given the code fragment:
Stream<Path> paths = Stream.of (Paths. get("data.doc"),
Paths. get("data.txt"),
Paths. get("data.xml"));
paths.filter(s-> s.toString().endWith("txt")).forEach(
s -> {
try {
Files.readAllLines(s)
.stream()
.forEach(System.out::println); //line n1
} catch (IOException e) {
System.out.println("Exception");
}
}
);
What is the result?

  • A. The program prints the content of data.txt file.
  • B. A compilation error occurs at line n1.
  • C. The program prints the content of the three files.
  • D. The program prints:
    Exception
    <<The content of the data.txt file>>
    Exception

Answer: A


NEW QUESTION # 23
Given:
Item table
* ID, INTEGER: PK
* DESCRIP, VARCHAR(100)
* PRICE, REAL
* QUANTITY< INTEGER
And given the code fragment:
9 . try {
1 0. Connection conn = DriveManager.getConnection(dbURL, username, password);
1 1. String query = "Select * FROM Item WHERE ID = 110";
1 2. Statement stmt = conn.createStatement();
1 3. ResultSet rs = stmt.executeQuery(query);
1 4. while(rs.next()) {
1 5. System.out.println("ID: " + rs.getInt("Id"));
1 6. System.out.println("Description: " + rs.getString("Descrip"));
1 7. System.out.println("Price: " + rs.getDouble("Price"));
1 8. System.out.println(Quantity: " + rs.getInt("Quantity"));
1 9. }
2 0. } catch (SQLException se) {
2 1. System.out.println("Error");
2 2. }
Assume that:
The required database driver is configured in the classpath.
The appropriate database is accessible with the dbURL, userName, and passWordexists.
The SQL query is valid.
What is the result?

  • A. The code prints information about Item 110.
  • B. An exception is thrown at runtime.
  • C. Compilation fails.
  • D. The code prints Error.

Answer: D


NEW QUESTION # 24
Given the code fragments:

and

What is the result?

  • A. The program prints Run... and throws an exception.
  • B. Run...
    Call...
  • C. A compilation error occurs at line n2.
  • D. A compilation error occurs at line n1.

Answer: D


NEW QUESTION # 25
What is the name of the Java concept that uses access modifiers to protect variables and hide them within a class?

  • A. Abstraction
  • B. Polymorphism
  • C. Inheritance
  • D. Encapsulation
  • E. Instantiation

Answer: D

Explanation:
Using the private modifier is the main way that an object encapsulates itself and hide data from the outside world.
http://www.tutorialspoint.com/java/java_access_modifiers.htm


NEW QUESTION # 26
Given the code fragment:

What is the result?

  • A. [X, X]
  • B. [X][X, X][X, X, X]
  • C. [X][X, X][X, X, X][X, X, X, X]
  • D. [X, X][X, X, X, X]

Answer: C


NEW QUESTION # 27
Given the code fragment:
List<String> empDetails = Arrays.asList("100, Robin, HR", "200, Mary, AdminServices","101, Peter, HR"); empDetails.stream()
.filter(s-> s.contains("r"))
.sorted()
.forEach(System.out::println); //line n1
What is the result?

  • A. E. A compilation error occurs at line n1.
  • B. 100, Robin, HR200, Mary, AdminServices101, Peter, HR
  • C. 101, Peter, HR200, Mary, AdminServices
  • D. 100, Robin, HR101, Peter, HR

Answer: B


NEW QUESTION # 28
Given:
public enum USCurrency {
PENNY (1),
NICKLE(5),
DIME (10),
QUARTER(25);
private int value;
public USCurrency(int value) {
this.value = value;
}
public int getValue() {return value;}
}
public class Coin {
public static void main (String[] args) {
USCurrency usCoin =new USCurrency.DIME;
System.out.println(usCoin.getValue()):
}
}
Which two modifications enable the given code to compile? (Choose two.)

  • A. Nest the USCurrency enumeration declaration within the Coin class.
  • B. Add the final keyword in the declaration of value.
  • C. Make the getter method of value as a static method.
  • D. Make the USCurrency enumeration constructor private.
  • E. Remove the new keyword from the instantion of usCoin.

Answer: D,E


NEW QUESTION # 29
Given the code fragment:
public static void main (String[] args) throws IOException {
BufferedReader brCopy = null;
try (BufferedReader br = new BufferedReader (new FileReader("employee.txt")))
{ //
line n1
br.lines().forEach(c -> System.out.println(c));
brCopy = br; //line n2
}
brCopy.ready(); //line n3;
}
Assume that the ready method of the BufferedReader, when called on a closed BufferedReader, throws an exception, and employee.txt is accessible and contains valid text.
What is the result?

  • A. A compilation error occurs at line n3.
  • B. A compilation error occurs at line n1.
  • C. A compilation error occurs at line n2.
  • D. The code prints the content of the employee.txt file and throws an exception at line n3.

Answer: D


NEW QUESTION # 30
Given the following classes:

And given the following main method:

Which two options fail to compile when placed at line n1 of the main method?

  • A. employee .salary = 50_000;
  • B. manager .stockoption = 500;
  • C. director .salary = 80_000;
  • D. manager .budget = 1_000_000;
  • E. employee .budget = 200_000;
  • F. director .stockoptions = 1_000;

Answer: B,E


NEW QUESTION # 31
Given the code fragment

Which code fragments, inserted independently, enable the code compile?

  • A. t.fvar = 200;
  • B. this.fvar = 200;
    this.cvar = 400;
  • C. fvar = 200;
    cvar = 400;
  • D. this.fvar = 200;
    Test2.cvar = 400;
  • E. t.fvar = 200;
    Test2.cvar = 400;
  • F. cvar = 400;

Answer: F


NEW QUESTION # 32
Given the code fragment:

Which statement can be inserted into line n1 to print 1,2; 1,10; 2,20;?

  • A. BiFunction<Integer, Integer, String> c = (i, j) -> {System.out.print (i + "," + j+ "; ")};
  • B. BiConsumer<Integer,Integer> c = (i, j) -> {System.out.print (i + "," + j+ ";
    ");};
  • C. BiConsumer<Integer, Integer, String> c = (i, j) -> {System.out.print (i + "," + j+ "; ")};
  • D. BiConsumer<Integer, Integer, Integer> c = (i, j) -> {System.out.print (i + ","
    + j+ "; ");};

Answer: A


NEW QUESTION # 33
Given that data.txt and alldata.txt are accessible, and the code fragment:

What is required at line n1 to enable the code to overwrite alldata.txt with data.txt?

  • A. br.close();
  • B. bw.writeln();
  • C. br.flush();
  • D. bw.flush();

Answer: D


NEW QUESTION # 34
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?

  • A. Good day!
    followed by an Exceptionstack trace
  • B. A compilation error occurs at line n1.
  • C. Good day!
    Test
    null
  • D. Good day!
    Test
    followed by an Exceptionstack trace

Answer: B


NEW QUESTION # 35
Which statement is true about java.time.Duration?

  • A. It defines date-based values.
  • B. It defines time-based values.
  • C. It preserves daylight saving time.
  • D. It tracks time zones.

Answer: B

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


NEW QUESTION # 36
Given:

and the code fragment:

What is the result?

  • A. truefalse
  • B. falsefalse
  • C. truetrue
  • D. falsetrue

Answer: A


NEW QUESTION # 37
The data.doc, data.txt and data.xml files are accessible and contain text.
Given the code fragment:
Stream<Path> paths = Stream.of (Paths. get("data.doc"),
Paths. get("data.txt"),
Paths. get("data.xml"));
paths.filter(s-> s.toString().endWith("txt")).forEach(
s -> {
try {
Files.readAllLines(s)
.stream()
.forEach(System.out::println); //line n1
} catch (IOException e) {
System.out.println("Exception");
}
}
);
What is the result?

  • A. The program prints the content of data.txt file.
  • B. A compilation error occurs at line n1.
  • C. The program prints:Exception<<The content of the data.txt file>>Exception
  • D. The program prints the content of the three files.

Answer: A


NEW QUESTION # 38
......

1z1-809 Exam Dumps For Certification Exam Preparation: https://questionsfree.prep4pass.com/1z1-809_exam-braindumps.html