Unit 2 - Practice Quiz
CSC202
1 Which command is used to change the permissions of a file or directory in Linux?
chown
chmod
chgrp
umask
2
In the permission string drwxr-xr-x, what does the first character d represent?
3
What is the octal representation of the permission rwxr-x---?
4 Which command allows you to change the owner of a file?
chmod
passwd
chown
groupadd
5
If the umask value is set to 022, what will be the default permissions for a newly created directory?
6 Which command is used to view the Access Control Lists (ACLs) of a file?
ls -l
getfacl
setfacl
chmod
7 What does the Sticky Bit do when applied to a directory?
8 Which numeric value represents the Read permission?
9
Which symbol indicates that a file has an Access Control List (ACL) set when viewing permissions via ls -l?
10 Which command allows you to modify the Access Control List (ACL) of a file?
modacl
changeacl
getfacl
setfacl
11 What is the purpose of the SUID (Set User ID) bit on an executable file?
12 How is the SGID (Set Group ID) permission represented in the symbolic mode when set on a directory?
s in the user execute position.
s in the group execute position.
t in the other execute position.
g in the group read position.
13
Which command would you use to recursively change the owner of a directory and all its contents to user webadmin?
chown -r webadmin directory
chown -R webadmin directory
chmod -R webadmin directory
chgrp -r webadmin directory
14 According to the Filesystem Hierarchy Standard (FHS), which directory contains system-wide configuration files?
/bin
/dev
/etc
/usr
15 Which directory is strictly used for variable data files such as logs and spool files?
/tmp
/var
/proc
/opt
16
What is the result of the command chmod u+x script.sh?
17
Which command creates a symbolic (soft) link named linkname pointing to targetfile?
ln targetfile linkname
ln -s targetfile linkname
link targetfile linkname
cp -l targetfile linkname
18 What happens if you delete the source file of a hard link?
19 Which command is used to remove a directory that is not empty?
rmdir directory
rm directory
rm -r directory
del directory
20 Which command is used to update the access and modification timestamps of a file, or create it if it doesn't exist?
cat
touch
nano
mkfile
21 Which command helps determine the file type of a file based on its content (magic numbers), rather than its extension?
ls
type
file
stat
22 Which directory typically contains device files representing hardware components?
/mnt
/dev
/proc
/sys
23
Which find command syntax searches for files named 'report.txt' in the current directory and subdirectories?
find . -name report.txt
locate report.txt
find report.txt
search -f report.txt
24
Which command is significantly faster than find because it searches a pre-built database?
grep
which
locate
whereis
25
What is the purpose of the which command?
$PATH.
26
In the vi or vim editor, which key acts as a toggle to switch from Insert mode back to Command mode?
27
Which command combination in vi saves the file and quits the editor?
:q!
:w
:wq
:exit
28 Which command prints the last 10 lines of a file to standard output?
head
tail
cat
less
29 Which command is used to search for a specific text pattern within a file?
find
grep
locate
sed
30
What does the wc -l command do?
31 How do you specify a Set Group ID (SGID) bit using octal mode for a directory permission of 755?
chmod 1755 directory
chmod 2755 directory
chmod 4755 directory
chmod 0755 directory
32
Which command is used to create a new directory, including parent directories if they do not exist (e.g., mkdir -p /a/b/c)?
mkdir -r
mkdir -p
mkdir -f
touch -d
33
What does the command cp -a source dest do?
34 In the Linux file system, what is the top-level directory called?
35 Which command lets you view the contents of a large text file one page/screen at a time, allowing backward navigation?
cat
head
more
less
36 Which command will sort the contents of a text file alphabetically?
order
sort
arrange
grep
37
When using ls -l, a file permission of rw-rw-rw- implies:
38 Which character represents the user's home directory in a shell path?
.
..
~
/
39
What does the command chmod g-w file.txt do?
40 Which directory contains the Linux kernel and boot loader files?
/sys
/boot
/root
/kern
41
To force vi to quit without saving changes, which command is used?
:q
:q!
:w!
:x
42
What is the purpose of the /proc directory?
43
Which find command option allows you to execute a command on every file found?
-run
-exec
-do
-action
44
What is the result of the umask command without arguments?
45 Which command moves a file from one location to another or renames it?
mv
cp
rn
rm
46
How do you allow a specific user, john, read and write access to file.txt using ACLs without changing the file's group owner?
chmod u+rw file.txt
chown john file.txt
setfacl -m u:john:rw file.txt
setfacl -x u:john file.txt
47
What is the function of the head -n 5 filename command?
48
When listing files with ls -la, the entries . and .. represent:
49
Which permission bit prevents a standard user from executing a directory (i.e., cd into it)?
50
What is the binary representation of the permission set r-x?