Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
A series of questions and answers related to the CompTIA LX0-104 exam, covering topics such as shells, scripting, data management, user interfaces, and desktops. The questions range from multiple choice to text completion and cover a variety of technical concepts related to Linux administration. likely to be useful for students preparing for the CompTIA LX0-104 exam or for those studying Linux administration more generally.
Typology: Exams
1 / 85
Topic 1, Shells, Scripting and Data Management QUESTION NO: 1 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 A. result: 3 4 5 6 2 1 B. result: 1 2 3 4 5 6 C. result: 6 5 4 D. result: 6 5 4 3 2 1 E. result: 3 2 1 Answer: A Explanation: QUESTION NO: 2 When the command echo $ outputs 1, which of the following statements is true? A. It is the process ID of the echo command. B. It is the process ID of the current shell.
It is the exit value of the command executed immediately before echo. D. It is the exit value of the echo command. Answer: C Explanation: QUESTION NO: 3 CORRECT TEXT What word is missing from the following SQL statement? insert into tablename (909, 'text'); (Please specify the missing word using lower-case letters only.) Answer: VALUES, values QUESTION NO: 4 Which command makes the shell variable named VARIABLE visible to subshells? A. export $VARIABLE B. export VARIABLE C. set $VARIABLE D. set VARIABLE E. env VARIABLE Answer: B Explanation:
What output will the command seq 10 produce? A. A continuous stream of numbers increasing in increments of 10 until stopped. B. The numbers 1 through 10 with one number per line. C. The numbers 0 through 9 with one number per line. D. The number 10 to standard output. Answer: B Explanation: QUESTION NO: 6 CORRECT TEXT 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.) Answer: /etc/skel QUESTION NO: 7 CORRECT TEXT What word is missing from the following SQL statement? count(*) from tablename; (Please specify the missing word using lower-case letters only.) Answer: select
After issuing: function myfunction { echo $1 $2 ; } in Bash, which output does: myfunction A B C Produce? A. A B B. A B C C. A C D. B C E. C B A Answer: A Explanation: QUESTION NO: 9 Which of the following commands puts the output of the command date into the shell variable mydate? A. mydate="$(date)" B.
mydate="exec date" C. mydate="$((date))" D. mydate="date" E. mydate="${date}" Answer: A Explanation: QUESTION NO: 10 Which of the following files, when existing, affect the behavior of the Bash shell? (Choose TWO correct answers.) A. ~/.bashconf B. ~/.bashrc C. ~/.bashdefaults D. ~/.bash_etc E. ~/.bash_profile Answer: B,E Explanation: QUESTION NO: 11 What is the difference between the commands test - e path and test - f path?
They are equivalent options with the same behaviour. B. The - f option tests for a regular file. The - e option tests for an empty file. C. Both options check the existence of the path. The - f option also confirms that it is a regular file. D. The - f option tests for a regular file. The - e option tests for an executable file. Answer: C Explanation: QUESTION NO: 12 How can the existing environment variable FOOBAR be suppressed for the execution of the script./myscript only? A. unset - v FOOBAR;./myscript B. set - a FOOBAR="";./myscript C. env - u FOOBAR./myscript D. env - i FOOBAR./myscript Answer: C Explanation: QUESTION NO: 13 When the command echo $$ outputs 12942, what is the meaning of 12942? A.
It is the process ID of the echo command. B. It is the process ID of the current shell. C. It is the process ID of the last command executed. D. It is the process ID of the last command which has been placed in the background. Answer: B Explanation: QUESTION NO: 14 What output will the following command produce? seq 1 5 20 A. 1 6 11 16 B. 1 5 10 15 C. 1 2 3 4
Answer: A Explanation: QUESTION NO: 15 Which of the following words is used to restrict the records that are returned from a SELECT SQL query based on a supplied criteria for the values in the records? A. CASE B. FROM C. WHERE D. IF Answer: C Explanation:
Which of the following commands lists all defined variables and functions within Bash? A. env B. set C. env - a D. echo $ENV Answer: B Explanation: QUESTION NO: 17 Which of the following SQL queries counts the number of occurrences for each value of the field order_type in the table orders? A. SELECT order_type,COUNT() FROM orders WHERE order_type=order_type; B. SELECT order_type,COUNT() FROM orders GROUP BY order_type; C. COUNT(SELECT order_type FROM orders); D. SELECT COUNT(*) FROM orders ORDER BY order_type; E. SELECT AUTO_COUNT FROM orders COUNT order_type; Answer: B Explanation:
What is the purpose of the file /etc/profile? A. It contains the welcome message that is displayed after login. B. It contains security profiles defining which users are allowed to log in. C. It contains environment variables that are set when a user logs in. D. It contains default application profiles for users that run an application for the first time. Answer: C Explanation: QUESTION NO: 19 CORRECT TEXT What command displays all aliases defined in the current shell? (Specify the command without any path information) Answer: alias, alias - p QUESTION NO: 20 Which of the following are requirements in order to run a shell script like a regular command from anywhere in the filesystem? (Choose THREE correct answers.) A. The user issuing the command must be in the group script. B. The script file must be found in the $PATH. C. The script file must have the executable permission bit set. D. The script must begin with a shebang-line (#!) that points to the correct interpreter.
The file system on which the script resides must be mounted with the option scripts. Answer: B,C,D Explanation: QUESTION NO: 21 Which of the following commands prints the exit value of the most recently executed program in Bash? A. echo $? B. echo$ # C. echo $exit D. echo $status E. echo $& Answer: A Explanation: QUESTION NO: 22 Which Bash option prevents a user from accidentally overwriting a file with a “>”? A. set – o safe B. set – o noglob C.
set – o noclobber D. set – o append E. set – o nooverwrite Answer: C Explanation: QUESTION NO: 23 What is true regarding the statement beginning with #! That is found in the first line of a script? A. It prevents the script from being executed until the! is removed. B. It specifies the path and the arguments of the interpreter used to run the script. C. It is a comment that is ignored by the script. D. It specifies the character encoding of the script. Answer: B Explanation: QUESTION NO: 24 Which of the following are operators used for comparison by the test command? (Choose two correct answers.) A. equals B. B. =
The batch command will run multiple times. The at command will only run once. B. The commands of a batch job run sequentially one after another while the commands in at jobs may run in parallel. C. The at command reads commands from standard input. The batch command requires a command line argument. D. The at command e-mail results to the user. The batch command logs results to syslog. Answer: B Explanation: QUESTION NO: 27 Which of the following actions prevents a specific user form scheduling tasks using at or batch? A. Add the specific user to the /etc/ at.allow file. B. Add the specific user to the [deny] section in the /etc/std.conf file. C. Add the specific user to the /etc/at.deny file. D. Add the specific user to the nojobs group. E. Run atd ––deny followed by the name of the specific user. Answer: C Explanation: QUESTION NO: 28
Which of the following commands are used to manage the environment and shell variables within a shell process? (choose two correct answers.) A. export B. init C. reset D. set E. tset Answer: A,D Explanation: QUESTION NO: 29 CORRECT TEXT 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) Answer: fi QUESTION NO: 30 Which of the following configuration files should be modified to globally set shell variables for all users? A. /etc/bashrc B.
/etc/profile C. /.bash_profile D. /etc/.bashrc Answer: B Explanation: QUESTION NO: 31 CORRECT TEXT 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.) Answer: set QUESTION NO: 32 Which of the following SQL statements will select the fields name and address from the contacts table? A. SELECT (name, address) FROM contacts; B. SELECT (name address) FROM contacts; C. SELECT name, address FROM contacts; D. SELECT name address FROM contacts; Answer: C
Explanation: Topic 2, User Interfaces and Desktops QUESTION NO: 33 Which file used by XDM specifies the default wallpaper? A. /etc/X11/xdm/Xsetup B. /etc/X11/xdm.conf C. /etc/X11/xdm/Defaults D. /etc/X11/defaults.conf Answer: A Explanation: QUESTION NO: 34 CORRECT TEXT Which command can be used to investigate the properties for a particular window in X by clicking that window? (Specify ONLY the command without any path or parameters.) Answer: /usr/bin/xwininfo, xwininfo QUESTION NO: 35 The X11 configuration file xorg.conf is grouped into sections. How is the content of the section SectionName associated with that section?
It is placed in curly brackets as in Section SectionName { ... }. B. It is placed between a line containing Section "SectionName" and a line containing EndSection. C. It is placed between the tags
How is a display manager started? A. It is started by a user using the command startx. B. It is started like any other system service by the init system. C. It is started by inetd when a remote hosts connects to the X11 port. D. It is started automatically when a X11 user logs in to the system console. Answer: B Explanation: QUESTION NO: 38 CORRECT TEXT What is the default name of the configuration file for the Xorg X11 server? (Specify the file name only without any path.) Answer: xorg.conf QUESTION NO: 39 Which of the following commands shows the current color depth of the X Server? A. xcd B. xcdepth C. xwininfo D. xcolordepth
cat /etc/X Answer: C Explanation: QUESTION NO: 40 For accessibility assistance, which of the following programs is an on-screen keyboard? A. xkb B. atkb C. GOK D. xOSK Answer: C Explanation: QUESTION NO: 41 CORRECT TEXT 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.) Answer: xdm QUESTION NO: 42 Which of the following are tasks handled by a display manager like XDM or KDM? (Choose TWO
correct answers.) A. Start and prepare the desktop environment for the user. B. Configure additional devices like new monitors or projectors when they are attached. C. Handle the login of a user. D. Lock the screen when the user was inactive for a configurable amount of time. E. Create an X11 configuration file for the current graphic devices and monitors. Answer: A,C Explanation: QUESTION NO: 43 On a machine running several X servers, how are the different instances of the X11 server identified? A. By a fixed UUID that is defined in the X11 configuration file. B. By a unique IPv6 address from the fe80: : /64 subnet. C. C. By the name of the user that runs the X server like x11 :bob. D. By a device name like /dev/X11/xservers/1. E. By a display name like: 1. Answer: E Explanation:
What is the purpose of the xhost program? A. Grant or revoke access to a X11 session. B. Install all packages and video drivers required to run X11 on a host. C. Start the X11 server and announce its availability within the local network. D. Send informational messages to all users logged into a host using X11. E. Display the MOTD and other important information when a user logs in via X11. Answer: A Explanation: QUESTION NO: 45 What of the following statements is true regarding a display manager? A. A display manager handles remote X11 logins only and has no purpose on a system that is not attached to a network. B. The display manager is configured in the X11 configuration file xorg.conf. C. There is only one display manager X11Dm that must be started on all systems running X11. D. After system startup, the display manager handles the login of a user. E. Without a display manager, no graphical programs can be run.
Answer: D Explanation: QUESTION NO: 46 Which of the following statements is true regarding the /etc/shadow file? A. /etc/shadow may not be readable or writable by user root. B. Only root is allowed to read and write /etc/shadow. C. All users have full read and write access to /etc/shadow. D. All users have full read access to /etc/shadow. Answer: B Explanation: QUESTION NO: 47 What is the purpose of the sticky keys feature in X? A. To assist users who have difficulty holding down multiple keys at once. B. To prevent repeated input of a single character if the key is held down. C. To ignore brief keystrokes according to a specified time limit. D. To repeat the input of a single character. Answer: A
Explanation: Topic 3, Administrative Tasks QUESTION NO: 48 Which of the following steps prevents a user from obtaining an interactive login session? A. Run the command chsh - s /bin/false with the user name. B. Set the UID for the user to 0. C. Remove the user from the group staff. D. Add the user to /etc/noaccess. E. Create a .nologin file in the user's home directory. Answer: A Explanation: QUESTION NO: 49 CORRECT TEXT Which file specifies the user accounts that can NOT submit jobs via at or batch? (Provide the full path and filename) Answer: /etc/at.deny QUESTION NO: 50
Which character in the password field of /etc/passwd is used to indicate that the encrypted password is stored in /etc/shadow? A.
B.
C. s D. x Answer: D Explanation: QUESTION NO: 51 CORRECT TEXT The system's timezone may be set by linking /etc/localtime to an appropriate file in which directory? (Provide the full path to the directory, without any country information) Answer: /usr/share/zoneinfo/ QUESTION NO: 52 Which of the following fields are available in both the global /etc/crontab file as well as in user- specific crontab files? (Select TWO correct answers) A. Year B. Minute C. Username D.