UNIX Question and Answer – Permissions and Ownership
UNIX MCQ – Multiple Choice Questions for exam, interview, and Entrance Test
1. What command is used to change file permissions in UNIX?
a) chmod
b) chown
c) chgrp
d) perm
Answer: a) chmod
Explanation: The chmod command is used to change file permissions in UNIX.
2. In UNIX file permissions, what does “r” represent?
a) Read
b) Write
c) Execute
d) Rename
Answer: a) Read
Explanation: The “r” permission allows reading the contents of a file in UNIX.
3. Which command is used to change the owner of a file in UNIX?
a) chown
b) chmod
c) chgrp
d) own
Answer: a) chown
Explanation: The chown command is used to change the owner of a file in UNIX.
4. In UNIX file permissions, what does “w” represent?
a) Read
b) Write
c) Execute
d) Rename
Answer: b) Write
Explanation: The “w” permission allows writing to a file in UNIX.
5. What command is used to change the group ownership of a file in UNIX?
a) chown
b) chmod
c) chgrp
d) own
Answer: c) chgrp
Explanation: The chgrp command is used to change the group ownership of a file in UNIX.
6. In UNIX file permissions, what does “x” represent?
a) Read
b) Write
c) Execute
d) Rename
Answer: c) Execute
Explanation: The “x” permission allows executing a file in UNIX.
7. Which command is used to grant read, write, and execute permissions to the owner of a file in UNIX?
a) chmod u+rwx
b) chmod o+rwx
c) chmod g+rwx
d) chmod a+rwx
Answer: a) chmod u+rwx
Explanation: The chmod u+rwx command grants read, write, and execute permissions to the owner of a file in UNIX.
8. In UNIX, what does the command “chmod 755 file.txt” do?
a) Grants full permissions to the owner and read-only permissions to the group and others
b) Grants full permissions to the owner and the group, and read-only permissions to others
c) Grants full permissions to the owner, read and execute permissions to the group, and read-only permissions to others
d) Grants full permissions to the owner, read-only permissions to the group, and no permissions to others
Answer: c) Grants full permissions to the owner, read and execute permissions to the group, and read-only permissions to others
Explanation: In the command “chmod 755 file.txt,” the owner gets full permissions, the group gets read and execute permissions, and others get read-only permissions.
9. What command is used to remove read permission for the owner of a file in UNIX?
a) chmod u-r
b) chmod g-r
c) chmod o-r
d) chmod a-r
Answer: a) chmod u-r
Explanation: The chmod u-r command removes read permission for the owner of a file in UNIX.
10. In UNIX, what does the command “chmod 644 file.txt” do?
a) Grants full permissions to the owner and the group, and read-only permissions to others
b) Grants read and write permissions to the owner, and read-only permissions to the group and others
c) Grants full permissions to the owner, read-only permissions to the group, and no permissions to others
d) Grants read and write permissions to the owner, and read-only permissions to the group
Answer: b) Grants read and write permissions to the owner, and read-only permissions to the group and others
Explanation: In the command “chmod 644 file.txt,” the owner gets read and write permissions, while the group and others get read-only permissions.
11. Which command is used to remove execute permission for the group of a file in UNIX?
a) chmod g-x
b) chmod u-x
c) chmod o-x
d) chmod a-x
Answer: a) chmod g-x
Explanation: The chmod g-x command removes execute permission for the group of a file in UNIX.
12. What is the octal representation for granting read, write, and execute permissions to the owner, and read-only permissions to the group and others in UNIX?
a) 777
b) 755
c) 644
d) 666
Answer: b) 755
Explanation: The octal representation for granting read, write, and execute permissions to the owner, and read-only permissions to the group and others is 755 in UNIX.
13. Which command is used to grant read and write permissions to the owner and the group, and no permissions to others in UNIX?
a) chmod 660
b) chmod 664
c) chmod 600
d) chmod 640
Answer: a) chmod 660
Explanation: The chmod 660 command grants read and write permissions to the owner and the group, and no permissions to others in UNIX.
14. What is the octal representation for granting read and execute permissions to the owner and the group, and no permissions to others in UNIX?
a) 755
b) 750
c) 700
d) 711
Answer: b) 750
Explanation: The octal representation for granting read and execute permissions to the owner and the group, and no permissions to others is 750 in UNIX.
15. Which command is used to change the group ownership of a file in UNIX?
a) chown
b) chgrp
c) chmod
d) grpown
Answer: b) chgrp
Explanation: The chgrp command is used to change the group ownership of a file in UNIX.
16. What command is used to grant read and execute permissions to the owner and the group, and read-only permissions to others in UNIX?
a) chmod 744
b) chmod 755
c) chmod 766
d) chmod 777
Answer: b) chmod 755
Explanation: The chmod 755 command grants read and execute permissions to the owner and the group, and read-only permissions to others in UNIX.
17. In UNIX, what does the command “chmod 600 file.txt” do?
a) Grants full permissions to the owner and no permissions to the group and others
b) Grants read and write permissions to the owner and no permissions to the group and others
c) Grants full permissions to the owner, read-only permissions to the group, and no permissions to others
d) Grants read and write permissions to the owner, and no permissions to the group and others
Answer: d) Grants read and write permissions to the owner, and no permissions to the group and others
Explanation: In the command “chmod 600 file.txt,” the owner gets read and write permissions, while the group and others get no permissions.
18. Which command is used to change the owner and group of a file simultaneously in UNIX?
a) chown
b) chgrp
c) chowngrp
d) chuser
Answer: a) chown
Explanation: The chown command is used to change the owner and group of a file simultaneously in UNIX.
19. What is the octal representation for granting full permissions to the owner, read-only permissions to the group, and no permissions to others in UNIX?
a) 755
b) 644
c) 600
d) 700
Answer: c) 600
Explanation: The octal representation for granting full permissions to the owner, read-only permissions to the group, and no permissions to others is 600 in UNIX.
20. Which command is used to revoke all permissions for a file in UNIX?
a) chmod 000
b) chmod 111
c) chmod 777
d) chmod 666
Answer: a) chmod 000
Explanation: The chmod 000 command revokes all permissions for a file in UNIX.
21. In UNIX, what does the command “chmod 751 file.txt” do?
a) Grants read and execute permissions to the owner and the group, and no permissions to others
b) Grants read and write permissions to the owner, and execute permissions to the group and others
c) Grants read and execute permissions to the owner, and write permissions to the group and others
d) Grants read, write, and execute permissions to the owner, read-only permissions to the group, and no permissions to others
Answer: a) Grants read and execute permissions to the owner and the group, and no permissions to others
Explanation: In the command “chmod 751 file.txt,” the owner gets read and execute permissions, the group gets execute permissions, and others get no permissions.
22. Which command is used to grant read and write permissions to the owner and the group, and execute permissions to others in UNIX?
a) chmod 771
b) chmod 761
c) chmod 751
d) chmod 711
Answer: c) chmod 751
Explanation: The chmod 751 command grants read and write permissions to the owner and the group, and execute permissions to others in UNIX.
23. What is the octal representation for granting read and write permissions to the owner and the group, and no permissions to others in UNIX?
a) 666
b) 644
c) 600
d) 622
Answer: c) 600
Explanation: The octal representation for granting read and write permissions to the owner and the group, and no permissions to others is 600 in UNIX.
24. Which command is used to grant execute permissions for the owner and the group, and read-only permissions to others in UNIX?
a) chmod 744
b) chmod 755
c) chmod 751
d) chmod 711
Answer: c) chmod 751
Explanation: The chmod 751 command grants execute permissions for the owner and the group, and read-only permissions to others in UNIX.
25. In UNIX, what does the command “chmod 644 file.txt” do?
a) Grants full permissions to the owner and read-only permissions to the group and others
b) Grants read and write permissions to the owner and read-only permissions to the group and others
c) Grants full permissions to the owner and the group, and no permissions to others
d) Grants read and write permissions to the owner and the group, and no permissions to others
Answer: b) Grants read and write permissions to the owner and read-only permissions to the group and others
Explanation: In the command “chmod 644 file.txt,” the owner gets read and write permissions, while the group and others get read-only permissions.
26. What command is used to set the sticky bit on a directory in UNIX?
a) chmod +s
b) chmod +t
c) chmod +x
d) chmod +w
Answer: b) chmod +t
Explanation: The chmod +t command is used to set the sticky bit on a directory in UNIX.
27. In UNIX, what does the sticky bit on a directory signify?
a) Only the owner can read the contents
b) Only the owner can write to the directory
c) Only the owner can delete or rename files within the directory
d) Only the owner can execute files within the directory
Answer: c) Only the owner can delete or rename files within the directory
Explanation: When the sticky bit is set on a directory, only the owner of a file within that directory can delete or rename the file.
28. Which command is used to remove the setuid permission from a file in UNIX?
a) chmod -s
b) chmod -u
c) chmod -x
d) chmod -t
Answer: a) chmod -s
Explanation: The chmod -s command is used to remove the setuid permission from a file in UNIX.
29. In UNIX, what does the setgid permission on a directory do?
a) Allows users to execute files within the directory with the permissions of the group
b) Forces newly created files in the directory to inherit the group of the directory
c) Allows users to read files within the directory with the permissions of the group
d) Prevents users from deleting files within the directory
Answer: b) Forces newly created files in the directory to inherit the group of the directory
Explanation: When the setgid permission is set on a directory, newly created files within that directory inherit the group of the directory.
30. Which command is used to set the setuid permission on a file in UNIX?
a) chmod +u
b) chmod +s
c) chmod +x
d) chmod +t
Answer: b) chmod +s
Explanation: The chmod +s command is used to set the setuid permission on a file in UNIX.
31. In UNIX, what does the setuid permission on a file do?
a) Allows users to execute the file with the permissions of the owner
b) Allows users to read the file with the permissions of the owner
c) Forces newly created files to inherit the permissions of the owner
d) Prevents users from modifying the file
Answer: a) Allows users to execute the file with the permissions of the owner
Explanation: When the setuid permission is set on a file, users can execute the file with the permissions of the owner.
32. Which command is used to set the setgid permission on a directory in UNIX?
a) chmod +s
b) chmod +t
c) chmod +g
d) chmod +S
Answer: a) chmod +s
Explanation: The chmod +s command is used to set the setgid permission on a directory in UNIX.
33. In UNIX, what does the setgid permission on a file do?
a) Allows users to execute the file with the permissions of the group
b) Forces newly created files to inherit the group of the directory
c) Allows users to read the file with the permissions of the group
d) Prevents users from modifying the file
Answer: a) Allows users to execute the file with the permissions of the group
Explanation: When the setgid permission is set on a file, users can execute the file with the permissions of the group.
34. Which command is used to remove the setgid permission from a directory in UNIX?
a) chmod -s
b) chmod -g
c) chmod -t
d) chmod -S
Answer: a) chmod -s
Explanation: The chmod -s command is used to remove the setgid permission from a directory in UNIX.
35. In UNIX, what does the setuid permission on a directory do?
a) Allows users to execute files within the directory with the permissions of the owner
b) Forces newly created files in the directory to inherit the owner’s permissions
c) Allows users to read files within the directory with the permissions of the owner
d) Prevents users from deleting files within the directory
Answer: d) Prevents users from deleting files within the directory
Explanation: When the setuid permission is set on a directory, it prevents users from deleting files within that directory.
36. Which command is used to display detailed file permission information in UNIX?
a) ls -l
b) ls -a
c) ls -r
d) ls -p
Answer: a) ls -l
Explanation: The ls -l command is used to display detailed file permission information, including ownership and permissions, in UNIX.
37. In UNIX file permissions, what does the “t” attribute on a directory represent?
a) Setuid permission
b) Setgid permission
c) Sticky bit
d) Execution permission
Answer: c) Sticky bit
Explanation: The “t” attribute on a directory in UNIX represents the sticky bit.
38. Which command is used to set the sticky bit on a file in UNIX?
a) chmod +t
b) chmod +s
c) chmod +x
d) chmod +w
Answer: b) chmod +s
Explanation: The chmod +s command is used to set the sticky bit on a file in UNIX.
39. In UNIX, what does the sticky bit on a file signify?
a) Only the owner can read the contents
b) Only the owner can write to the file
c) Only the owner can delete or rename the file
d) Only the owner can execute the file
Answer: c) Only the owner can delete or rename the file
Explanation: When the sticky bit is set on a file in UNIX, only the owner can delete or rename the file.
40. Which command is used to remove the sticky bit from a directory in UNIX?
a) chmod -t
b) chmod -s
c) chmod -x
d) chmod -w
Answer: a) chmod -t
Explanation: The chmod -t command is used to remove the sticky bit from a directory in UNIX.
41. In UNIX file permissions, what does the “s” attribute on a file represent?
a) Setuid permission
b) Setgid permission
c) Sticky bit
d) Execution permission
Answer: a) Setuid permission
Explanation: The “s” attribute on a file in UNIX represents the setuid permission.
42. Which command is used to remove the setgid permission from a file in UNIX?
a) chmod -s
b) chmod -g
c) chmod -x
d) chmod -t
Answer: a) chmod -s
Explanation: The chmod -s command is used to remove the setgid permission from a file in UNIX.
43. In UNIX, what does the setgid permission on a directory signify?
a) Only the owner can read files within the directory
b) Newly created files within the directory inherit the group of the directory
c) Only the owner can delete or rename files within the directory
d) Only the owner can execute files within the directory
Answer: b) Newly created files within the directory inherit the group of the directory
Explanation: When the setgid permission is set on a directory, newly created files within that directory inherit the group of the directory.
44. Which command is used to set the setuid permission on a directory in UNIX?
a) chmod +s
b) chmod +t
c) chmod +u
d) chmod +g
Answer: a) chmod +s
Explanation: The chmod +s command is used to set the setuid permission on a directory in UNIX.
45. In UNIX file permissions, what does the “S” attribute on a directory represent?
a) Setuid permission
b) Setgid permission
c) Sticky bit
d) Execution permission
Answer: b) Setgid permission
Explanation: The “S” attribute on a directory in UNIX represents the setgid permission.
46. Which command is used to remove the sticky bit from a file in UNIX?
a) chmod -t
b) chmod -s
c) chmod -x
d) chmod -w
Answer: b) chmod -s
Explanation: The chmod -s command is used to remove the sticky bit from a file in UNIX.
47. In UNIX file permissions, what does the “s” attribute on both user and group execute permissions represent?
a) Setuid permission
b) Setgid permission
c) Sticky bit
d) Execution permission
Answer: c) Sticky bit
Explanation: The “s” attribute on both user and group execute permissions in UNIX represents the sticky bit.
48. Which command is used to remove the setuid and setgid permissions from a file simultaneously in UNIX?
a) chmod -s
b) chmod -u
c) chmod -x
d) chmod -t
Answer: a) chmod -s
Explanation: The chmod -s command is used to remove the setuid and setgid permissions from a file simultaneously in UNIX.
49. In UNIX, what does the setuid permission on both user and group execute permissions signify?
a) Only the owner can execute the file
b) Users can execute the file with the permissions of the owner
c) Users can execute the file with the permissions of the group
d) Only the owner can delete or rename the file
Answer: b) Users can execute the file with the permissions of the owner
Explanation: When the setuid permission is set on both user and group execute permissions, users can execute the file with the permissions of the owner.
50. Which command is used to set the setgid permission on both user and group execute permissions in UNIX?
a) chmod +s
b) chmod +t
c) chmod +x
d) chmod +w
Answer: a) chmod +s
Explanation: The chmod +s command is used to set the setgid permission on both user and group execute permissions in UNIX.