Chapter 14: I/O Flashcards
(79 cards)
True or False: NIO stands for non-blocking input/output API. If false, why?
False. NIO stands for New Input/Output, not necessarily non-blocking.
True or False: Java 17 SE OCP 1Z0-829 covers both NIO version 1 and version 2. If false, why?
False. The exam only covers NIO version 2.
True or False: Data can be stored in persistent storage devices like hard disk drives and memory cards.
True
True or False: A file within a storage device can contain directories. If false, why?
False. A file holds data, while a directory contains files and other directories.
In Java, directories and files can be treated similarly.
True
The JVM must be manually configured to connect to the file system. If false, why?
False. The JVM automatically connects to the local file system.
True or False: The root directory is always the same across all operating systems. If false, why?
False. Windows uses drive letters (e.g., C:), while Linux uses “/”.
True or False: A path is a representation of a file or directory in the file system.
True
The path separator character is the same for all operating systems. If false, why?
False. It differs; Windows uses “”, while Linux uses “/”.
The system property “file.separator” retrieves the local separator character.
True
True or False: An absolute path includes the full path from the root directory.
True
True or False: A relative path always starts from the root directory. If false, why?
False. A relative path starts from the current working directory.
Whether a path is absolute or relative is independent of the file system. If false, why?
False. It depends on the file system’s conventions
The path /bird/parrot.png is an absolute path in Windows. If false, why?
False. In Windows, absolute paths start with a drive letter, not “/”.
The “.” symbol represents the parent directory. If false, why?
False. “.” refers to the current directory, not the parent.
The “..” symbol refers to the parent directory.
True
A symbolic link is a special file that points to another file or directory.
True
A symbolic link is a copy of the original file. If false, why?
False. A symbolic link is a reference, not a copy.
A File object can represent only a file, not a directory. If false, why?
False. A File object can represent both a file and a directory.
The File class provides only one constructor to create a File object. If false, why?
False. The File class has multiple constructors that accept different parameters, such as a single String, a parent and child String, or a parent File and child String.
If we pass null as the parent in new File(parent, “data/stripes.txt”), it behaves like new File(“data/stripes.txt”). If false, why?
True
The Path interface can be instantiated directly using the new keyword. If false, why?
False. Path is an interface and cannot be instantiated directly; instead, we use factory methods like Path.of() or Paths.get().
The Path.of() method was introduced in Java 8. If false, why?
False. Path.of() was introduced in Java 11.
Both Path.of() and Paths.get() can accept varargs to build a path dynamically. If false, why?
True