1.
What is true regarding the statement beginning with #! that is found in the first line of a script?
Correct Answer
B. It specifies the path and the arguments of the interpreter used to run the script.
Explanation
The correct answer is that the statement beginning with #! in the first line of a script specifies the path and the arguments of the interpreter used to run the script. This is known as the "shebang" or "hashbang" line, and it is used to indicate which interpreter should be used to execute the script. The shebang line is typically followed by the path to the interpreter executable and any necessary command-line arguments.
2.
Which Bash option prevents a user from accidentally overwriting a file with a “>”?
Correct Answer
C. Set -o noclobber
Explanation
The correct answer is "set -o noclobber". This option prevents a user from accidentally overwriting a file with a ">" symbol by refusing to overwrite an existing file when using the ">" redirection operator.
3.
Which of the following commands prints the exit value of the most recently executed program inBash?
Correct Answer
A. Echo $?
Explanation
The command "echo $?" prints the exit value of the most recently executed program in Bash. The "$?" is a special variable in Bash that holds the exit status of the last executed command. By using the "echo" command, we can display the value of this variable, which represents the exit code of the previous program.
4.
What word will complete an if statement in bash such as the following: if [ -x “$file” ]; then echo $file _____(Please provide the missing word only)
Correct Answer
fi
Explanation
The missing word in the if statement is "fi". In bash, the "fi" keyword is used to close an if statement. It signifies the end of the block of code that should be executed if the condition in the if statement is true.
5.
What word is missing from the following SQL statement? update tablename ____ fieldname=’value’ where id=909;(Please specify the missing word using lower\_case letters only.)
Correct Answer
set
Explanation
The missing word in the SQL statement is "set". In an SQL update statement, the "set" keyword is used to specify the column or columns to be updated and their corresponding values. In this case, the missing word "set" is required to indicate that the fieldname should be updated with the given value where the id is equal to 909.
6.
Which of the following SQL statements will select the fields name and address from the contactstable?
Correct Answer
C. SELECT name, address FROM contacts;
Explanation
The correct answer is "SELECT name, address FROM contacts;". This statement selects the fields "name" and "address" from the "contacts" table. The SELECT keyword is used to specify the columns to be retrieved, and the FROM keyword is used to specify the table from which the data should be retrieved.
7.
Which of the following configuration files should be modified to globally set shell variables for all users?
Correct Answer
B. /etc/profile
Explanation
The correct answer is /etc/profile. This file is a system-wide configuration file that sets environment variables and runs commands for all users on the system. Modifying this file allows for the global setting of shell variables that will be applied to all users when they log in. The other options (/etc/bashrc, ~/.bash_profile, and /etc/.bashrc) are either user-specific or not applicable for setting variables globally for all users.
8.
Which of the following commands are used to manage the environment and shell variables within a shell process?(Choose TWO correct answers.)
Correct Answer(s)
A. Export
D. Set
Explanation
The "export" command is used to set environment variables and make them available to child processes. The "set" command is used to display or set shell variables and their values. Both commands are used to manage the environment and shell variables within a shell process.
9.
Which of the following are operators used for comparisons by the test command? (Choose TWO correct answers.)
Correct Answer(s)
B. =
D. -eq
Explanation
The operators "=" and "-eq" are used for comparisons by the test command. The "=" operator checks if two values are equal, while the "-eq" operator checks if two numeric values are equal. These operators are commonly used in conditional statements to compare values and make decisions based on the result of the comparison.
10.
Which of the following commands creates a function in Bash that outputs the sum of twonumbers?
Correct Answer
A. Function sumitup { echo $(($1 + $2)) ; }
Explanation
The correct answer is "function sumitup { echo $(($1 + $2)) ; }". This is the correct command syntax to create a function in Bash that outputs the sum of two numbers. The function is named "sumitup" and it uses the echo command to display the sum of the two input numbers, which are represented by the variables $1 and $2. The sum is calculated using the arithmetic expression $(($1 + $2)).
11.
What output will the following command sequence produce?echo ‘1 2 3 4 5 6’ | while read a b c; do echo result: $c $b $a; done
Correct Answer
A. Result: 3 4 5 6 2 1
Explanation
The given command sequence uses the "echo" command to print the string "1 2 3 4 5 6" and then pipes it to the "while" loop. The "while" loop reads the input and assigns the values to variables "a", "b", and "c". Then, it echoes the result in the format "result: $c $b $a". The loop continues until there are no more values to read.
In this case, the loop will execute twice. The first time, it assigns "1" to variable "a", "2" to variable "b", and "3" to variable "c". The result is echoed as "result: 3 2 1". The second time, it assigns "4" to variable "a", "5" to variable "b", and "6" to variable "c". The result is echoed as "result: 6 5 4". Therefore, the correct answer is "result: 3 4 5 6 2 1".
12.
When the command echo $? outputs 1, which of the following statements are true?
Correct Answer
C. It is the exit value of the command executed immediately before echo.
Explanation
When the command echo $? outputs 1, it means that the previous command executed before the echo command returned an exit value of 1. The exit value is a numerical value that indicates the success or failure of a command in Unix-like operating systems. In this case, the exit value of the previous command was 1, which typically indicates an error or failure. Therefore, the statement "It is the exit value of the command executed immediately before echo" is true.
13.
What word is missing from the following SQL statement? insert into tablename ________(909,‘text’);(Please specify the missing word using lower-case letters only.)
Correct Answer
values
Explanation
The missing word in the SQL statement is "values". The statement is an INSERT INTO statement, which is used to insert data into a table. The missing word is the keyword that indicates that the following values are being inserted into the table.
14.
Which command makes the shell variable named VARIABLE visible to subshells?
Correct Answer
B. Export VARIABLE
Explanation
The correct answer is "export VARIABLE". The export command is used to make a shell variable visible to subshells. By using the export command followed by the variable name, the variable is made available to any child processes or subshells that are created from the current shell. This allows the variable to be accessed and used in those subshells.
15.
What output will the command seq 10 produce?
Correct Answer
B. The numbers 1 through 10 with one number per line.
Explanation
The command "seq 10" will produce the numbers 1 through 10 with one number per line. The "seq" command is used to generate a sequence of numbers, and in this case, it will generate a sequence starting from 1 and ending at 10, with each number printed on a separate line.
16.
By default, the contents of which directory will be copied to a new user’s home directory when the account is created by passing the -m option to the useradd command? (Specify the full path to the directory.)
Correct Answer
/etc/skel
Explanation
When a new user account is created using the useradd command with the -m option, the contents of the /etc/skel directory will be copied to the new user's home directory. The /etc/skel directory contains default files and directories that are meant to be copied to each new user's home directory, providing them with a basic set of configuration files and templates.
17.
What word is missing from the following SQL statement?__________ count(*) from tablename;(Please specify the missing word using lower-case letters only.)
Correct Answer
select
Explanation
The missing word in the SQL statement is "select". In SQL, the "select" keyword is used to retrieve data from a database table. It is followed by the columns or expressions that need to be selected. In this case, the statement is incomplete as it is missing the columns or expressions to be selected.
18.
Which of the following files, when existing, affect the behavior of the Bash shell? (Choose TWO correct answers.)
Correct Answer(s)
B. ~/.bashrc
E. ~/.bash_profile
Explanation
The ~/.bashrc file affects the behavior of the Bash shell. It is a script that is executed whenever a new interactive shell is started. It can be used to set environment variables, define aliases, and configure other shell settings.
The ~/.bash_profile file also affects the behavior of the Bash shell. It is executed when a user logs in to the system. It is typically used to set up the user's environment and execute any necessary initialization commands.
Both of these files allow users to customize their Bash shell environment and behavior.
19.
After issuing: function myfunction { echo $1 $2 ; } in Bash, which output does: myfunction A B C Produce?
Correct Answer
A. A B
Explanation
The given function myfunction takes two arguments and echoes them. After issuing the function myfunction A B C, it will only consider the first two arguments A and B, and the output will be A B.
20.
Which of the following commands puts the output of the command date into the shell variablemydate?
Correct Answer
A. Mydate=”$(date)”
Explanation
The correct answer is mydate=”$(date)”. This command uses command substitution to capture the output of the "date" command and assign it to the shell variable "mydate". The $(date) syntax executes the "date" command and returns its output, which is then assigned to the variable "mydate".
21.
What is the purpose of the sticky keys feature in X?
Correct Answer
A. To assist users who have difficulty holding down multiple keys at once.
Explanation
The purpose of the sticky keys feature in X is to assist users who have difficulty holding down multiple keys at once. This feature allows users to press and release modifier keys, such as Shift, Ctrl, or Alt, and have them remain active until the next key is pressed. This helps individuals with physical disabilities or limited dexterity to perform keyboard shortcuts and combinations more easily.
22.
On a machine running several X servers, how are the different instances of the X11 serveridentified?
Correct Answer
E. By a display name like:1.
Explanation
The different instances of the X11 server are identified by a display name, which is typically in the format ":". This display name is used to differentiate between the various X servers running on the machine. The number after the colon represents the display number, indicating which instance of the X server it is. For example, ":1" would refer to the second X server running on the machine.
23.
What is the purpose of the xhost program?
Correct Answer
A. Grant or revoke access to a X11 session.
Explanation
The purpose of the xhost program is to grant or revoke access to a X11 session. It allows the user to control which hosts are allowed to connect to their X server and display graphical applications. This is important for security reasons, as it allows the user to restrict access to their X session and prevent unauthorized users from accessing their display.
24.
What of the following statements is true regarding a display manager?
Correct Answer
D. After system startup, the display manager handles the login of a user.
Explanation
The display manager is responsible for managing the login process of a user after the system startup. It provides a graphical interface for users to log in and start their session. Without a display manager, users would not be able to access the graphical environment and run graphical programs.
25.
How is a display manager started?
Correct Answer
B. It is started like any other system service by the init system.
Explanation
The display manager is started like any other system service by the init system. This means that it is initialized and launched during the boot process of the operating system. The init system is responsible for managing the startup and shutdown processes of various system services, including the display manager. By starting the display manager as a system service, it ensures that it is available and running for users to log in and access the graphical user interface.
26.
What is the default name of the configuration file for the Xorg X11 server? (Specify the file name only without any path.)
Correct Answer
xorg.conf
Explanation
The default name of the configuration file for the Xorg X11 server is "xorg.conf". This file is responsible for configuring various settings and options for the Xorg server, such as display resolutions, input devices, and graphics drivers. By default, the Xorg server looks for this file in the /etc/X11/ directory.
27.
Which of the following commands shows the current color depth of the X Server?
Correct Answer
C. Xwininfo
Explanation
The xwininfo command is used to obtain information about windows in the X Server. It can display various details about the windows, including the current color depth. Therefore, xwininfo is the command that shows the current color depth of the X Server.
28.
For accessibility assistance, which of the following programs is an on-screen keyboard?
Correct Answer
C. GOK
Explanation
GOK is an on-screen keyboard program. It stands for GNOME On-Screen Keyboard and it is designed to provide an alternative input method for users who have difficulty using a physical keyboard. GOK allows users to type using a virtual keyboard that appears on the screen, which can be operated using a mouse, touchpad, or other pointing devices. This program is particularly useful for individuals with motor disabilities or impairments that prevent them from using a traditional keyboard.
29.
What is the name of the simple graphical login manager that comes with a vanilla X11 installation?(Specify ONLY the command without any path or parameters.)
Correct Answer
xdm
Explanation
The correct answer is xdm. Xdm is a simple graphical login manager that is included in a vanilla X11 installation. It allows users to log in to their X Window System desktop environments by providing a graphical interface for entering their credentials. Xdm is a lightweight and straightforward login manager that is commonly used in Unix-like operating systems.
30.
Which of the following are tasks handled by a display manager like XDM or KDM? (Choose TWO correct answers.)
Correct Answer(s)
A. Start and prepare the desktop environment for the user.
C. Handle the login of a user.
Explanation
A display manager like XDM or KDM handles the tasks of starting and preparing the desktop environment for the user, as well as handling the login of a user. These tasks involve managing the graphical interface, authenticating the user, and setting up the necessary environment for the user to interact with the system. The display manager is responsible for presenting the login screen, allowing the user to enter their credentials, and then launching the appropriate desktop environment once the user is authenticated.
31.
Which of the following commands can modify or set the password expiration for a user? (Choose TWO correct answers.)
Correct Answer(s)
A. Chage
D. Passwd
Explanation
The chage command is used to modify or set the password expiration for a user. It allows system administrators to change the number of days between password changes and the maximum number of days the password is valid. The passwd command is also used to modify or set the password for a user, which indirectly affects the password expiration. Therefore, both chage and passwd are correct answers for this question.
32.
Which of the following statements is true regarding the /etc/shadow file?
Correct Answer
B. Only root is allowed to read and write /etc/shadow.
Explanation
The /etc/shadow file is a crucial file in Linux systems that stores encrypted user passwords. It contains sensitive information, so it is important to restrict access to it. The correct answer states that only the root user is allowed to read and write the /etc/shadow file. This means that regular users do not have access to this file, ensuring the security of user passwords.
33.
Which of the following commands will convert files from one character encoding to another?
Correct Answer
C. Iconv
Explanation
The command "iconv" is used to convert files from one character encoding to another. It is a commonly used command-line tool that can convert text between different character encodings. With "iconv", users can specify the input and output character encodings, allowing them to convert files to the desired encoding. This command is widely available on various operating systems and is a reliable option for converting file encodings.
34.
Which environment variable will override all LC_* variables?
Correct Answer
B. LC_ALL
Explanation
LC_ALL is an environment variable that can be used to override all other LC_* variables. It sets the locale for all aspects of the user interface, including collation, numeric, monetary, and date/time formatting. When LC_ALL is set, it takes precedence over other LC_* variables such as LC_COLLATE and LC_COLLATE. Therefore, if LC_ALL is set, it will override any specific settings made by other LC_* variables.
35.
Which command will set the local machine’s timezone to UTC?
Correct Answer
B. Ln -s /usr/share/zoneinfo/UTC /etc/localtime
Explanation
The correct answer is "ln -s /usr/share/zoneinfo/UTC /etc/localtime". This command creates a symbolic link between the UTC timezone file in the /usr/share/zoneinfo directory and the /etc/localtime file, effectively setting the local machine's timezone to UTC.
36.
Which of the following actions prevents a specific user from scheduling tasks using at or batch?
Correct Answer
C. Add the specific user to the /etc/at.deny file.
Explanation
Adding the specific user to the /etc/at.deny file prevents them from scheduling tasks using at or batch. The /etc/at.deny file contains a list of users who are not allowed to use the at or batch commands. By adding the specific user to this file, their access to these commands is denied.
37.
What is the main difference between the batch and at commands?
Correct Answer
B. The commands of a batch job run sequentially one after another while the commands in at jobs
may run in parallel.
Explanation
The main difference between the batch and at commands is that the commands of a batch job run sequentially one after another, while the commands in at jobs may run in parallel. This means that in a batch job, each command will wait for the previous one to finish before executing, whereas in an at job, multiple commands can be executed simultaneously.
38.
Why should a regular user edit his personal crontab by using the command crontab instead of just editing his crontab file manually?
Correct Answer
C. Because user specific crontab entries are stored in a special directory which is maintained by
the cron daemon and not writable for regular users.
Explanation
The correct answer states that a regular user should use the "crontab" command to edit their personal crontab because user specific crontab entries are stored in a special directory that is maintained by the cron daemon and not writable for regular users. This means that manually editing the crontab file may not have any effect on the user's scheduled tasks, as the changes need to be made through the proper command to ensure they are stored in the correct directory and recognized by the cron daemon.
39.
What is true about groups in a Linux system?(Choose TWO correct answers.)
Correct Answer(s)
A. Each user may be a member of several groups. However, only one group is the user’s primary
group.
B. Groups may have a password that allows users to join that group temporarily.
Explanation
In a Linux system, each user can be a member of multiple groups, but only one group is designated as the user's primary group. This primary group is used for file ownership and permissions. Additionally, groups in Linux can have a password that allows users to temporarily join that group, granting them access to specific resources or privileges. This password-based group membership is a flexible feature that provides temporary access control.
40.
What is true about UIDs and GIDs?
Correct Answer
E. There are distinct number spaces for UIDs and GIDs, i.e. the same number may be used as
both a UID and a GID.
Explanation
The explanation for the given answer is that UIDs and GIDs have separate number spaces, meaning that the same number can be used as both a UID and a GID. This means that a user and a group can have the same identification number without conflict.
41.
What happens if the password of a user in the /etc/shadow file is prepended with the ! character?
Correct Answer
E. The password becomes invalid which disables password based logins although other login
methods remain usable.
42.
Which of the following details can be found in an entry of a user specific crontab? (Choose TWO correct answers.)
Correct Answer(s)
C. The time when the cron job should run.
D. The command that should be started by the cron job.
Explanation
An entry in a user specific crontab contains the time when the cron job should run and the command that should be started by the cron job. The crontab allows users to schedule and automate tasks at specific times or intervals. The time field specifies when the job should be executed, and the command field specifies the command or script that should be run. The other options, such as the verbal description of the job, the syslog facility, and the user's name, are not typically included in a crontab entry.
43.
Each entry in a crontab must end with what character?
Correct Answer
D. Newline
Explanation
Each entry in a crontab must end with a newline character. This is because crontab files are read line by line, and the newline character indicates the end of a line. Without a newline character at the end of each entry, the crontab file would not be properly formatted and the cron daemon would not be able to interpret the entries correctly.
44.
To prevent a specific user from scheduling tasks with at, what should the administrator do?
Correct Answer
C. Add the specific user to /etc/at.deny file.
Explanation
The correct answer is to add the specific user to the /etc/at.deny file. This file contains a list of users who are not allowed to use the at command to schedule tasks. By adding the specific user to this file, the administrator effectively prevents them from scheduling tasks with the at command.
45.
Which of the following crontab entries will execute myscript at 30 minutes past every hour onSundays?
Correct Answer
D. 30 0-23 * * 0 myscript
Explanation
This crontab entry will execute myscript at 30 minutes past every hour on Sundays. The first field represents the minutes, the second field represents the hours, the third field represents the days of the month, the fourth field represents the months, and the fifth field represents the days of the week. In this case, "30" in the first field indicates that the script should be executed at 30 minutes past the hour, "0-23" in the second field indicates that it should be executed every hour from 0 to 23, and "0" in the fifth field indicates that it should be executed only on Sundays.
46.
Which of the following files assigns a user to its primary group?
Correct Answer
D. /etc/passwd
Explanation
The correct answer is /etc/passwd because this file contains the user account information, including the username, encrypted password, user ID, group ID, home directory, and shell. The group ID field in /etc/passwd determines the primary group for a user.
47.
Which of the following commands should be added to /etc/bash_profile in order to change the language of messages for an internationalized program to Portuguese (pt)?
Correct Answer
D. Export LC_MESSAGES=”pt”
Explanation
The correct answer is to add the command "export LC_MESSAGES=”pt”" to the /etc/bash_profile file. This command sets the LC_MESSAGES environment variable to "pt", which specifies the language of messages for internationalized programs to Portuguese.
48.
In which file, if present, must all users be listed that are allowed to use the cron schedulingsystem? (Specify the full name of the file, including path.)
Correct Answer
/etc/cron.allow
Explanation
The correct answer is /etc/cron.allow. This file, if present, lists all the users who are allowed to use the cron scheduling system. It serves as a whitelist, allowing only the specified users to schedule cron jobs. If this file is not present, all users are allowed to use the cron system by default.
49.
Which commands can be used to change a user’s account aging information? (Choose THREE correct answers.)
Correct Answer(s)
A. Usermod
B. Passwd
D. Chage
Explanation
The commands "usermod", "passwd", and "chage" can be used to change a user's account aging information. "usermod" is used to modify user account details, including aging information. "passwd" is used to change a user's password, which can also affect the account aging information. "chage" is used to change the user's password expiry information, such as setting the maximum number of days before the password must be changed.
50.
Which command is used to add an empty group to the system? (Specify ONLY the command without any path or parameters.)
Correct Answer(s)
groupadd
Explanation
The command "groupadd" is used to add an empty group to the system. This command allows the creation of a new group without any users initially assigned to it. It is commonly used in Linux operating systems to manage user groups and their permissions.