MCQOPTIONS
Saved Bookmarks
This section includes 11 Mcqs, each offering curated multiple-choice questions to sharpen your Java knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Which feature of java 7 allows to not explicitly close IO resource? |
| A. | try catch finally |
| B. | IOException |
| C. | AutoCloseable |
| D. | Streams |
| Answer» D. Streams | |
| 2. |
Which jar provides FileUtils which contains methods for file operations? |
| A. | file |
| B. | apache commons |
| C. | file commons |
| D. | dir |
| Answer» C. file commons | |
| 3. |
How can we filter lines based on content? |
| A. | lines.filter() |
| B. | filter(lines) |
| C. | lines.contains(filter) |
| D. | lines.select() |
| Answer» B. filter(lines) | |
| 4. |
How can we create a symbolic link to file? |
| A. | createLink() |
| B. | createSymLink() |
| C. | createSymbolicLink() |
| D. | createTempLink() |
| Answer» D. createTempLink() | |
| 5. |
How to read entire file in one line using java 8? |
| A. | Files.readAllLines() |
| B. | Files.read() |
| C. | Files.readFile() |
| D. | Files.lines() |
| Answer» B. Files.read() | |
| 6. |
How can we get the size of specified file? |
| A. | capacity(path) |
| B. | size(path) |
| C. | length(path) |
| D. | Path.size() |
| Answer» C. length(path) | |
| 7. |
How to copy the file from one location to other? |
| A. | Files.copy(source, target) |
| B. | Path.copy(source, target) |
| C. | source.copy(target) |
| D. | Files.createCopy(target) |
| Answer» B. Path.copy(source, target) | |
| 8. |
Which method can be used to check fileAccessiblity? |
| A. | isReadable(path) |
| B. | isWritable(path) |
| C. | isExecutable(path) |
| D. | isReadable(path), isWritable(path), and isExecutable(path) |
| Answer» E. | |
| 9. |
WHICH_FEATURE_OF_JAVA_7_ALLOWS_TO_NOT_EXPLICITLY_CLOSE_IO_RESOURCE??$ |
| A. | try catch finally |
| B. | IOException |
| C. | AutoCloseable |
| D. | Streams |
| Answer» D. Streams | |
| 10. |
How can we delete all files in a directory? |
| A. | Files.delete(path) |
| B. | Files.deleteDir() |
| C. | Directory.delete() |
| D. | Directory.delete(path) |
| Answer» B. Files.deleteDir() | |
| 11. |
Which method is used to create a directory with fileattributes? |
| A. | Path.create() |
| B. | Path.createDirectory() |
| C. | Files.createDirectory(path, fileAttributes) |
| D. | Files.create(fileAttributes) |
| Answer» D. Files.create(fileAttributes) | |