The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Select all the ways you can cd into test1 , a sub-directory of user1's home directory, /home/user1, given the command promt listed below (SELECT ALL THAT APPLY)
user1@localhost: /bin$
A.
Cd ./test1
B.
Cd ../test1
C.
Cd ../../test1
D.
Cd ~/test1
E.
Cd /home/user1/test1
Correct Answer
D. Cd ~/test1
Explanation The correct answer is selecting "cd ~/test1" because the "~" character is a shorthand representation for the user's home directory. So, "cd ~/test1" will take the user to the test1 sub-directory of user1's home directory.
Rate this question:
2.
Which linux command line copies directories dir1, dir2, to dir3 (dir1,dir2 and dir3 are all located in the current working directory)?
A.
Cp dir1 dir2 dir3
B.
Cp -r dir1 dir2 dir3
C.
Cp --parent dir1 dir2 dir3
D.
Cp -p dir1 dir2 dir3
E.
None of the above
Correct Answer
B. Cp -r dir1 dir2 dir3
Explanation The correct answer is "cp -r dir1 dir2 dir3". The "-r" option is used to copy directories recursively, meaning it copies all files and subdirectories within the specified directories. Therefore, this command will copy dir1, dir2, and their contents into dir3.
Rate this question:
3.
Identify the root user accounts home directory in Linux
A.
/
B.
/root/home
C.
/home/root
D.
/root
E.
None of the above
Correct Answer
D. /root
Explanation The correct answer is /root. In Linux, the root user is the superuser with administrative privileges. The root user's home directory is typically located at /root. This directory serves as the root user's default working directory and contains their personal configuration files and data.
Rate this question:
4.
Identify the Linux command that renames a file named oldfile to newfile in current working directory.
A.
Cp oldfile newfile
B.
Ren oldfile newfile
C.
Mv oldfile newfile
D.
Touch oldfile newfile
E.
None of the above
Correct Answer
C. Mv oldfile newfile
Explanation The correct answer is "mv oldfile newfile". The "mv" command in Linux is used to move or rename files and directories. In this case, the command renames the file "oldfile" to "newfile" in the current working directory.
Rate this question:
5.
Which of the following Linux commands prevents you from accidentally overwriting a file when you redirect output to a file?
A.
Echo $PATH
B.
Set +C
C.
Umask
D.
Set -noclobber
E.
None of the above
Correct Answer
D. Set -noclobber
Explanation The correct answer is "set -noclobber". This command prevents you from accidentally overwriting a file when you redirect output to a file. By using this command, if the file already exists, it will not be overwritten and an error message will be displayed instead.
Rate this question:
6.
The Linux command that allows for deleting a directory, but only if it is empty_____________.
A.
Mv
B.
Del
C.
Rm
D.
Rmdir
E.
None of the above
Correct Answer
D. Rmdir
Explanation The Linux command "rmdir" is used to delete a directory, but it can only delete a directory if it is empty. If the directory contains any files or subdirectories, the "rmdir" command will not work and will display an error message. Therefore, "rmdir" is the correct answer for this question.
Rate this question:
7.
What command can you use to remove a directory with files in it in Linux.
A.
Rm
B.
Rm -r
C.
Rmdir
D.
Rmdir -p
E.
None of the above
Correct Answer
B. Rm -r
Explanation The correct answer is "rm -r" because the "rm" command is used to remove files and directories in Linux, and the "-r" option is used to remove directories and their contents recursively. Therefore, "rm -r" is the command that can be used to remove a directory with files in it in Linux.
Rate this question:
8.
To immediately shutdown and halt a Linux machien from command line, you should:
A.
Log in as root and type: shutdown -h now
B.
Log in as root and type: shutdown -r now
C.
Log in as root and type: stop linux -1
D.
Turn power off and walk away
E.
None of the above
Correct Answer
A. Log in as root and type: shutdown -h now
Explanation The correct answer is to log in as root and type "shutdown -h now". This command is used to shut down the Linux machine immediately. The "-h" option stands for halt, which means to power off the system after shutting down all processes. The "now" parameter indicates that the shutdown should happen immediately. By logging in as root, the user has the necessary permissions to execute this command.
Rate this question:
9.
Identify the environment variable that defines primary prompt.
A.
PS1
B.
PS2
C.
SHELL
D.
HOME
E.
None of the above
Correct Answer
A. PS1
Explanation The correct answer is PS1. PS1 is an environment variable that defines the primary prompt in Unix-like operating systems. It allows users to customize the appearance of their command prompt by setting various parameters such as colors, display of username, hostname, current working directory, and more. By modifying the value of PS1, users can create personalized and informative prompts that suit their preferences and needs.
Rate this question:
10.
The command that displays the name of current shell is ____________________.
A.
Echo $SHELL
B.
Cat /etc/shells
C.
Uname -r
D.
Cat /etc/fstab
E.
None of the above
Correct Answer
A. Echo $SHELL
Explanation The correct answer is "echo $SHELL" because the "echo" command is used to display the value of a variable, and "$SHELL" is a special variable that holds the name of the current shell being used. By executing this command, the name of the current shell will be printed on the console.
Rate this question:
11.
Which of the following would not place you in your home directory?
A.
Cd
B.
Cd ~
C.
Cd ~/username
D.
Cd /home/username
E.
None of the above
Correct Answer
C. Cd ~/username
Explanation The command "cd ~/username" would not place you in your home directory. The "~" symbol represents the home directory, so "cd ~" would take you to your home directory. However, appending "/username" to it would take you to a subdirectory named "username" within your home directory, not the home directory itself. Therefore, this command would not place you in your home directory.
Rate this question:
12.
Identify the linux command used to display the inode number of /etc/fstab
A.
Ls /etc/stab
B.
Ls -l /etc/fstab
C.
Ls -a /etc/fstab
D.
Ls -i /etc/fstab
E.
None of the above
Correct Answer
D. Ls -i /etc/fstab
Explanation The correct answer is "ls -i /etc/fstab". The "-i" option is used with the "ls" command to display the inode number of a file or directory. In this case, it is used to display the inode number of the file "/etc/fstab".
Rate this question:
13.
What happens when you type the following command line at the given command prompt: user1@localhost : ~$ cd .
A.
You remain in current directory
B.
You change into the parent directory
C.
You will get the error message "bash:...:unknown symbol"
D.
You will create a directory name ".."
E.
None of the above
Correct Answer
A. You remain in current directory
Explanation When you type the command "cd ." in the given command prompt, it means you are trying to change the directory to the current directory itself. Since you are already in the current directory, there is no need to change it, so you remain in the current directory.
Rate this question:
14.
Log in as root, and run the following commands:
mkdir ~/test1
cd ~/test1
mkdir -p parent/child
touch f1 f2 f3
cp f3 f4
mv f1 f2 f3 ./parent/child
cp f4 ./parent/child/f5
cd parent
cd ../../
pwd
rmdir ~/test1/parent/child
rm -r ~/test1/parent
How many regular files are left in ~/test1 after executing the above commands??
A.
0
B.
1
C.
2
D.
3
E.
None of the above
Correct Answer
B. 1
Explanation After executing the above commands, only one regular file, "f2", is left in the directory ~/test1. The other regular files "f1", "f3", "f4", and "f5" have been either moved or copied to the directory ~/test1/parent/child, or deleted using the "rm" command. Therefore, the correct answer is 1.
Rate this question:
15.
Log in as root, and run the following commands:
mkdir ~/test1
cd ~/test1
mkdir -p parent/child
touch f1 f2 f3
cp f3 f4
mv f1 f2 f3 ./parent/child
cp f4 ./parent/child/f5
cd parent
cd ../../
pwd
rmdir ~/test1/parent/child
rm -r ~/test1/parent
How many directories have been created (included deleted directories)?
A.
2
B.
3
C.
4
D.
5
E.
None of the above
Correct Answer
B. 3
Explanation The command "mkdir ~/test1" creates the directory "test1". The command "mkdir -p parent/child" creates the directories "parent" and "child" inside "test1". So, two directories have been created. The command "rmdir ~/test1/parent/child" deletes the directory "child". The command "rm -r ~/test1/parent" deletes the directory "parent". So, two directories have been deleted. Therefore, the total number of directories created (including deleted directories) is 2 + 2 = 4.
Rate this question:
16.
Log in as root, and run the following commands:
mkdir ~/test1
cd ~/test1
mkdir -p parent/child
touch f1 f2 f3
cp f3 f4
mv f1 f2 f3 ./parent/child
cp f4 ./parent/child/f5
cd parent
cd ../../
pwd
rmdir ~/test1/parent/child
rm -r ~/test1/parent
What is the output of pwd command?
A.
/
B.
/root
C.
/root/test1/parent
D.
/root/test1
E.
None of the above
Correct Answer
B. /root
Explanation The output of the "pwd" command is "/root". This is because the "cd ../.." command moves two directories up from the current directory, which is "/root/test1/parent". Therefore, the current working directory becomes "/root".
Rate this question:
17.
Log in as root, and run the following commands:
mkdir ~/test1
cd ~/test1
mkdir -p parent/child
touch f1 f2 f3
cp f3 f4
mv f1 f2 f3 ./parent/child
cp f4 ./parent/child/f5
cd parent
cd ../../
pwd
rmdir ~/test1/parent/child
rm -r ~/test1/parent
How many directories have been successfully removed?
A.
0
B.
1
C.
2
D.
3
E.
None of the above
Correct Answer
C. 2
Explanation Two directories have been successfully removed. The command "rmdir ~/test1/parent/child" removes the "child" directory, and the command "rm -r ~/test1/parent" removes the "parent" directory.
Rate this question:
18.
Which of the following are all valid basic file permissions under Linux?
A.
Read, Write, Hidden, Read Only, Execute
B.
Read, Hidden, Execute
C.
Read, System, Hidden, Archive
D.
Read, Write, Execute
E.
None of the above
Correct Answer
D. Read, Write, Execute
Explanation The correct answer is "Read, Write, Execute". These are the three basic file permissions in Linux. The "Read" permission allows a user to view the contents of a file, the "Write" permission allows a user to modify the file, and the "Execute" permission allows a user to run the file as a program.
Rate this question:
19.
What are the permissions in octal mode of the file fileone, given the file listing below:
-rwxr-x-w- 2 steven studends 12 Feb 6 10:37 fileone
A.
421401001
B.
Rwxrw-r-x
C.
762
D.
752
E.
None of the above
Correct Answer
D. 752
Explanation The file listing shows that the file fileone has the permissions -rwxr-x-w-. In octal mode, each permission is represented by a digit. The first digit represents the owner's permissions, the second digit represents the group's permissions, and the third digit represents the permissions for others. The permissions are assigned values as follows: read (4), write (2), and execute (1).
For the owner, the permissions are rwx, which translates to 4+2+1=7 in octal mode.
For the group, the permissions are r-x, which translates to 4+0+1=5 in octal mode.
For others, the permissions are -w-, which translates to 0+2+0=2 in octal mode.
Therefore, the octal mode permissions for the file fileone are 752.
Rate this question:
20.
Given the file permission rw-r--r-- for a file names script1 , identify the chmod command that adds executable permissions for owner and group and removes read permission from others:
A.
Chmod 750 script1
B.
Chmod 760 script1
C.
Chmod 770 script1
D.
Chmod 754 script1
E.
None of the above
Correct Answer
A. Chmod 750 script1
Explanation The given file permission "rw-r--r--" means that the owner has read and write permissions, the group has only read permission, and others have only read permission as well. To add executable permission for the owner and group, we need to use the "7" in the chmod command, which represents read, write, and execute permissions. The "5" in "750" represents read and execute permissions for others. Therefore, the correct answer is "chmod 750 script1."
Rate this question:
21.
Given the file permission in octal mode 644 for a file named script2 , identify chmod command that adds execut permissions for group and others: (SELECT ALL THAT APPLY)
A.
Chmod 655 script2
B.
Chmod g+x, o+x script2
C.
Chmod g=x,o=x script2
D.
Chmod u+x,g+x script2
E.
None of the above
Correct Answer(s)
A. Chmod 655 script2 B. Chmod g+x, o+x script2
Explanation The correct answer is "chmod 655 script2" because it adds execute permissions for group and others, changing the file permissions to 655. The answer "chmod g+x, o+x script2" is also correct because it adds execute permissions for group and others using the symbolic notation. The other options do not add execute permissions for both group and others.
Rate this question:
22.
Login as root, identify the Linux command used to give everyone full access permission to directory /public (select all that apply)
A.
Chmod 777 /public
B.
Chmod ugo=rwx /public
C.
Chmod a+rwx /public
D.
Chmod ugo+rwx /public
E.
Chmod a+rwx /public
Correct Answer(s)
A. Chmod 777 /public B. Chmod ugo=rwx /public C. Chmod a+rwx /public D. Chmod ugo+rwx /public E. Chmod a+rwx /public
Explanation The Linux command "chmod" is used to change the permissions of a file or directory. The numbers 777 represent full access permission for the owner, group, and others, respectively. The command "chmod 777 /public" gives everyone full access permission to the directory /public. Similarly, the commands "chmod ugo=rwx /public", "chmod a+rwx /public", "chmod ugo+rwx /public", and "chmod a+rwx /public" also give everyone full access permission to the directory /public.
Rate this question:
23.
Which of the following statements about minimum permissions needed to delete a file in Linux is true?
A.
For the directory: None, for the file : write(w) and execute(x)
B.
For the directory: write(w) and execute, for the file: none
C.
For the directory: read(r), write(w) and execute(x), for the file:none
D.
For the directory:read(r) and write(w), for the file: write(w)
E.
None of the above
Correct Answer
B. For the directory: write(w) and execute, for the file: none
Explanation To delete a file in Linux, the user needs to have write permissions on the directory where the file is located. This allows the user to modify the contents of the directory, including deleting files. However, no specific permissions are required for the file itself. Therefore, the correct answer is "for the directory: write(w) and execute, for the file: none."
Rate this question:
24.
Given the following
-rwxr-x-w- 2 paul students 127 Oct 5 13:37 filetwo
Who is the owner of filetwo?
A.
Paul
B.
Students
C.
Root
D.
Files dont have owners
E.
None of the above
F.
Devins mom
Correct Answer
A. Paul
Explanation The owner of filetwo is "paul" because in the given file permission string "-rwxr-x-w-", the first character indicates the file type (in this case, it is a regular file), the next three characters "rwx" represent the permissions for the owner (paul), the next three characters "r-x" represent the permissions for the group (students), and the last three characters "-w-" represent the permissions for others.
Rate this question:
25.
Given the following:
-rwxr-x-w- 2 students 127 Oct 5 13:37 filetwo
which of the following is the right command to change filetwo's owner to jack?
A.
Chmod paul jack
B.
Chgrp jack paul
C.
Chown jack filetwo
D.
Chown filetwo jack
E.
None of the above
Correct Answer
D. Chown filetwo jack
Explanation The correct command to change filetwo's owner to jack is "chown filetwo jack". This command changes the owner of the file "filetwo" to "jack".
Rate this question:
26.
Given the following:
-rwxr-x-w- 2 students 127 Oct 5 13:37 filetwo
to change the group students to faculty, you type _________________(SELECT ALL THAT APPLY)
A.
Chown .faculty filetwo
B.
Chmod jack.faculty filetwo
C.
Chgrp faculty filetwo
D.
Chgrp filetwo faculty
E.
None of the above
Correct Answer(s)
B. Chmod jack.faculty filetwo C. Chgrp faculty filetwo
Explanation To change the group of the file "filetwo" to "faculty", the correct commands are "chgrp faculty filetwo". The command "chmod jack.faculty filetwo" is incorrect because it is not a valid command.
Rate this question:
27.
What a umask of 066, which will be the default file permission?
A.
Rw-------
B.
----wx-wx
C.
Rw--wx-wx
D.
Rwxrw-r--
E.
None of the above
Correct Answer
A. Rw-------
Explanation A umask of 066 means that the permissions that are masked or removed from the default permissions are read, write, and execute for the group and others. Therefore, the default file permission would be rw-------, which means that the owner has read and write permissions, while the group and others have no permissions.
Rate this question:
28.
What is the order of execution to prepare a partition for data storage in Linux?
A.
Mount, mkfs, fsck, fdisk
B.
Fdisk, fsck, mkfs, mount
C.
Fdisk, mkfs, fsck, mount
D.
Fsck, fdisk, mount, mkfs
E.
None of the above
Correct Answer
C. Fdisk, mkfs, fsck, mount
Explanation The correct order of execution to prepare a partition for data storage in Linux is fdisk, mkfs, fsck, mount. First, fdisk is used to create a partition on the disk. Then, mkfs is used to create a file system on the partition. After that, fsck is used to check the file system for any errors. Finally, the partition is mounted to make it accessible for use.
Rate this question:
29.
To set default directory permission to rwx-wx-wx, you should set umask to _______.
A.
022
B.
622
C.
044
D.
644
E.
None of the above
Correct Answer
C. 044
Explanation To set the default directory permission to rwx-wx-wx, you should set the umask to 044. Umask is a value that is subtracted from the default permissions to determine the actual permissions for newly created files and directories. In this case, the umask of 044 means that the read, write, and execute permissions are allowed for the owner of the file, while the group and others have only the write and execute permissions.
Rate this question:
30.
Which of the following is true about hard link in Linux (SELECT ALL THAT APPLY)
A.
You may create multiple hard links to the same file
B.
All hard links have the same inode number as the original files
C.
All hard links become meaninless (orphan link) if the original file is removed
D.
The physical file will not be removed from the disk until all hard links are deleted
E.
None of the above
Correct Answer(s)
A. You may create multiple hard links to the same file B. All hard links have the same inode number as the original files D. The pHysical file will not be removed from the disk until all hard links are deleted
Explanation Multiple hard links can be created to the same file, meaning that multiple names can be associated with the same inode number. Therefore, all hard links have the same inode number as the original file. If the original file is removed, all hard links become meaningless or orphan links. However, the physical file will not be removed from the disk until all hard links are deleted. Therefore, the correct answer is that you may create multiple hard links to the same file, all hard links have the same inode number as the original files, and the physical file will not be removed from the disk until all hard links are deleted.
Rate this question:
31.
Answer based on the output of fdisk -l /dev/sda:
Disk /dev/sda: 16/1 GB, 16106127360 bytes
255 heads, 63 sectors/track, 1958 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 1657 13309821 83 Linux
/dev/sda2 1658 1912 2048284+ 82 Linux swap/Solaris
/dev/sda3 1913 1929 56227+ 5 Extended
/dev/sda5 1913 1914 16033+ 82 Linux swap/Solaris
/dev/sda6 1915 1916 16033+ 83 Linux
/dev/sda7 1917 1919 24066 83 Linux
Identify whether new partitions or logical drives can be created without deleting an existing partition or adding a new hard drive.
A.
No partitions or logical drives can be created
B.
A partition can be created, and it has to be a primary partition
C.
A partition can be created, and it has to be extented partition
D.
One primarry partition and more than one logical drives can be created
E.
None of the above
Correct Answer
D. One primarry partition and more than one logical drives can be created
Explanation Based on the output of the fdisk command, it can be observed that there is one primary partition (/dev/sda1) and an extended partition (/dev/sda3) which contains logical drives (/dev/sda5, /dev/sda6, /dev/sda7). Therefore, the correct answer is that one primary partition and more than one logical drives can be created without deleting an existing partition or adding a new hard drive.
Rate this question:
32.
Answer based on the output of fdisk -l /dev/sda:
Disk /dev/sda: 16/1 GB, 16106127360 bytes
255 heads, 63 sectors/track, 1958 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 1657 13309821 83 Linux
/dev/sda2 1658 1912 2048284+ 82 Linux swap/Solaris
/dev/sda3 1913 1929 56227+ 5 Extended
/dev/sda5 1913 1914 16033+ 82 Linux swap/Solaris
/dev/sda6 1915 1916 16033+ 83 Linux
/dev/sda7 1917 1919 24066 83 Linux
List all primary partitions
A.
/dev/sda1, /dev/sda2
B.
/dev/sda1, /dev/sda2, /dev/sda3
C.
/dev/sda5, /dev/sda6, /dev/sda7
D.
/dev/sda3
E.
None of the above
Correct Answer
A. /dev/sda1, /dev/sda2
Explanation The correct answer is /dev/sda1, /dev/sda2. This is because in the output of fdisk -l /dev/sda, /dev/sda1 and /dev/sda2 are listed as primary partitions. The "Id" column for /dev/sda1 is 83, which indicates a Linux system, and the "Id" column for /dev/sda2 is 82, which indicates a Linux swap/Solaris system. Therefore, /dev/sda1 and /dev/sda2 are the primary partitions on the disk.
Rate this question:
33.
Answer based on the output of fdisk -l /dev/sda:
Disk /dev/sda: 16/1 GB, 16106127360 bytes
255 heads, 63 sectors/track, 1958 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 1657 13309821 83 Linux
/dev/sda2 1658 1912 2048284+ 82 Linux swap/Solaris
/dev/sda3 1913 1929 56227+ 5 Extended
/dev/sda5 1913 1914 16033+ 82 Linux swap/Solaris
/dev/sda6 1915 1916 16033+ 83 Linux
/dev/sda7 1917 1919 24066 83 Linux
How many logical drives have been created?
A.
1
B.
2
C.
3
D.
4
E.
None of the above
Correct Answer
C. 3
Explanation Based on the output of fdisk -l /dev/sda, there are three logical drives that have been created. These drives are represented by /dev/sda1, /dev/sda2, and /dev/sda7. Each drive has a different start and end cylinder, as well as a different system type (Linux or Linux swap/Solaris). Therefore, the correct answer is 3.
Rate this question:
34.
Answer based on the output of fdisk -l /dev/sda:
Disk /dev/sda: 16/1 GB, 16106127360 bytes
255 heads, 63 sectors/track, 1958 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 1657 13309821 83 Linux
/dev/sda2 1658 1912 2048284+ 82 Linux swap/Solaris
/dev/sda3 1913 1929 56227+ 5 Extended
/dev/sda5 1913 1914 16033+ 82 Linux swap/Solaris
/dev/sda6 1915 1916 16033+ 83 Linux
/dev/sda7 1917 1919 24066 83 Linux
The extended partition is __________?
A.
/dev/sda1
B.
/dev/sda2
C.
/dev/sda3
D.
/dev/sda5
E.
None of the above
Correct Answer
C. /dev/sda3
Explanation Based on the output of the fdisk -l command, the extended partition is /dev/sda3. This can be determined by looking at the "System" column, which shows that /dev/sda3 has a system ID of 5, indicating that it is an extended partition.
Rate this question:
35.
Identify the command used to activate a swap partition
A.
Fdisk -l
B.
Swapon
C.
Mkfs
D.
Mkswap
E.
None of the above
Correct Answer
B. Swapon
Explanation The command "swapon" is used to activate a swap partition. This command is used in Linux systems to enable the swapping of data between the RAM and the swap space on the hard disk. By activating the swap partition with the "swapon" command, the system can utilize additional virtual memory when the physical memory (RAM) is running low.
Rate this question:
36.
What is the command that is used to create a swap filesystem.
A.
Mkfs
B.
Fdisk
C.
Mke2fs
D.
Mkswap
E.
None of the above
Correct Answer
A. Mkfs
Explanation The correct answer is "mkfs". This command is used to create a filesystem on a disk partition or a storage device. It is commonly used to format a partition with a specific filesystem type, such as ext4 or NTFS. However, in the context of the question, it is specifically used to create a swap filesystem. Swap space is a designated area on a disk that is used as virtual memory by the operating system when the physical memory (RAM) is full. Creating a swap filesystem using mkfs allows the system to use disk space as additional memory when needed.
Rate this question:
37.
The command that displays all mounted devices ________________.
A.
Mount
B.
Cat /etc/fstab
C.
Fdisk -l
D.
Fsck
E.
None of the above
Correct Answer
A. Mount
Explanation The command "mount" is used to display all mounted devices.
Rate this question:
38.
Based on /etc/fstab:
/dev/sda1 / ext3 defaults 1 1
/dev/sda2 swap swap defaults 0 0
/dev/sda3 /mnt/new ext3 noauto 2 2
/dev/fd0 /mnt/floppy ext2 auto, users 0 0
/dev/cdrom /mnt/cdrom iso9660 auto, nouser 0 0
To successfully mount /dev/cdrom , you should log on as _______.
A.
Regular user
B.
Root
C.
Any user
D.
None of the above
Correct Answer
B. Root
Explanation To successfully mount /dev/cdrom, you should log on as root.
Rate this question:
39.
Based on /etc/fstab:
/dev/sda1 / ext3 defaults 1 1
/dev/sda2 swap swap defaults 0 0
/dev/sda3 /mnt/new ext3 noauto 2 2
/dev/fd0 /mnt/floppy ext2 auto, users 0 0
/dev/cdrom /mnt/cdrom iso9660 auto, nouser 0 0
Identify the correct command line that is used to mount /dev/sda3 ___________ (SELECT ALL THAT APPLY)
A.
Mount /dev/sda3
B.
Mount /mnt/new
C.
Umount /mnt/new /dev/sda3
D.
Mount -t
E.
None of the above
Correct Answer(s)
A. Mount /dev/sda3 B. Mount /mnt/new
Explanation The correct command line that is used to mount /dev/sda3 is "mount /dev/sda3" or "mount /mnt/new".
Rate this question:
40.
Based on /etc/fstab:
/dev/sda1 / ext3 defaults 1 1
/dev/sda2 swap swap defaults 0 0
/dev/sda3 /mnt/new ext3 noauto 2 2
/dev/fd0 /mnt/floppy ext2 auto, users 0 0
/dev/cdrom /mnt/cdrom iso9660 auto, nouser 0 0
Which device/partition is not mounted automatically during startup?
A.
/dev/sda1
B.
/dev/sda2
C.
/dev/sda3
D.
/dev/fd0
E.
/dev/cdrom
Correct Answer
C. /dev/sda3
Explanation The device/partition that is not mounted automatically during startup is /dev/sda3. This is indicated by the "noauto" option in the /etc/fstab file, which means that it will not be mounted automatically at boot time.
Rate this question:
41.
To search a string "test2" in the BACKWARD direction in vim, you type __________
A.
/test2
B.
?test2
C.
%test2
D.
S/test2
E.
None of the above
Correct Answer
B. ?test2
Explanation In vim, to search a string in the backward direction, you can use the command "?test2". This command will search for the string "test2" in the text, starting from the current cursor position and moving backwards.
Rate this question:
42.
The command used to delete all characters from the cursor position to the end of the line in vim is ________
A.
Dd
B.
D$
C.
Dw
D.
D^
E.
None of the above
Correct Answer
B. D$
Explanation The command "d$" is used to delete all characters from the cursor position to the end of the line in vim. The "d" stands for delete, and the "$" represents the end of the line. By combining these two commands, all characters from the current cursor position until the end of the line will be deleted.
Rate this question:
43.
What is the command used to quit without saving in vim?
A.
:wq
B.
:w
C.
:q
D.
:q!
E.
None of the above
Correct Answer
D. :q!
Explanation The correct answer is ":q!" because it is the command used to quit vim without saving any changes made to the file. The exclamation mark (!) is added to force the quit operation, discarding any unsaved modifications. The other options mentioned, such as ":wq" (write and quit), ":w" (write), ":q" (quit), and "none of the above" do not fulfill the requirement of quitting without saving.
Rate this question:
44.
What is the result?
for animal in cat dog bear
do
echo $animal
done
A.
The words "cat", "dog", "animal", and "bear" are displayed on one line
B.
"animal" is displayed
C.
"cat", "dog", and "bear" are displayed on separate lines
D.
Nothing displays
E.
None of the above
Correct Answer
C. "cat", "dog", and "bear" are displayed on separate lines
Explanation The given code is a simple loop that iterates over the words "cat", "dog", and "bear" one by one. The echo command is used to display each word on a separate line. Therefore, the output will be "cat", "dog", and "bear" displayed on separate lines.
Rate this question:
45.
What is the result of the following statements?
((g=5))
until [ $g -lt 1 ]
do
echo $g
((g--))
done
A.
5,4,3,2,1 displayed on separate lines
B.
5,4,3,2 displayed on separate lines
C.
4,3,2,1,0 displayed on separate lines
D.
Nothing - syntax error
E.
None of the above
Correct Answer
A. 5,4,3,2,1 displayed on separate lines
Explanation The given code initializes the variable "g" with a value of 5. Then, it enters a loop that continues until the value of "g" is less than 1. Inside the loop, it prints the value of "g" and then decreases it by 1. This process continues until "g" becomes 0. Therefore, the output will be 5, 4, 3, 2, 1 displayed on separate lines.
Rate this question:
46.
Which of the following uses the bash shell for the command interpreter in a script?
A.
/bin/bash
B.
#/bin/bash
C.
!/bin/bash
D.
#!/bin/bash
E.
None of the above
Correct Answer
D. #!/bin/bash
Explanation The correct answer is "#!/bin/bash". This is because the "#!" symbol, also known as the shebang, is used to specify the interpreter for the script. In this case, "/bin/bash" is specified as the interpreter, indicating that the bash shell should be used to interpret the commands in the script.
Rate this question:
47.
What special variable is used to determine the exit status of a previously executed command?
A.
$#
B.
$0
C.
$?
D.
$9
E.
None of the above
Correct Answer
C. $?
Explanation The special variable "$?" is used to determine the exit status of a previously executed command. It holds the value of the exit status, which is a number indicating whether the command was successful (usually 0) or if there was an error (usually a non-zero value). This variable is commonly used in shell scripting to check the success or failure of a command and make decisions based on it.
Rate this question:
48.
You use the ______ symbol to mark the beginning of a comment in a script.
A.
#
B.
$
C.
!
D.
>
E.
None of the above
Correct Answer
A. #
Explanation The correct answer is "#". In scripting, the "#" symbol is used to mark the beginning of a comment. Comments are lines of code that are not executed by the computer and are used to provide explanations or notes for the human reader.
Rate this question:
49.
To redirect standard output and error of script1 to a file named outerr.txt, use the ___________ command.
A.
Script1 1> outerr.txt
B.
Script1 2> outerr.txt
C.
Script1 &> outerr.txt
D.
Script1 > /dev/null
E.
None of the above
Correct Answer
C. Script1 &> outerr.txt
Explanation The correct answer is "script1 &> outerr.txt". This command redirects both the standard output and error of script1 to a file named outerr.txt. The "&>" symbol is used to redirect both outputs simultaneously.
Rate this question:
50.
__________ is the operator that is used when you want one command to execute only if another command executes successfully.
A.
*
B.
||
C.
&&
D.
>
E.
None of the above
Correct Answer
C. &&
Explanation The correct answer is &&. The && operator is used in programming when you want one command to execute only if another command executes successfully. It is also known as the logical AND operator.
Rate this question:
Quiz Review Timeline +
Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.