1.
A directory is a type of file. True or False?
Correct Answer
A. True
Explanation
A directory is a type of file because it is used to store and organize files and other directories. It acts as a container that holds multiple files and subdirectories within a file system. Directories provide a hierarchical structure for organizing and accessing files on a computer. Therefore, it can be concluded that a directory is indeed a type of file.
2.
Which command would a user type on the command
line to find out what directory in the directory tree he is currently in?
Correct Answer
D. Pwd
Explanation
The correct answer is "pwd". The "pwd" command stands for "print working directory" and it is used to display the current directory that the user is in within the directory tree. By typing "pwd" on the command line, the user can quickly find out their current location in the directory structure.
3.
Which of the following is an absolute pathname?
Correct Answer
D. /home/resume
Explanation
An absolute pathname is a complete path that starts from the root directory. In the given options, "/home/resume" is the only one that starts with a forward slash, indicating that it is an absolute pathname. The other options either have a relative path or include a drive letter, which are not characteristics of an absolute pathname.
4.
A special device file is used to ___________.
Correct Answer
B. Represent hardware devices such as hard disk drives and ports
Explanation
A special device file is used to represent hardware devices such as hard disk drives and ports in Linux. These device files act as a communication interface between the operating system and the hardware devices. They allow the operating system to interact with the hardware devices by reading from or writing to these files, enabling the system to perform operations such as reading data from a hard disk or sending data through a port.
5.
If a user’s current directory is /home/mary/project1,
which command could she use to move to the etc directory directly under
the root?
Correct Answer
D. Cd /etc
Explanation
The user can move to the etc directory directly under the root by using the command "cd /etc". This command changes the current directory to the etc directory located at the root of the file system.
6.
After typing the ls
–a command, you notice that
there is a file whose filename begins with a dot ( . ). What does this mean?
Correct Answer
D. It is a hidden file.
Explanation
A file whose filename begins with a dot ( . ) is considered a hidden file. In Unix-like operating systems, filenames that start with a dot are not displayed by default when using commands like ls. These files are often used to store configuration or preference information that doesn't need to be directly accessed by users on a regular basis. To view hidden files, you can use the -a option with the ls command.
7.
After typing the ls
–F command,
you notice a filename that ends with an * asterisk character. What does
this mean?
Correct Answer
D. It is an executable file.
Explanation
The asterisk character at the end of the filename indicates that it is an executable file. In Unix-like systems, such as Linux, the asterisk is often used as a convention to denote executable files. Executable files are programs or scripts that can be run or executed by the operating system.
8.
The vi editor can function in which two of the
following modes? (Choose both that apply.)
Correct Answer(s)
B. Command
E. Insert
Explanation
The vi editor can function in two modes: command mode and insert mode. In command mode, users can navigate through the text, delete or copy lines, search for specific words, and perform other editing commands. In insert mode, users can directly type and insert new text into the document. These two modes allow users to efficiently edit and manipulate text in vi editor.
9.
The less command offers less functionality than the more command. True or False?
Correct Answer
B. False
Explanation
The statement is false. The less command actually offers more functionality than the more command. While both commands are used to view the contents of a file, the less command allows for backward scrolling, searching, and navigation within the file, while the more command only allows for forward scrolling. Therefore, the less command provides additional features and functionality compared to the more command.
10.
Which command searches for and displays any text
contents of a binary file?
Correct Answer
B. Strings
Explanation
The "strings" command is used to search for and display any text contents within a binary file. It scans the file for sequences of printable characters and outputs them. This command is commonly used for analyzing binary files, such as executable files or libraries, to extract any readable text strings embedded within them.
11.
How can a user switch from insert mode to command
mode when using the vi editor?
Correct Answer
D. Press the Esc key.
Explanation
In the vi editor, the user can switch from insert mode to command mode by pressing the Esc key. This key is used to exit the insert mode and enter the command mode, allowing the user to execute various commands such as saving the file, searching for text, or exiting the editor.
12.
If resume is the name
of a file in the home directory off the root of the filesystem and your
present working directory is home, what is the relative name for the file
named resume?
Correct Answer
C. Resume
Explanation
The relative name for the file named resume would be "resume". This is because the file is already located in the present working directory, which is home. Therefore, there is no need to include any additional directory paths in the relative name.
13.
What will the following
wildcard regular expression return:
file[a-c]?
Correct Answer
C. Filea, fileb, filec
Explanation
The given wildcard regular expression "file[a-c]?" will return "filea, fileb, filec" as the output. This is because the expression matches any string that starts with "file" followed by a single character that can be any letter between "a" and "c", and may or may not have an additional character at the end. Therefore, it will match "filea", "fileb", and "filec".
14.
What will typing q! at the : prompt in command
mode do when using the vi editor?
Correct Answer
D. Quit without saving any changes
Explanation
Typing q! at the : prompt in command mode in the vi editor will quit without saving any changes.
15.
A user types in the command head /poems/mary. What will be displayed to the terminal screen?
Correct Answer
E. The first 10 lines of the file mary
Explanation
When the user types in the command "head /poems/mary", the terminal will display the first 10 lines of the file named "mary".
16.
The tac command _________________.
Correct Answer
D. Displays the contents of a file in reverse order last line first and first line last
Explanation
The tac command is used to display the contents of a file in reverse order, with the last line being displayed first and the first line being displayed last.
17.
How can you specify a text pattern that must be
at the beginning of a line of text using a regular expression?
Correct Answer
D. Precede the string with a ^.
Explanation
To specify a text pattern that must be at the beginning of a line of text using a regular expression, you need to precede the string with a ^. The caret symbol (^) is a special character in regular expressions that represents the start of a line. By placing it before the string, you are indicating that the pattern should match only if it appears at the beginning of a line.
18.
Linux has only one root directory per directory
tree. True or False?
Correct Answer
A. True
Explanation
Linux does indeed have only one root directory per directory tree. This means that there is a single top-level directory from which all other directories and files branch out. This root directory is denoted by a forward slash ("/") in Linux systems. Having only one root directory helps to maintain a hierarchical structure and organization within the file system.
19.
Using wildcard metacharacters, how can you indicate
a character that is NOT an a or b or c or d?
Correct Answer
C. [!a-d]
Explanation
The correct answer is [!a-d]. This is because the caret (^) symbol inside the square brackets indicates negation, meaning that any character that is not an a, b, c, or d will match. The other options, [a-d], [^abcd], and !a-d, do not correctly represent the desired condition of not matching any of the specified characters.
20.
A user typed in the command pwd and saw the output: /home/jim/sales/pending. How
could that user navigate to the /home/jim directory?
Correct Answer
C. Cd ../..
Explanation
The user can navigate to the /home/jim directory by using the command "cd ..". This command moves the user up one level in the directory structure, so by using it twice, the user will be in the /home/jim directory. The other options provided in the question are incorrect. "cd /jim" would try to navigate to a directory called "jim" directly under the root directory, "cd .." would only move the user up one level in the current directory, and "cd ./." would stay in the current directory.