CS 3377 Test 2

Ace your homework & exams now with Quizwiz!

[APUE01] This filename is automatically created whenever a new directory is created. root home directory . (called dot) hidden file .profile

. (called dot)

[APUE01] ___ refers to the current directory. root home directory . (called dot) .. (called dot-dot) .profile

. (called dot)

[APUE01] Which of the following statements is not correct? Usually, a process has only one thread of control—one set of machine instructions executing at a time. Multiple threads of control can exploit the parallelism possible on multiprocessor systems. All threads within a process share the same address space, file descriptors, stacks, and process-related attributes. Each thread executes on its own stack, although any thread can access the stacks of other threads in the same process. Because each thread within a process can access the same memory, the threads do not need to synchronize access to shared data among themselves to avoid inconsistencies

Because each thread within a process can access the same memory, the threads do not need to synchronize access to shared data among themselves to avoid inconsistencies.

[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? This accounts for the minimum in the system time occurring at the few timing measurements starting around a BUFFSIZE of 4,096. Increasing the buffer size beyond this limit of a BUFFSIZE of 4096 has little positive effect. Most file systems support some kind of read-ahead to improve performance. When sequential reads are detected, the system tries to read in more data than an application requests, assuming that the application will read it shortly. The effect of read-ahead can be seen here, where the elapsed time for buffer sizes as small as 32 bytes is as good as the elapsed time for larger buffer sizes. Bigger the buffer size means better in performance evidenced in this statistics.

Bigger the buffer size means better in performance evidenced in this statistics.

[APUE04] ____ is a type of file providing buffered I/O access in fixed-size units to devices such as disk drives. Regular file Directory file Block Special file Character Special file FIFO Socket Symbolic link

Block Special file

[APUE04] ____ is a type of file providing unbuffered I/O access in variable-sized units to devices. All devices on a system are either block special files or character special files. Regular file Directory file Block Special file Character Special file FIFO Socket Symbolic link

Character Special file

[APUE04] ____ is a file that contains the names of other files and pointers to information on these files.Any process that has read permission for ____ can read the contents of the directory, but only the kernel can write directly to ____.Processes must use the functions described in this chapter to make changes to a directory. Regular file Directory file Block Special file Character Special file FIFO Socket Symbolic link

Directory file

[APUE04] ___ is a type of file that points to another file. Regular file Directory file Block Special file Character Special file FIFO Socket Symbolic link

Symbolic link

[APUE03] With File "lseek" call, which one of the following statements is not correct? Every open file has an associated "current file offset" Current file offset of an opened file is normally a non-negative integer that measures the number of bytes from the beginning of the file. Read and write operations normally start at the current file offset and cause the offset to be incremented by the number of bytes read or written. By default, this "current file offset" is initialized to 0 when a file is opened, unless the O_APPEND option is specified. 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.

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] With File "open" call, this option ____ creates the file if it doesn't exist. O_CREAT O_CREATE O_CRONLY O_CRT O_CREATEONLY

O_CREAT

