This set of Unix Multiple Choice Questions & Answers (MCQs) focuses on “Listing File and Directory Attributes”.
1. An attribute is a specification of an object that defines its property.
a) True
b) False
View Answer
Explanation: An attribute defines the property of an object. In UNIX, every file has a set of attributes which defines the specification of the file.
2. Which command is used to list the attributes of a file?
a) cp
b) list
c) ls
d) attr
View Answer
Explanation: ls command is used for listing the attributes of a file or directory. ls command when used with -l displays all the seven attributes of a file.
3. Which one of the following is not an attribute displayed by ls command?
a) file permissions
b) file ownership
c) links
d) word count of file
View Answer
Explanation: When -l option is used with ls command it simply displays seven attributes of a file which are file type and permissions, links, ownership, group ownership, file size, last modification time, filename.
4. What are links referred to as in file attributes?
a) number of filenames of a single file that are maintained by the system
b) number of duplicates of a single file
c) number of copies of a single file
d) number of files present in a directory
View Answer
Explanation: Links are defined as the number of filenames of a single file that are maintained by the system. This file can be accessed through as many filenames as there is a number of links to that file.
5. In how many categories are links divided?
a) 1
b) 2
c) 4
d) 0
View Answer
Explanation: There are basically two types of links; hard link and soft links.
6. Hard linked files are provided with the same inode number as the original one.
a) True
b) False
View Answer
Explanation: Hard linked files are provided with the same inode number as the original file so they refer to the same physical location of the file.
7. Soft linked files are provided with different inode number as the original one.
a) True
b) False
View Answer
Explanation: Soft linked files are provided with a separate inode number each of which points to the original file location.
8. Which option is used with ls command to list the directory attributes rather than its contents?
a) -b
b) -a
c) -l
d) -d
View Answer
Explanation: ls command when combined with -d option displays the attributes of a directory rather than its contents.
$ ls -ld dir01
9. File attributes are of major concern as compared to directory attributes while performing operations on file system.
a) True
b) False
View Answer
Explanation: Directory attributes are of major concern as compared to file attributes when performing any operation on file system because files are a part of directory or we can say that files are stored under the directory in the directory tree. So if directory attributes does not allow us to perform a particular operation on the directory than that operation can never be performed on the file which is stored inside that directory.
10. A file contains 1026 bytes. How many bytes of disk space will it consume if size of a disk block is 1024 bytes?
a) 1026
b) 1024
c) 2048
d) 4096
View Answer
Explanation: Sine files are written to the disk in terms of block size, the size consumed by the file vary from the original size of the file. Suppose, if a file size is 800 bytes but the block size on the system is 1024 bytes, then that file will consume 1024 bytes on diskspace i.e. 1 block.
Sanfoundry Global Education & Learning Series – Unix.
To practice all areas of Unix, here is complete set of 1000+ Multiple Choice Questions and Answers.
If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]
- Practice Computer Science MCQs
- Check Computer Science Books
- Check MCA Books
- Check Unix Books
- Practice MCA MCQs