This set of Unix Multiple Choice Questions & Answers (MCQs) focuses on “Changing File Ownership and Permissions – 1”.
1. Which command is used to change the permissions of a file?
a) chmod
b) ch
c) chown
d) chgrp
View Answer
Explanation: The chmod (change mode) command is used to change the permissions of files. This command can only be run by the owner of the file or by the super user.
2. chmod command can take multiple filenames as arguments.
a) True
b) False
View Answer
Explanation: We can change permissions of multiple files by using chmod command once. To change permissions of multiple files simultaneously just use the chmod command with multiple filenames as arguments.
3. chmod command can be used in ____ ways.
a) 3
b) 2
c) 5
d) 0
View Answer
Explanation: chmod command can be used in two manners i.e. relative (changes are specified to the current permissions) and absolute (final permissions are specified).
4. The expression used with chmod command to change permissions in a relative manner contains ____ components.
a) 5
b) 2
c) 4
d) 3
View Answer
Explanation: chmod command takes an expression as its arguments which comprises of some letters and symbols. The expression comprises three components:-
-> User category (user, group, others)
-> The operation to be performed (assign or remove a permission)
-> Type of permission (read, write, execute).
5. Which of the following characters specify the user and group category?
a) ‘u’ and ‘g’
b) ‘g’ and ‘o’
c) ‘us’ and ‘gr’
d) ‘u’ and ‘o’
View Answer
Explanation: Each character specifies a particular category of users as follows:
‘u’ stands for a user,
‘g’ for ‘group’
‘o’ for ‘others’.
6. Which of the following symbol is used with chmod to assign permission to a file?
a) –
b) /
c) +
d) *
View Answer
Explanation: To assign and remove permissions from a file, (+) and (-) symbols are used respectively.
‘+’ symbol will assign a permission
‘-‘ symbol will remove a permission
7. To assign execute permission to the user (owner) for a file named file01.txt, which of the following command will be used?
a) chmod u+r file01.txt
b) chmod u+w file01.txt
c) chmod u-x file01.txt
d) chmod u+x file01.txt
View Answer
Explanation: To assign execute permission to the user, above command is stated as follows:
u - for specifying the category of user. + - for assigning permission. x - to specify execute permission.
8. What does the following command do?
$ chmod ugo +w file01.txt
a) assign write permission to users, group and others
b) assign write permission to the user (owner) only
c) assign write permission to group and others
d) command not executable
View Answer
Explanation: The string ugo combines all the three categories –user, group and others while (+) is used to assign the permission. ‘w’ specifies the write operation.
9. Which character is used to replace ‘ugo’ string in chmod command?
a) a
b) v
c) x
d) o
View Answer
Explanation: UNIX offers a shorthand symbol ‘a’ (all) that acts as a synonym for the ‘ugo’ string which represents all the categories of users.
$ chmod a+w file01 // assign write permission to user, group and others.
10. To remove write permission from group and others, which one of the following commands will be used?
a) chmod go+w file01
b) chmod go-w file01
c) chmod ug-w file01
d) chmod a-w file01
View Answer
Explanation: To remove a certain permission from a category of users we use (-) symbol. So above command will remove write permission from group and others.
Sanfoundry Global Education & Learning Series – Unix.
To practice all areas of Unix, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Check MCA Books
- Check Computer Science Books
- Apply for Computer Science Internship
- Check Unix Books
- Practice MCA MCQs