Week 7 Quiz 2

Description

2 Computer Science Quiz on Week 7 Quiz 2, created by James Herd on 17/10/2018.
James Herd
Quiz by James Herd, updated more than 1 year ago
James Herd
Created by James Herd over 5 years ago
49
2

Resource summary

Question 1

Question
[APUE04] Which one of the following statements is not correct? Consider the file and/or directory access, and chmod command.
Answer
  • 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.

Question 2

Question
[APUE04] Which one of the following statements is NOT correct? Consider the following commands. $ ln -s /no/such/file myfile $ ls myfile myfile $ cat myfile cat: myfile: No such file or directory $ ls -l myfile lrwxrwxrwx 1 sar 13 Jan 22 00:26 myfile -> /no/such/file
Answer
  • 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.

Question 3

Question
[APUE04] Which one of the following statements is NOT correct? Consider umask command.
Answer
  • 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).
  • 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.

Question 4

Question
[APUE04] Which one of the following statements is not correct?
Answer
  • Given a pathname, the function nstat obtains the information about the named file.
  • 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 fstatat function provides a way to return the file statistics for a pathname relative to an open directory represented by the fd argument.

Question 5

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

Question 6

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

Question 7

Question
[APUE04] Which one of the following statements is NOT correct?
Answer
  • Any user can create a hard or symbolic link to a directory.
  • There are two types of links: hard link and symbolic link.
  • 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.

Question 8

Question
[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.
Answer
  • the sticky bit
  • the directory access bit
  • the user write bit
  • the user execute bit
  • the special bit

Question 9

Question
[APUE04] Which one of the following statements is not correct? Consider umask.
Answer
  • To ensure that anyone can read a file, we should set the umask to 0777.
  • 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.
  • The umask value that is in effect when our process is running can cause permission bits to be turned off.

Question 10

Question
[APUE04] Which one of the following statements is NOT correct? Consider the file and/or directory access.
Answer
  • To delete an existing file, we need only the write permission for the file itself.
  • 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.
  • 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.

Question 11

Question
[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.
Answer
  • the sticky bit
  • the directory access bit
  • the user write bit
  • the user execute bit
  • the special bit

Question 12

Question
[APUE04] Which one of the following statements is NOT correct?
Answer
  • In all modern systems, chown does not follow symbolic links.
  • 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.
  • There are no file system limitations on a symbolic link and what it points to.
  • Anyone can create a symbolic link to a directory.

Question 13

Question
[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:
Answer
  • 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 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 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.

Question 14

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

Question 15

Question
[APUE04] Which one of the following statements is NOT correct?
Answer
  • The function which removes a directory entry is always called "delete."
  • Using mkdir command, a directory ("testdir") has been just created under a directory. This will create two new links: one link pointing to "dot" directory entry and the other for "dot-dot" directory entry.
  • Every i-node has a link count that contains the number of directory entries that point to it.
  • Only when the link count of i-node goes to 0 can the file be deleted, thereby releasing the data blocks associated with the file.
  • The operation of "unlinking a file" does not always mean "deleting the blocks associated with the file."

Question 16

Question
[APUE04] Which one of the following statements is NOT correct? Consider umask bits.
Answer
  • The umask value 0700 is to allow the user (owner) to read, write, or execute the files
  • 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.

Question 17

Question
[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.
Answer
  • 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

Question 18

Question
[APUE04] Which one of the following statements is NOT correct? Consider the file and/or directory access, and chmod command.
Answer
  • Read permission lets us read the directory, obtaining and searching through a list of all the filenames in the directory.
  • 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.
  • 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.

Question 19

Question
[APUE04] Every process has six or more IDs associated with it. This ____ determines one's file access permissions.
Answer
  • The effective user ID and the effective group ID
  • The real user ID and the real 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

Question 20

Question
[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.
Answer
  • 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.
Show full summary Hide full summary

Similar

Computing Hardware - CPU and Memory
ollietablet123
SFDC App Builder 2
Parker Webb-Mitchell
Data Types
Jacob Sedore
Intake7 BIM L1
Stanley Chia
Software Processes
Nurul Aiman Abdu
Design Patterns
Erica Solum
CCNA Answers – CCNA Exam
Abdul Demir
Abstraction
Shannon Anderson-Rush
Spyware
Sam2
HTTPS explained with Carrier Pigeons
Shannon Anderson-Rush
Data Analytics
anelvr