[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.

[APUE04] Which one of the following statements is NOT correct? Consider umask bits. The umask value 0000 is to allow anyone to do read, write, or execute the files The umask value 0002 is to prevent others from writing the files The umask value 0022 is to prevent group members and others from writing the files The umask value 0027 is to prevent group members from writing your files and others from reading, writing, or executing the files. The umask value 0700 is to allow the user (owner) to read, write, or execute the files

The umask value 0700 is to allow the user (owner) to read, write, or execute the files

[APUE01] Which of the following statements is not correct? Signals are a technique used to notify a process that some condition has occurred. If a process divides by zero, the signal whose name is SIGFPE (floating-point exception) is sent to the process. The process has three choices for dealing with the signal. The signals are not recommended with the recent Unix and Linux systems with cloud computing, and are replaced by more sophisticated exception handlers.

The signals are not recommended with the recent Unix and Linux systems with cloud computing, and are replaced by more sophisticated exception handlers.

[APUE03] Which one of the following statements is NOT correct? By convention, UNIX System shells associate file descriptor 0 with the standard input of a process. By convention, UNIX System shells associate file descriptor 1 with the standard output of a process. By convention, UNIX System shells associate file descriptor 2 with the standard error of a process. 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. Many applications would break if these associations weren't followed.

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.

[APUE04] Which one of the following statements is NOT correct? Consider the file and/or directory access. The read permission for a file determines whether we can open an existing file for reading: the O_RDONLY and O_RDWR flags for the open function. The write permission for a file determines whether we can open an existing file for writing: the O_WRONLY and O_RDWR flags for the open function. We must have write permission for a file to specify the O_TRUNC flag in the open function. We cannot create a new file in a directory unless we have write permission and execute permission in the directory. To delete an existing file, we need only the write permission for the file itself. Execute permission for a file must be on if we want to execute the file using any of the seven exec functions. The file also has to be a regular file.

To delete an existing file, we need only the write permission for the file itself.

[APUE04] Which one of the following statements is not correct?Consider umask. Most users of UNIX systems never deal with their umask value. umask value is usually set once, on login, by the shell's start-up file, and never changed. Writing programs that create new files, if we want to ensure that specific access permission bits are enabled, we must modify the umask value while the process is running. To ensure that anyone can read a file, we should set the umask to 0777. The umask value that is in effect when our process is running can cause permission bits to be turned off.

To ensure that anyone can read a file, we should set the umask to 0777.

[APUE01] Which of the following statements is not correct? When a signal occurs, one of the actions is ___. To ignore the signal. To let the default action occur. To provide a function to be called when a signal occurs. To mask the signal. To provide a callback function for the signal.

To provide a callback function for the signal.

[APUE01] Which of the following statements is not correct? -One entry in the password file specifies our numeric group ID. -The group ID of each User ID is assigned by the system administrator when our login name is assigned. -Typically, each password file contains only one unique group ID that specify the same group ID. -Groups are normally used to collect users together into projects or departments. -One function and use of Group ID allows the sharing of resources, such as files, among members of the same group.

Typically, each password file contains only one unique group ID that specify the same group ID.

[Sobell-process] Which one of the following choices is NOT one of the four columns of ps command normally displayed? CMD PID TIME TTY USER

USER

[APUE01] Consider the following user-information entry when the system looks up and checks at the time of log-in with the following user entry there. Which one of the choices is correct?sar:x:205:105:Stephen.Rago:/home/sar:/bin/ksh User ID is 105 User ID is 205 User ID is x User ID is not shown here User ID is encrypted and shown as x

User ID is 205

[APUE01] Consider the following user-information entry when the system looks up and checks at the time of log-in with the following user entry there. Which one of the choices is correct?sar:x:205:105:Stephen.Rago:/home/sar:/bin/ksh User home directory is /bin/ksh User home directory is /home/sar User home directory is Stephen.Rago User home directory is Stephen.Rago:/home/sar User home directory is not shown here

User home directory is /home/sar

[APUE01] The UNIX file system is _____ arrangement of directories and files. a hierarchical a network a relational a physical a conceptual

a hierarchical

[APUE01] ___ is an executable file residing on disk in a directory. ____ is read into memory and is executed by the kernel as a result of one of the seven exec functions. A process A program A thread A socket A shell

a program

[APUE01] ___ is a command-line interpreter that reads user input and executes commands. A console A script A shell A terminal An IDE

a shell

[Process2] A process may do ___ with the signal ignore the signal let the default action occur provide a function to handle the signal all of the above none of the above

all of the above

[APUE01] A pathname that begins with a slash is called ____. an absolute pathname a relative pathname a URL name a file name a resource link

an absolute pathname

[Process2] Signals provide a way of handling ___ events deadlocked racing asynchronous synchronous idle-process

asynchronous

[Process2] Consider a code segment for a pipe (e.g., to run "ls | wc") as we discussed in the classes, shown below. What would it be the code segment for the "parent" process here after the fork but before exec (of "ls" or "wc")? close(pfd[0]); dup2(pfd[1], 1); close(pfd[1]); close(pfd[0]); dup2(pfd[1], 0); close(pfd[1]); close(pfd[1]); dup2(pfd[0], 1); close(pfd[0]); close(pfd[1]); dup2(pfd[0], 0); close(pfd[0]);

close(pfd[0]); dup2(pfd[1], 1); close(pfd[1]);

[APUE01] In the root directory, dot-dot is the same as ____. null /bin/null file-system dot the previous directory

dot

[APUE03] Most file I/O on a UNIX system can be performed using only five functions. Which one of the following is NOT correct? open read write seek close

seek

[APUE04] The ____ function sets the file mode creation mask for the process and returns the previous value. access chmod mask mode umask

umask

[APUE01] For portability, POSIX.1 recommends restricting filenames to consist of the following characters: letters (a-z, A-Z), numbers (0-9), period (.), dash (-), and _____ character. escape back-slash slash null underscore

underscore

[APUE04] Which one of the following statements is not correct? The stat function returns ___ of the following file information. file type & mode (permissions) i-node number (serial number) v-node number number of links user ID of owner size in bytes, for regular files time of last access time of last modification

v-node number

[APUE01] Every process has a ____ directory. This is the directory from which all relative pathnames are interpreted. A process can change its ___ directory with the chdir function. absolute home relative root working

working

[Process2] When a process calls this API call (or one of these API calls), that process is completely replaced by the new program, and the new program starts executing at its main function. It merely replaces the current process its text, data, heap, and stack segments with a brand-new program from disk. fork exec pipe dup system

exec

[APUE01] ____ is normally small non-negative integer that the kernel uses to identify the file accessed by a process. Whenever it opens an existing file or creates a new file, the kernel returns ____ that we use when we want to read or write the file. file flag file descriptor file table accessor i-node pointer v-node pointer

file descriptor

[Process2] If a process needs a child process to do some of its work, it will call ___ to make a copy of the current process. dup clone thread fork dup

fork

[APUE01] When one logs in, the default directory is set to be one's ___ directory which is obtained from our entry in the password file. absolute home relative root working

home

[APUE03] Which one of the following statements is correct? The following figure shows ____. how a process can have a file opened with two file descriptors how two processes can share a file how a process maintains two entries in the file table how two file descriptors of a process can be integrated in v-node table virtually how two v-nodes can be shared by one process

how two processes can share a file

[Process2] The ____ contains all the information about the file: the file type, the file's access permission bits, the size of the file, pointers to the file's data blocks, and so on. cylinder disk file block i-node dup

i-node

[APUE01] In Unix, it is easy to measure the clock time, user time, and system time of any process: simply execute the ___ command, with the argument for what we want to measure. date time cputime ps pstime

time

[APUE01] Which of the following statements is not correct? -Many conditions generate signals. -The interrupt key is generated with the DELETE key or Control-C -The quit key, is often generate with Control-backslash, used to interrupt the currently running process. -One way to generate a signal is by calling the getpid function. -One can call the kill function from a process to send a signal to another process.

-One way to generate a signal is by calling the getpid function.

[APUE01] There is also a group file that maps group names into numeric group IDs. The group file is usually ____. /etc/group /etc/passwd /etc/userid /etc/host /etc/usergroup

/etc/group

[APUE01] The system then looks up our login name in its password file, usually the file ____. /etc/passwd /system/password /admin/pass /usr/bin/pwfile /sbin/passwd

/etc/passwd

[Process2] After fork, the return value for the child is ___ -1 0 +1 a new process ID for the child process the process id of the parent process

0

[Process2] By convention, UNIX System shells associate the file descriptor __ with the standard input of a process. 0 1 2 3 -1

0

[Process2] Including the initial parent process, the total number of the processes (in total) will be ____ after executing the code segment below. if (pid=fork()) {fork();} if (pid=fork()) {fork();} if (pid=fork()) {fork();} 8 9 16 27 32

27

[Process2] By convention, all shells in Unix open ___ file descriptors whenever a new program is run. 0 1 2 3 4 as many as needed

3

[Process2] Including the initial parent process, the total number of the processes (in total) will be ____ after executing the code segment below. if (pid=fork() && pid2 = fork()) {fork();} if (pid=fork() && pid2 = fork()) {fork();} if (pid=fork() && pid2 = fork()) {fork();} 16 27 32 48 64

64

[Process2] Including the initial parent process, the total number of the processes (in total) will be ____ after executing the code segment below. fork(); fork(); fork(); 1 4 6 8 16

8

[APUE01] Which one of the following statements is NOT correct? -A directory is a file that contains directory entries. -A directory could be any physical device which represents the hierarchical file system. -Logically, each directory entry could be considered as containing a filename along with a structure of information describing the attributes of the file. -The attributes of a file are such things as the type of file (regular file, directory), the size of the file, the owner of the file, permissions for the file (whether other users may access this file), and when the file was last modified. -The stat and fstat functions return a structure of information containing all the attributes of a file.

A directory could be any physical device which represents the hierarchical file system.

[APUE01] An executing instance of a program is called _____, a term used on almost every page of this text. Some operating systems use the term task to refer to a program that is being executed. A process A program A thread A socket A shell

A program

[APUE01] In Unix file system, everything starts in the directory called ____, whose name is the single character /. system root superdirectory partition home directory

root

[Process2] After fork, the differences between the parent and child are ____. The return values from fork The process IDs The different parent process IDs All of the above None of the above

All of the above

[APUE04] Which one of the following statements is NOT correct? There are two types of links: hard link and symbolic link. Any user can create a hard or symbolic link to a directory. A symbolic link is an indirect pointer to a file. A hard link points directly to the i-node of the file. Hard links normally require that the link and the file reside in the same file system.

Any user can create a hard or symbolic link to a directory.

[APUE03] Which one of the following statements is NOT correct? The UNIX System supports the sharing of open files among different processes. The kernel uses three data structures to represent an open file, and the relationships among them determine the effect one process has on another with regard to file sharing. Every process has an entry in the process table maintained by the kernel. Within each process table entry is a table of open file descriptors Associated with each file descriptor are the file descriptor flags and a pointer to a file table entry, and inode.

Associated with each file descriptor are the file descriptor flags and a pointer to a file table entry, and inode.

[APUE04] ____ is a type of file used for communication between processes. It's sometimes called a named pipe. Regular file Directory file Block Special file Character Special file FIFO Socket Symbolic link

FIFO

[APUE04] Which one of the following statements is not correct? Given a pathname, the stat function returns a structure of information about the named file. Given a pathname, the fstat function obtains the information about the file that is already open on the descriptor. Given a pathname, the lstat function is similar to stat, but when the named file is a symbolic link, lstat returns the information about the symbolic link, not the file referenced by the symbolic link. Given a pathname, the function nstat obtains the information about the named file. Given a pathname, the fstatat function provides a way to return the file statistics for a pathname relative to an open directory represented by the fd argument.

Given a pathname, the function nstat obtains the information about the named file.

[APUE04] Which one of the following statements is NOT correct? Consider the file and/or directory access. The file access tests that the kernel performs each time a process opens, creates, or deletes a file depend on the owners of the file (st_uid and st_gid), the effective IDs of the process (effective user ID and effective group ID), and the supplementary group IDs of the process, if supported. The two owner IDs are properties of the file, whereas the two effective IDs and the supplementary group IDs are properties of the process. The tests performed by the kernel are as follows: If the effective user ID of the process is 0 (the superuser), access is allowed. This gives the superuser free rein throughout the entire file system. If the effective user ID of the process equals the owner ID of the file (i.e., the process owns the file), access is allowed if the appropriate user access permission bit is set. Otherwise, permission is denied. If the process is executing the file, the user-execute bit must be on if the process group ID of the process equals the group ID of the file (i.e., the process group owns the file). If the effective group ID of the process or one of the supplementary group IDs of the process equals the group ID of the file, access is allowed if the appropriate group access permission bit is set. Otherwise, permission is denied. If the appropriate other access permission bit is set, access is allowed. Otherwise, permission is denied.

If the process is executing the file, the user-execute bit must be on if the process group ID of the process equals the group ID of the file (i.e., the process group owns the file).

[APUE03] With "lseek" call options, which one of the following statements is NOT correct? If whence is SEEK_SET, the file's offset is set to offset bytes from the beginning of the file. If whence is SEEK_CUR, the file's offset is set to its current value plus the offset. If whence is SEEK_END, the file's offset is set to the size of the file plus the offset. 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. Because a successful call to lseek returns the new file offset, one can seek zero bytes from the current position to determine the current offset.

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? By convention, UNIX System shells associate three file descriptors and their values are standardized by POSIX.1. In POSIX-compliant applications, file descriptor 0 is replaced with the symbolic constants STDERR_FILENO For the file-descriptor constants, these constants (e.g., STDIN_FILENO) are defined in the <unistd.h> header. File descriptors range from 0 through OPEN_MAX - 1. Early historical implementations of the UNIX System had an upper limit of 19, allowing a maximum of 20 open files per process, but many systems subsequently increased this limit to 63.

In POSIX-compliant applications, file descriptor 0 is replaced with the symbolic constants STDERR_FILENO

[APUE04] ___ is a type of file used for network communication between processes. ___ can also be used for non-network communication between processes on a single host. Regular file Directory file Block Special file Character Special file FIFO Socket Symbolic link

Socket

[APUE03] Which one of the following choices is NOT correct about v-node. The v-node was invented to provide support for multiple file system types on a single computer system. The (v-node) work was done independently by Peter Weinberger (Bell Laboratories) and Bill Joy (Sun Microsystems). Sun called this work (v-node) the Virtual File System and called the file system-independent portion of the i-node the v-node [Kleiman 1986]. The v-node propagated through various vendor implementations as support for Sun's Network File System (NFS) was added. The first release from Berkeley to provide v-nodes was the 4.3BSD Reno release, when NFS was added. 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. Instead of splitting the data structures into a v-node and an i-node, Linux uses a file system-independent i-node and a file system-dependent i-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.

[APUE01] Which of the following statements is not correct? -In addition to the group ID specified in the password file for a login name, most versions of the UNIX System restricts a user to belong to one group only. -The practice of supplementary groups started with 4.2BSD to let a user to belong to many other groups. -The number of supplementary groups of a user ID is usually up to 16 additional groups. -The supplementary group IDs are obtained at login time by reading the file /etc/group. -POSIX requires that a system support at least 8 supplementary groups per process, but most systems support at least 16.

In addition to the group ID specified in the password file for a login name, most versions of the UNIX System restricts a user to belong to one group only.

[APUE04] Which one of the following statements is NOT correct? Symbolic links are typically used to ''move'' a file or an entire directory hierarchy to another location on a system. If the function follows a symbolic link, a pathname argument to the function refers to the file pointed to by the symbolic link. In all modern systems, chown does not follow symbolic links. There are no file system limitations on a symbolic link and what it points to. Anyone can create a symbolic link to a directory.

In all modern systems, chown does not follow symbolic links.

[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. If the operation is performed atomically, either all the steps are performed (on success) or none are performed (on failure). If the operation is performed atomically, it must not be possible for only a subset of the steps to be performed. The Single UNIX Specification includes two functions (pread and pwrite) that allow applications to seek and perform I/O atomically. One case for a need of an atomic operation is when the file is created by one process between the two (open and creat) function calls, and if that other process writes something to the file, that data is erased when this creat is executed.

In general, the term atomic operation refers to an operation consisting of multiple steps where each step can be interruptible for an atomic signal.

[APUE04] Which one of the following statements is NOT correct? Consider umask command. Users can set the umask value to control the default permissions on the files they create. The umask value is expressed in octal, with one bit representing one permission to be masked off. With umask value, the permissions can be denied by setting the corresponding bits. The Single UNIX Specification requires that the umask command support a symbolic mode of operation. Like the octal format with umask command, the symbolic format specifies which permissions are to be denied (i.e., clear in the file creation mask) instead of which ones are to be denied (i.e., set in the file creation mask).

Like the octal format with umask command, the symbolic format specifies which permissions are to be denied (i.e., clear in the file creation mask) instead of which ones are to be denied (i.e., set in the file creation mask).

[APUE01] Consider the following user-information entry when the system looks up and checks at the time of log-in with the following user entry there. Which one of the choices is correct?sar:x:205:105:Stephen.Rago:/home/sar:/bin/ksh Login user name is sar. Login user name is x. Login user name is Steven.Rago. Login user name is /home/sar Login user name is ksh

Login user name is sar

[APUE01] Which of the following statements is not correct? -Historically, UNIX systems have maintained two different time values: Calendar time and Process time. -Calendar time counts the number of seconds since the Epoch: 00:00:00 January 1, 1970, Coordinated Universal Time (UTC). -Process time is called CPU time and measures the central processor resources used by a process. -Process time is measured in clock ticks, which have historically been 50, 60, or 100 ticks per micro-second. -The primitive system data type clock_t holds these various time values.

Process time is measured in clock ticks, which have historically been 50, 60, or 100 ticks per micro-second.

[APUE04] Which one of the following statements is NOT correct?Consider the file and/or directory access, and chmod command. To open the file /usr/include/stdio.h, we need execute permission in the directory /, execute permission in the directory /usr, and execute permission in the directory /usr/include. If the current directory is /usr/include, then we need execute permission in the current directory to open the file stdio.h. Read permission lets us read the directory, obtaining and searching through a list of all the filenames in the directory. Execute permission lets us pass through the directory when it is a component of a pathname that we are trying to access (in order to search the directory to look for a specific filename). If the PATH environment variable specifies a directory that does not have execute permission enabled, the shell will never find executable files in that directory.

Read permission lets us read the directory, obtaining and searching through a list of all the filenames in the directory.

[APUE01] Which of the following statements is not correct? The UNIX System maintains various time values for a process. One of them is ___. Clock time Wall Clock time User CPU time System CPU time Signal Interrupt time

Signal Interrupt time

[APUE04] Which one of the following statements is NOT correct? Consider the following commands.$ ln -s /no/such/file myfile$ ls myfilemyfile$ cat myfilecat: myfile: No such file or directory$ ls -l myfilelrwxrwxrwx 1 sar 13 Jan 22 00:26 myfile -> /no/such/file The "ln" command creates a symbolic link. Here a symbolic link is created to point a file named "myfile." The file "myfile" does exist, yet cat says there is no such file, because "myfile" is a symbolic link. Here the file pointed to by the symbolic link doesn't exist. The -l option to "ls" command gives us one hint: the first character is an l, which means a symbolic link. The -l option to "ls" command gives us one hint: the sequence -> also indicates a symbolic link. The ls command with option (-F) that appends an at-sign (@) to filenames that are symbolic links.

The "ln" command creates a symbolic link. Here a symbolic link is created to point a file named "myfile."

[APUE01] _____ developed by Steve ____ at Bell Labs, has been in use since Version 7 and is provided with almost every UNIX system in existence. The control-flow constructs of this shell are reminiscent of Algol 68. The Bourne shell The C shell The Korn shell The Bourne-again shell The TENEX C shell

The Bourne shell

[APUE01] _____ is the GNU shell provided with all Linux systems. It was designed to be POSIX conformant, while still remaining compatible with the Bourne shell. It supports features from both the C shell and the Korn shell. The Bourne shell The C shell The Korn shell The Bourne-again shell The TENEX C shell

The Bourne-again shell

[APUE01] This shell _____, developed by Bill Joy at Berkeley, is provided with all the BSD releases. Additionally, this shell was provided by AT&T with System V/386 Release 3.2 and was also included in System V Release 4 (SVR4).This shell was built on the 6th Edition shell, not the Bourne shell. Its control flow looks more like the C language, and it supports additional features: job control, a history mechanism, and command-line editing. The Bourne shell The C shell The Korn shell The Bourne-again shell The TENEX C shell

The C shell

[APUE01] This shell _____ is considered a successor to the Bourne shell and was first provided with SVR4. This is developed by David ___ at Bell Labs, runs on most UNIX systems, but before SVR4 was usually an extra-cost add-on, so it is not as widespread as the other two shells. It is upward compatible with the Bourne shell and includes those features that made the C shell popular: job control, command-line editing, and so on. The Bourne shell The C shell The Korn shell The Bourne-again shell The TENEX C shell

The Korn shell

[APUE01] _____ is an enhanced version of the C shell. It borrows several features, such as command completion, from the TENEX operating system (developed in 1972 at Bolt Beranek and Newman). The TENEX C shell adds many features to the C shell and is often used as a replacement for the C shell. The Bourne shell The C shell The Korn shell The Bourne-again shell The TENEX C shell

The TENEX C shell

[APUE04] Which one of the following statements is not correct? Consider the file and/or directory access, and chmod command. The chmod command is typically used to modify the six permission bits. The chmod command allows one to specify u for user (owner), g for group, and o for other. The three categories (read, write, and execute) are used in various ways by different functions with the chmod command. Whenever we want to open any type of file by name, we must have execute permission in each directory mentioned in the name, including the current directory, if it is implied. The excute-permission bit for a directory is often called the search bit.

The chmod command is typically used to modify the six permission bits.

[APUE04] Every process has six or more IDs associated with it. The saved set-user-ID and saved set-group-ID contain copies of ___, respectively, when a program is executed. The real user ID and the real group ID The effective user ID and the effective group ID The saved set-user-ID and the saved set-group-ID The virtual user ID and the virtual group ID The system user ID and the system group ID

The effective user ID and the effective group ID

[APUE04] Every process has six or more IDs associated with it. This ____ determines one's file access permissions. The real user ID and the real group ID The effective user ID and the effective group ID The saved set-user-ID and the saved set-group-ID The virtual user ID and the virtual group ID The system user ID and the system group ID

The effective user ID and the effective group ID

[APUE01] Which of the following statements is not correct? The user ID from our entry in the password file is a numeric value that identifies us to the system. The user ID is assigned by the system administrator when our login name is assigned, and we cannot change it. The user ID is normally assigned to be unique for every user. The kernel uses the user ID to check whether we have the appropriate permissions to perform certain operations. We call the user whose user ID is 0 either root or the superuser. The entry in the password file normally has a login name of superuser, with the special privileges.

The entry in the password file normally has a login name of superuser, with the special privileges.

[APUE01] Which of the following statements is not correct? -The fork returns the non-negative process ID of the new child process to the parent process -The fork returns 0 to the child process. -Because fork creates a new process, we say that it is called once—by the parent—but returns twice—in the parent and in the child. -In the child process, one may call execlp to execute Unix or Linux command. -The fork call replaces the child process with the new program file. -The combination of fork followed by exec is called spawning a new process on some operating systems.

The fork call replaces the child process with the new program file.

[APUE04] Which one of the following statements is NOT correct? Using mkdir command, testdir has been just created. Consider the figure below as a result. The i-node whose number is 2549 has a type field of ''directory'' and a link count equal to 3. Any leaf directory (a directory that does not contain any other directories) always has a link count of 2. The value (the link count) of 2 for the i-node of 2549 comes from the directory entry that names the directory (testdir) and from the entry for dot in that directory. The i-node whose number is 1267 has a type field of ''directory'' and a link count that is greater than or equal to 3. Every subdirectory in a parent directory causes the parent directory's link count to be increased by 1.

The i-node whose number is 2549 has a type field of ''directory'' and a link count equal to 3.

[APUE03] Which one of the following statements is NOT correct? Consider Unix file IO (e.g., read and write). After each write is complete, the current file offset in the file table entry is incremented by the number of bytes written. If this causes the current file offset to exceed the current file size, the current file size in the i-node table entry is set to the current file offset (for example, the file is extended). If a file is opened with the O_APPEND flag, a corresponding flag is set in the file status flags of the file table entry. Each time a write is performed for a file with this append flag set, the current file offset in the file table entry is first set to the current file size from the i-node table entry. This forces every write to be appended to the current end of file. If a file is positioned to its current end of file using lseek, all that happens is the current file offset in the file table entry is set to the current file size from the i-node table entry. The lseek function modifies only the current file offset in the file table entry. It forces I/O take place.

The lseek function modifies only the current file offset in the file table entry. It forces I/O take place.

[APUE01] Which of the following statements is NOT correct? The UNIX System provides a single system call that returns the number of seconds since the Epoch: midnight, January 1, 1970, Coordinated Universal Time. Any interpretation of the value of the time function, such as converting it to a human-readable time and date using the local time zone, is left to the user process. The standard C library provides routines to handle most cases. These library routines handle such details as the various algorithms for daylight saving time. An application can either make a system call or call a library routine. One difference between system calls and library functions is that system calls usually provide a minimal interface, whereas library functions often provide more elaborate functionality. The process control system calls (fork, exec, and waitpid) are usually not invoked by the user's application code directly.

The process control system calls (fork, exec, and waitpid) are usually not invoked by the user's application code directly.

[APUE04] Every process has six or more IDs associated with it. Normally, the effective user ID and the effective group ID equals ____ respectively. The real user ID and the real group ID The effective user ID and the effective group ID The saved set-user-ID and the saved set-group-ID The virtual user ID and the virtual group ID The system user ID and the system group ID

The real user ID and the real group ID

[APUE04] Every process has six or more IDs associated with it. ____ identify who we really are. These two fields are taken from our entry in the password file when we log in. Normally, these values don't change during a login session, although there are ways for a superuser process to change them. The real user ID and the real group ID The effective user ID and the effective group ID The saved set-user-ID and the saved set-group-ID The virtual user ID and the virtual group ID The system user ID and the system group ID

The real user ID and the real group ID

[APUE04] Every process has six or more IDs associated with it. ____ contain copies of the effective user ID and the effective group ID, respectively, when a program is executed. The real user ID and the real group ID The effective user ID and the effective group ID The saved set-user-ID and the saved set-group-ID The virtual user ID and the virtual group ID The system user ID and the system group ID

The saved set-user-ID and the saved set-group-ID

[APUE03] With "lseek" call, which one of the following statements is NOT correct? lseek only records the current file offset within the kernel lseek does not cause any I/O to take place. The current file offset after the lseek call can be then used by the next read or write operation. The file's offset can be greater than the file's current size, in which case the next write to the file will extend the file. 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.

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] 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); The new file descriptor returned by dup is guaranteed to be the lowest-numbered available file descriptor. With dup2, one specifies the value of the new descriptor with the fd2 argument. With dup2, if fd2 is already open, it is first closed. With dup2, if fd2 is already open, it will generate FD_CLOEXEC to close the file and then open it. With dup2, if fd equals fd2, then dup2 returns fd2 without closing it.

