Quiz 7A
[APUE03] Most file I/O on a UNIX system can be performed using only five functions. Which one of the following is NOT correct?
seek
[APUE03] Which one of the following statements is NOT correct?
Associated with each file descriptor are the file descriptor flags and a pointer to a file table entry, and inode.
[APUE03] For file IO with buffering, consider the following statistics for a benchmark. The file was read using the program here with standard output redirected to /dev/null. The file system used for this test was the Linux ext4 file system with 4,096-byte blocks. Which one of the following statements is NOT correct?
Bigger the buffer size means better in performance evidenced in this statistics.
[APUE03] With "lseek" call options, which one of the following statements is NOT correct?
If whence is SEEK_NEXT, the file's offset is set to the size of the file plus the offset of the file's block size.
[APUE03] Which one of the following statements is NOT correct?
In POSIX-compliant applications, file descriptor 0 is replaced with the symbolic constants STDERR_FILENO
[APUE03] Which one of the following choices is NOT correct about v-node.
In SVR4, the v-node replaced the file system-independent i-node of SVR3. Solaris is derived from SVR4 and, therefore, uses i-nodes only.
[APUE03] Which one of the following statements is NOT correct?
In general, the term atomic operation refers to an operation consisting of multiple steps where each step can be interruptible for an atomic signal.
[APUE03] Which one of the following statements is NOT correct? For file "open" function call, one of the constants for the options is ___.
O_APONLY [open for appending only].
[APUE03] With File "open" call, this option ____ creates the file if it doesn't exist.
O_CREAT
[APUE03] With File "open" call, this option ____ generates an error if path doesn't refer to a directory.
O_DIRECTORY
[APUE03] With File "open" call, this option ____ generates an error if O_CREAT is also specified and the file already exists. This test for whether the file already exists and the creation of the file if it doesn't exist is an atomic operation.
O_EXCL
[APUE03] With File "open" call: if path refers to a FIFO, a block special file, or a character special file, this option ___ sets the nonblocking mode for both the opening of the file and subsequent I/O.
O_NONBLOCK
[APUE03] Which one of the following statements is NOT correct? Consider the following figure.
One reason each process gets its own file table entry is so that each process can share its own current file IO status with the other.
[APUE03] With File "lseek" call, which one of the following statements is not correct?
The "current file offset" is initialized to 0 and the next write pointer is set to the end of the file if the O_APPEND option is specified.
[APUE03] Which one of the following statements is NOT correct? Consider Unix file IO (e.g., read and write).
The lseek function modifies only the current file offset in the file table entry. It forces I/O take place.
[APUE03] With "read" function, which one of the following statements is NOT correct?
The number of bytes actually read is always same as the amount requested for a successful read.
[APUE03] Which one of the following statements is NOT correct?
The file descriptor is returned by creat as an argument to either read or write.
[APUE03] Which one of the following statements is NOT correct?
This convention of the designation of the file descriptors 0,1,2 (of a running process) is a standard and feature of the UNIX kernel.
[APUE03] Which one of the following choices is NOT correct about i-node.
Unix does not have v-node. Instead, a generic i-node structure is used.
[APUE03] With "lseek" call, which one of the following statements is NOT correct?
Using the file's offset greater than the file's current size, one can create a hole in a file and is not allowed as a legal file operation.
[APUE03] With "read" function, consider the cases for the number of bytes actually read is less than the amount requested. Which one of the following statements is NOT correct?
When reading a full data done but a signal may cause its partial data to be lost.
[APUE03] Which one of the following statements is NOT correct? Consider the following dup and dup2 calls. #include <unistd.h> int dup(int fd); int dup2(int fd, int fd2);
With dup2, if fd2 is already open, it will generate FD_CLOEXEC to close the file and then open it.
[APUE03] Which one of the following statements is NOT correct? The kernel maintains a file table for all open files of which each file table entry contains _____.
a file descriptor
[APUE03] Which one of the following statements is correct? The following figure shows ____.
how two processes can share a file
[APUE03] Which one of the following statements is NOT correct? With FreeBSD 8.0, Linux 3.2.0, Mac OS X 10.6.8, and Solaris 10, the limit of the maximum number of file descriptors is ___.
incremented by the multiples of file block size