1.
Which command displays the list of groups to which a user belongs?
Correct Answer
D. Id
Explanation
The id command in Unix/Linux displays information about the user and the groups to which the user belongs. When you run the id command, it provides the user ID, group ID, and the list of groups the user is a member of. The whoami command only shows the current logged-in username, who displays information about all users currently logged into the system, and Isgroup is not a standard command in Unix/Linux.
2.
Which of the following can be used to access the command line?
Correct Answer
B. Terminal
Explanation
Terminal is the correct answer because it is a command line interface that allows users to interact with the operating system by typing commands. It provides a text-based environment where users can execute commands, run scripts, and navigate through directories. Unlike graphical user interfaces like XWindow or Firefox, the terminal provides direct access to the command line, making it a powerful tool for advanced users and system administrators. BIOS and Xargs are not used to access the command line, as BIOS is responsible for booting the computer and Xargs is a command used to build and execute command lines from standard input.
3.
Which of the following commands increases the number of elements in a directory (choose two answers)
Correct Answer(s)
A. Touch newfile
E. Mkdir newdirectory
Explanation
A) touch newfile: This command creates a new file named "newfile" if it does not already exist. By creating a new file, it increases the number of elements (files and directories) in the directory.
E) mkdir newdirectory: This command creates a new directory named "newdirectory" within the current directory. This also increases the number of elements in the directory by adding a new directory to it.
4.
Which of the following are correct commands for changing the current directory to the user's home? (Select all that applies)
Correct Answer(s)
B. Cd ~
D. Cd
Explanation
The correct commands for changing the current directory to the user's home directory are:
cd ~ - The tilde ~ represents the user's home directory.
cd - Without any arguments, cd will take you to the user's home directory.
5.
Which option will cause the echo command NOT to output a trailing newline?
Correct Answer
C. -n
Explanation
The option "-n" will cause the echo command to not output a trailing newline. This means that when using the echo command with the "-n" option, the text will be displayed without a new line character at the end, allowing the next output to be displayed on the same line.
6.
Which of the following commands moves the directory ~/summer-vacation and its content to ~/vacation/2011?
Correct Answer
D. Mv ~/summer-vacation ~/vacation/2011
Explanation
The correct answer is "mv ~/summer-vacation ~/vacation/2011". This command uses the "mv" command to move the directory ~/summer-vacation and its contents to ~/vacation/2011. The "~" symbol represents the home directory, so this command moves the "summer-vacation" directory from the home directory to the "vacation/2011" directory within the home directory.
7.
Which of the following commands can be used to create a file?
Correct Answer
A. Touch
Explanation
The correct answer is touch. The touch command is commonly used in Unix and Linux operating systems to create an empty file. It can also be used to update the access and modification timestamps of an existing file. The other options, build, nico, create, and mkfile, are not valid commands for creating a file.
8.
Which function does a shell program serve?
Correct Answer
C. It receives user commands and executes them
Explanation
A shell program serves the function of receiving user commands and executing them. It acts as an interface between the user and the operating system, allowing users to interact with the computer by entering commands. The shell program interprets these commands and executes them, performing various tasks such as running programs, managing files, and controlling system resources. It provides a command-line interface where users can enter commands and receive output or perform actions based on those commands.
9.
How could one search for the file foo.txt under the directory /home?
Correct Answer
D. Find /home -name foo.txt
Explanation
The correct answer is "find /home -name foo.txt". This is because the "find" command is used to search for files and directories within a specified directory. The "-name" option is used to search for files with a specific name, in this case "foo.txt". The "/home" argument specifies the directory in which to search for the file.
10.
Which of the following is a Linux-based operating system for use on mobile devices?
Correct Answer
C. Android
Explanation
Android is a Linux-based operating system for use on mobile devices. It was developed by Google and is widely used on smartphones, tablets, and other mobile devices. Android provides a user-friendly interface, supports a wide range of applications, and allows for customization and flexibility. It is known for its open-source nature, which allows developers to modify and enhance the operating system according to their needs.
11.
Which command will display running process information in realtime?
Correct Answer
A. Top
Explanation
The correct answer is "top". The "top" command is used to display real-time information about running processes on a system. It provides a dynamic view of the system's processes, including details such as CPU usage, memory usage, and process IDs. By continuously updating the information, "top" allows users to monitor the system's performance and identify any processes that may be consuming excessive resources.
12.
Which of the following Linux distributions use the dpkg package management system? (Choose two correct answers)
Correct Answer(s)
C. Debian
D. Ubuntu
Explanation
Debian and Ubuntu both use the dpkg package management system. Dpkg is a package manager used in Debian-based Linux distributions to install, remove, and manage software packages. Suse, Red Hat, and Mandriva use different package management systems such as RPM (Red Hat Package Manager) or Zypper. Therefore, the correct answers are Debian and Ubuntu.
13.
What is the first character for a file or directory names if they should not be displayed by commands such as ls unless specifically requested?
Correct Answer
B. . (dot)
Explanation
In Unix-based systems, the dot (.) is used as the first character for file or directory names that should not be displayed by commands like ls unless specifically requested. This convention is commonly used for hidden files or directories, which typically contain configuration files or sensitive data that should not be easily accessible or accidentally modified. By starting the name with a dot, the file or directory is effectively "hidden" from regular directory listings, providing a level of privacy or organization.
14.
The output of the program date should be saved in the variable actdat. What is the correct statement?
Correct Answer
A. Actdat=$(date)
Explanation
In a Linux shell script, you can use the date command to retrieve the current date and time. To save the output of this command into a variable named actdat, you can use command substitution, denoted by $(...).
15.
Which of the following commands is used to list the contents of a directory in Linux?
Correct Answer
B. Ls
Explanation
The ls command is a fundamental Linux command used to list the files and directories within a specified directory. It provides various options for customizing the output, such as displaying file sizes, permissions, and modification times. The other options are also common Linux commands: cd (change directory), mkdir (make directory), and rm (remove).
16.
Which of the following files holds the definition of the local user accounts?
Correct Answer
C. /etc/passwd
Explanation
The correct answer is /etc/passwd. This file holds the definition of the local user accounts on a Unix-like operating system. It contains important information such as the username, user ID, group ID, home directory, and shell for each user. This file is used by the system to authenticate users and manage their permissions and access privileges.
17.
What is the output of the following command?
tail -n 20 test.txt
Correct Answer
D. The last 20 lines of test.txt including the blank lines
Explanation
The command "tail -n 20 test.txt" is used to display the last 20 lines of the file "test.txt". It includes both the non-blank lines and the blank lines present in the file.
18.
How can the normal output of a command be written to a file while discarding the error output?
Correct Answer
E. Command > output.txt 2>/dev/null
Explanation
command: The command whose output you want to capture.
>: Redirects the standard output (stdout) of the command to a file named output.txt.
2>/dev/null: Redirects the standard error output (stderr) of the command to /dev/null, which is a special file that discards any data written to it.
This way, only the normal output of the command will be written to the output.txt file, and any error output will be discarded.
19.
Given the following directory permissions:
drwxrwxrwt 14 root 36864 2012-03-02 11:17 tmp
What is the letter t at the end of drwxrwxrwt indicate?
Correct Answer
B. It means that even though the directory is global writable only the owner can delete their own files.
Explanation
The letter "t" at the end of "drwxrwxrwt" indicates the sticky bit. This means that even though the directory is globally writable, only the owner of a file within the directory can delete their own files. This is a security measure that prevents unauthorized deletion of files by other users.
20.
After installing a new package, in which directory are you most likely find its configuration file?
Correct Answer
C. /etc
Explanation
After installing a new package, you are most likely to find its configuration file in the /etc directory. The /etc directory is commonly used to store system-wide configuration files in Unix-like operating systems. It is the standard location for various configuration files, including those related to installed packages. Therefore, it is the most probable directory to find the configuration file of a newly installed package.
21.
Which statement about the directory /etc/skel are correct? (Choose two answers)
Correct Answer(s)
C. The files from the directory are copied to the home directory of the new user when the account is created
D. The directory contains a default set of configuration files used by the useradd command
Explanation
The directory /etc/skel contains a default set of configuration files used by the useradd command. When a new user account is created, the files from this directory are copied to the home directory of the new user. This ensures that the new user has a set of default configuration files and settings. However, the directory does not contain the personal settings of root and it does not contain the global settings for the Linux system.
22.
Which of the following file systems is most commonly used for Linux distributions?
Correct Answer
B. Ext4
Explanation
ext4 is the most commonly used file system for Linux distributions because it is the default file system for many Linux operating systems. It offers improved performance, reliability, and support for larger file sizes and partitions compared to its predecessor, ext3. Additionally, ext4 supports features such as journaling, which helps to prevent data loss in the event of a system crash. Overall, ext4 is widely adopted and trusted by the Linux community, making it the preferred choice for Linux distributions.
23.
When a new user is added, where does the user ID get stored?
Correct Answer
E. /etc/passwd
Explanation
The user ID of a new user is stored in the /etc/passwd file. This file is a system file that contains information about user accounts, including their usernames, user IDs, group IDs, home directories, and login shells. The /etc/passwd file is used by the system for user authentication and to determine various permissions and settings for each user.
24.
Which one of the following statements concerning Linux passwords is true?
Correct Answer
D. Passwords are only stored in encrypted form
Explanation
Passwords are only stored in encrypted form. This means that when a user sets a password on a Linux system, it is encrypted and stored securely. The encryption ensures that even if someone gains unauthorized access to the system's password file, they will not be able to determine the actual passwords easily. This is an important security measure to protect user accounts and sensitive information.
25.
Which command lists all files in the current directory that starts with a capital letter?
Correct Answer
A. Ls [A-Z]*
Explanation
The correct answer is "ls [A-Z]*". This command uses the wildcard character "*" to match any file that starts with a capital letter in the current directory. The "[A-Z]" specifies that the file must start with a capital letter, and the "*" allows for any additional characters after the capital letter.
26.
What does LAMP mean?
Correct Answer
D. The combination of Linux, Apache, MySQL, and PHP and other programming languages
Explanation
The correct answer is the combination of Linux, Apache, MySQL, and PHP and other programming languages. LAMP is a popular open-source web development platform that uses these technologies to create dynamic websites and web applications. Linux is the operating system, Apache is the web server software, MySQL is the database management system, and PHP is the programming language. This combination provides a powerful and flexible environment for building and deploying web applications.
27.
How is it possible to determine if an executable file is a shell script that is ready by Bash?
Correct Answer
C. The file line starts with #!/bin/bash
Explanation
The correct answer is "The file line starts with #!/bin/bash". This is because the shebang line, which starts with #!, is used to specify the interpreter for the script. In this case, the shebang line indicates that the script should be interpreted by the Bash shell.
28.
Which is a suitable command to find the next appearance of the word hidden in a man page being viewed from the command line?
Correct Answer
D. /hidden
Explanation
The command "/hidden" is the correct answer because it is the syntax used to search for the next appearance of the word "hidden" in a man page being viewed from the command line. By typing "/hidden" and pressing enter, the command line will search for the next occurrence of the word "hidden" on the man page.
29.
While deleting all files beginning with the letter a there was still the file Access.txt left. Assuming that it had the correct ownership, why was it not deleted?
Correct Answer
E. Linux file names are case sensitive
Explanation
The reason the file Access.txt was not deleted is because Linux file names are case sensitive. The command used to delete the files beginning with the letter "a" would only delete files with lowercase "a" as the first letter, while "Access.txt" starts with an uppercase "A". Therefore, it was not deleted.
30.
Why is the file data.txt empty after executing sort data.txt > data.txt?
Correct Answer
D. Because the file gets truncated before the sort is executed
Explanation
When the command "sort data.txt > data.txt" is executed, it redirects the sorted output of the "sort" command to the same file "data.txt". However, the ">" operator truncates the file before any data is written to it. Therefore, the file becomes empty before the "sort" command is executed, resulting in an empty "data.txt" file.
31.
Which of the following commands will output all of the lines that contain either the string Fred or fred? (Select all that apply)
Correct Answer(s)
D. Grep '[Ff]red' data_file
E. Grep -i fred data_file
Explanation
To output all lines containing either the string "Fred" or "fred," you can use the following commands:
grep '[Ff]red' data_file - This command matches both "Fred" and "fred" by using a character class [Ff] that allows either uppercase "F" or lowercase "f".
grep -i fred data_file - The -i flag makes the search case-insensitive, matching "Fred", "fred", or any other case variation.
The other commands do not correctly match both "Fred" and "fred":
grep -v fred data_file: This will output lines that do not contain "fred."
grep '[f]red' data_file: This matches only "fred" because it does not account for uppercase "F."
egrep fred data_file: This matches only "fred" in lowercase.
32.
Which of the following statements may be used to access the second command line argument to a script?
Correct Answer
C. "$2"
Explanation
The correct answer is "$2" because in most programming languages, including shell scripting, the dollar sign ($) followed by a number is used to access command line arguments. In this case, "$2" would refer to the second command line argument passed to the script.
33.
Which of the following commands is used to lookup the current IP address of a system?
Correct Answer
B. Ifconfig
Explanation
The correct answer is "ifconfig". This command is used to lookup the current IP address of a system. It displays the network configuration information of all network interfaces on the system, including the IP address assigned to each interface.
34.
Which of the following will change the group that is associated with a file?
Correct Answer
C. Chown
Explanation
The command "chown" is used to change the owner of a file, and by extension, it also changes the group associated with that file. This command allows the user to transfer ownership from one user to another, and in doing so, the group association may also be modified. Therefore, "chown" is the correct answer for changing the group associated with a file.
35.
The following file is found in which system file?root:x:0:0::/root:/bin/bash
Correct Answer
C. /etc/passwd
Explanation
The correct answer is /etc/passwd. This file is found in the system file directory and contains essential information about user accounts on the system, such as usernames, user IDs, group IDs, home directories, and default shells. It is a plain text file that can be accessed by privileged users and some system processes for authentication purposes.
36.
Which of the following commands will create an archive file, named backup.tar, containing all the files from the directory /home?
Correct Answer
E. Tar -cf backup.tar /home
Explanation
The correct answer is "tar -cf backup.tar /home". This command uses the tar utility with the -cf options to create a new archive file named backup.tar. The /home directory is specified as the source directory from which all files will be included in the archive.
37.
What is the output of the following command?
for token in a b c; do
echo -n ${token}
done
Correct Answer
B. Abc
Explanation
The for loop iterates over the tokens a, b, and c.
The echo -n ${token} command prints each token without a newline.
Therefore, the tokens a, b, and c are printed consecutively on the same line, resulting in the output abc.
38.
Which of the following is a combined audio/video interface for the transmission of digital data?
Correct Answer
C. HDMI
Explanation
HDMI (High-Definition Multimedia Interface) is a combined audio/video interface for the transmission of digital data. It is widely used in consumer electronics such as televisions, computers, and gaming consoles to connect devices and transmit high-quality audio and video signals. HDMI supports both audio and video signals in a single cable, making it convenient and efficient for transmitting digital data.
39.
Which of the following commands can be used to view a file and do search operations within it while viewing the contents?
Correct Answer
A. Less
Explanation
The less command is a versatile tool for viewing file content in a terminal. It provides navigation options like scrolling, paging, and searching within the displayed text. Unlike commands like cat which display the entire file at once, less offers a controlled view, especially useful for large files. It also allows for searching specific terms or patterns using regular expressions, making it a preferred choice for interactive file viewing and analysis.
40.
Which of the following answers are true for cloud computing? (Choose two correct answers)
Correct Answer(s)
A. Cloud Computing provides new tools to manage IT resources
B. From the business perspective, Cloud Computing means outsourcing or centralization of IT operations
Explanation
Cloud Computing provides new tools to manage IT resources, which means that it offers innovative solutions and technologies for handling and optimizing IT resources. From the business perspective, Cloud Computing involves outsourcing or centralization of IT operations, allowing companies to rely on external providers for their IT needs, resulting in cost savings and increased efficiency.
41.
What keyword is missing from the following segment of the shell script?for i in*;----cat $idone
Correct Answer
A. Do
Explanation
The missing keyword in the given shell script segment is "do". The "do" keyword is used in shell scripting to indicate the start of a loop or a block of code that needs to be executed repeatedly. In this case, the "do" keyword is missing before the "cat $idone" line, which suggests that the script is incomplete and the intended loop or block of code is not properly defined.
42.
A Linux computer has no access to the Internet. Which command displays information about the network gateway for the system?
Correct Answer
D. Route
Explanation
The correct answer is "route". The "route" command displays information about the network gateway for the system. It shows the routing table, which includes information about the network destinations and the corresponding gateway addresses. This command is commonly used in Linux systems to troubleshoot network connectivity issues and to manage the routing configuration.
43.
What is the usual absolute path of the personal directory for the user foo?
Correct Answer
home , foo , /home , foo , /home/foo
Explanation
The usual absolute path of the personal directory for the user "foo" is "/home/foo" or "/home/foo/". This is because in most Linux systems, the personal directories for users are located in the "/home" directory, and the directory for the user "foo" would be named "foo". The trailing slash ("/") at the end of the path is optional and does not affect the correctness of the path.
44.
When typing a long command line at the shell, what single character can be used to split a command across multiple lines?
Correct Answer
\
Explanation
The backslash (\) character can be used to split a command across multiple lines when typing a long command line at the shell. This character is known as the line continuation character and it allows the command to continue on the next line, making it easier to read and manage long command lines.
45.
What is the command that will show system boot time messages?
Correct Answer
A. Dmesg
Explanation
The command "dmesg" is used to display system boot time messages. It allows users to view the kernel ring buffer, which contains information about the system's hardware, drivers, and other messages generated during the boot process. This command is commonly used for troubleshooting purposes and to gather information about the system's initialization and hardware configuration.
46.
Which of the following statements concerning the General Public License (GPL) is true?
Correct Answer
A. The GPL is designed to ensure that the source code of a software remains freely available
Explanation
The General Public License (GPL) is a license designed to guarantee that the source code of a software remains freely available. This means that anyone who receives a software under the GPL has the right to access, modify, and distribute its source code. The GPL promotes the idea of open source software and encourages collaboration and innovation within the software community. It does not restrict the selling of GPL software or require approval from the original author for changes made to the program.
47.
What permissions are set on a file with the command chmod 654 file.txt?
Correct Answer
E. -rw-r-xr--
Explanation
The first character indicates the file type (in this case, it's a regular file).
The next three characters "rw-" specify the permissions for the file owner (read and write, but not execute).
The next three characters "r-x" specify the permissions for the group (read and execute, but not write).
The last three characters "r--" specify the permissions for others (read only, no write or execute).
48.
Which of the following commands can be used to extract content from a tar file?
Correct Answer
A. Tar -xvf
Explanation
The command "tar -xvf" can be used to extract content from a tar file. The "x" flag stands for extract, the "v" flag stands for verbose (displaying the progress and details of the extraction), and the "f" flag is used to specify the file name. This command will extract the contents of the tar file to the current directory.
49.
What two-character sequence is present at the beginning of an interpreted script? Please specify two characters only.
Correct Answer
#!
Explanation
The two character sequence present at the beginning of an interpreted script is "#!". This sequence is known as a shebang or hashbang and is used to specify the interpreter for the script. It tells the operating system which interpreter should be used to execute the script.
50.
Which of the following programs is not a graphical web browser?
Correct Answer
C. Links
Explanation
Links is not a graphical web browser because it is a text-based web browser. Unlike graphical web browsers, Links does not display web pages with images or other visual elements. Instead, it focuses on providing a lightweight and efficient browsing experience by rendering web pages in text format. This makes it suitable for low-resource environments or for users who prefer a minimalist browsing experience.