With dup2, if fd2 is already open, it will generate FD_CLOEXEC to close the file and then open it.

[APUE01] Which of the following statements is not correct? All operating systems provide service points through which programs request services from the kernel. All implementations of the UNIX System provide a well-defined, limited number of entry points directly into the kernel called system calls. Version 7 of the Research UNIX System provided about 50 system calls, 4.4BSD provided about 110, and SVR4 had around 120. More recent systems have seen incredible growth in the number of supported system calls. Linux 3.2.0 has 380 system calls and FreeBSD 8.0 has over 450. The system call interface has always been documented in Section 2 of the UNIX Programmer's Manual. The definition of each system call is in the C language, no matter which implementation technique is actually used on any given system to invoke a system call. With many recent operating systems, the kernel entry points are defined in the Java language.

With many recent operating systems, the kernel entry points are defined in the Java language.

[Process2] The new file descriptor returned by dup is guaranteed to be the ___ numbered available file descriptor lowest highest fixed stack arbitrary

lowest

[APUE01] The ___ character terminates a pathname. escape back-slash slash null special

null

[APUE01] The only two characters that cannot appear in a filename are the slash character (/) and the ___ character. escape back-slash slash null special

null

[APUE01] Which one of the following is not a primary function for process control? exec fork waitpid pthread

