A. Time zone abbreviation B. Full-text time zone name C. Era D. Julian date E. Time of the Epoch (in milliseconds)
A. Time zone abbreviation
Assuming that the variable today contains a date, the time zone abbreviation, such as Pacific Standard Time or Central European Summer Time, will be printed.
Assume that the SQL query returns records. What is the result?
A. Compilation fails. B. The program prints Error C. An exception is thrown at runtime D. The statement at line 16 execute
A. Compilation fails.
There is no GetRowCount method in java.sql.ResultSetMetaData.
The following line will not compile:
int rowCount = rsmd.getRowCount();
Reference: java.sql.ResultSetMetaData
Question 3:
Given a resource bundle MessageBundle, what is the name of the default bundle file?
A. MessageBundle.profile B. MessageBundle.xml C. MessageBundle.java D. MessageBundle.properties
D. MessageBundle.properties
A properties file is a simple text file. You should always create a default properties file. The name of this file begins with the base name of your ResourceBundle and ends with the .properties suffix. Reference: The Java Tutorials,Backing a ResourceBundle with Properties Files
Question 4:
The current working directory is named finance.
Which two code fragments allow you to write the salary.dat file if it does not exist under "finance\payroll"?
A. public static void setFileContent (String[] s) throws IOException { path p=paths.get("payroll\\salary.dat"); File file=p.toAbsolutePath().toFile(); try (BufferWriter br = new BufferWriter (new FileWriter(File))) { br.write ("experience new features of java"); } } B. public static void setFileContent (String[] s) throws IOException { path p=paths.get ("payroll\\salary.dat"); File file=p.toAbsolutePath(LinkOption.NOFOLLOW_LINKS).toFile(); try (BufferWriter br = new BufferWriter (new FileWriter(File))) { br.write ("experience new features of java"); } } C. public static void setFileContent (String[] s) throws IOException { File file= new file ("payroll\\salary.dat").getCanonicalFile(); try (BufferWriter br = new BufferWriter (new FileWriter(File))) { br.write ("experience new features of java"); } } D. public static void setFileContent (String[] s) throws IOException { File file= new File ("payroll\\salary.dat").getCanonicalFile(); try (BufferWriter br = new BufferWriter (new FileWriter(File))) { br.write ("experience new features of java"); } } E. public static void setFileContent (String[] s) throws IOException { File file=new File ("payroll\\salary.dat").getAbsolutePath(); try (BufferWriter br = new BufferWriter (new FileWriter(File))) { br.write ("experience new features of java"); } }
B. public static void setFileContent (String[] s) throws IOException { path p=paths.get ("payroll\\salary.dat"); File file=p.toAbsolutePath(LinkOption.NOFOLLOW_LINKS).toFile(); try (BufferWriter br = new BufferWriter (new FileWriter(File))) { br.write ("experience new features of java"); } } D. public static void setFileContent (String[] s) throws IOException { File file= new File ("payroll\\salary.dat").getCanonicalFile(); try (BufferWriter br = new BufferWriter (new FileWriter(File))) { br.write ("experience new features of java"); } }
The problem in this scenario is how to construct a system-dependent filename from the string "payroll\\salary.dat".
Regarding File-paths:
1- A file can have many relative paths.2- Canonical paths are absolute paths.3- An absolute path is not necessarily a canonical path! This holds trueespecially under Unix, which support symbolic links. Under Windows, anabsolute path is
usually a canonical path.
B:The absolute path can include symbolic links. Here we ignore them with NOFOLLOW_LINKS option.
D: The File.getCanonicalFile Method creates a new instance of a File object representing the file located at the absolute path of the current File object. All '.' and '..' references will be resolved.
Question 5:
Given:
public class DataCache {
private static final DataCache instance = new DataCache ();
public static DataCache getInstance () {
return instance;
}
Which design pattern best describes the class?
A. Singleton B. DAO C. Abstract Factory D. Composition
A. Singleton
Java has several design patterns Singleton Pattern being the most commonly used. Java Singleton pattern belongs to the family of design patterns, that govern the instantiation process. This design pattern proposes that at any time there can
only be one instance of a singleton (object) created by the JVM.
The class's default constructor is made private, which prevents the direct instantiation of the object by others (Other Classes). A static modifier is applied to the instance method that returns the object as it then makes this method a class level
method that can be accessed without creating an object.
Question 6:
Given the code fragment:
11.
public static getFileSize () throws IOException {
12.
path file = paths.get ("ex.txt");
13.
//insert code here
14.
System.out.println ("size: " + attr.size());
15.
}
public static getFileSize () throws IOException
{ Path file = Paths.get ("ex.txt");
//insert code here Line **
System.out.println ("size: " + attr.size());
}
Which two fragments, when inserted independently at line **, enable printing of the file size?
A. BasicFileAttributes attr = Files.readAttributes (file, BasicFileAttributes.class); B. PosixFileAttributes attr = Files.readAttributes (file, posixFileAttributes.class); C. DosFileAttributes attr = Files.readAttributes (file, dosAttributes.class); D. FileStore attr = Files.getFileStore (file); E. AclFileAttributeview attr = Files.getFileAttributeView(File, AclFileAttributeview.class);
A. BasicFileAttributes attr = Files.readAttributes (file, BasicFileAttributes.class); B. PosixFileAttributes attr = Files.readAttributes (file, posixFileAttributes.class);
A: The BasicFileAttributes has a size method.
B: The PosixFileAttributes has a size method.
Question 7:
Given:
import java.io.*;
public class SampleClass {
public static void main(String[] args) throws IOException {
try {
String dirName = args[0];
File dir = new File(dirName);
File.createTempFile("temp", "log", dir);
} catch (NullPointerException | IOException e) {
e = new IOException("Error while creating temp file");
throw e;
}
}
}
What is the result?
A. Compilation fails. B. An IOException with the default message is thrown at runtime. C. An IOException with the message Error while creating temp file is thrown at runtime. D. A temporary file is created in the specified directory.
A. Compilation fails.
The multi-catch parameter e may not be assigned. The compilation will fail at line: e = new IOException("Error while creating temp file");
A. getName (0): C:\ subpath(0, 2): C:\education\report.txt B. getName (0): C:\ subpath(0, 2): education\institute C. getName(0): education subpath(0, 2: education\institute\student D. getName(0): education subpath(0, 2): education\institute E. getName(0): report.txt subpath (0, 2): institute\student
D. getName(0): education subpath(0, 2): education\institute
The getName(int index) method returns a name element of this path as a Path object.
The subpath(int beginIndex, int endIndex) method returns a relative Path that is a subsequence of the name elements of this path.
Reference: java.nio.file.Path
Question 9:
The two methods of course rescue that aggregate the features located in multiple classes are .
A. Inheritance B. Copy and Paste C. Composition D. Refactoring E. Virtual Method Invocation
C. Composition E. Virtual Method Invocation
Question 10:
Which two methods are defined in the FileStore class print disk space information?
A. getTotalSpace () B. getFreeSpace () C. getUsableSpace () D. getTotalCapacity () E. getUsed ()
A. getTotalSpace () C. getUsableSpace ()
A: The getTotalSpace() method returns the size, in bytes, of the file store.
C: The getUsableSpace() method returns the number of bytes available to this Java virtual machine on the file store. Reference: Class java.nio.file.FileStore
Nowadays, the certification exams become more and more important and required by more and more
enterprises when applying for a job. But how to prepare for the exam effectively? How to prepare
for the exam in a short time with less efforts? How to get a ideal result and how to find the
most reliable resources? Here on Vcedump.com, you will find all the answers.
Vcedump.com provide not only Oracle exam questions,
answers and explanations but also complete assistance on your exam preparation and certification
application. If you are confused on your 1Z0-805 exam preparations
and Oracle certification application, do not hesitate to visit our
Vcedump.com to find your solutions here.