pthread

[APUE01] The ___ character separates the filenames that form a pathname. escape back-slash slash null special

slash

[Process2] ___ is a type of file that points to another file. symbolic link directory file FIFO pipe dupe

symbolic link

[APUE01] In Unix, The interface to the kernel is a layer of software called the ____ calls. Library System Utility Driver Service

system

[APUE04] On contemporary systems, the use of ___ has been extended. The Single UNIX Specification allows this bit to be set for a directory. If this is set for a directory, a file in the directory can be removed or renamed only if the user has write permission for the directory and meets one of the following criteria: (a) Owns the file, (b) Owns the directory, and (c) Is the superuser. the directory access bit the user write bit the user execute bit the sticky bit the special bit

the sticky bit

[APUE04] The directories /tmp and /var/tmp are typical candidates for ___. These are directories in which any user can typically create files. The permissions for these two directories are often read, write, and execute for everyone (user, group, and other). But users should not be able to delete or rename files owned by others. the directory access bit the user write bit the user execute bit the sticky bit the special bit

the sticky bit


Related study sets

Adult Health I Exam 1 Practice Questions

View Set

BOP (Businessowners Policy) CH.13

View Set

Comprehensive physical assessment of an adult post test

View Set

Patho Ch. 11 - Malignant Disorders of White Blood Cells

View Set

Chapter 30: Lung cancer and other noninfectious lower resp

View Set