Linux - Multiple Choice question 2
Linux – Multiple Choice Questions
241. Which option corrects some spelling mistakes when changing directories?
A. cdspell
B. cdvar
C. cdspchk
D. spellcd
Answer – – A
Description – The cdspell shell option can fix some spelling mistakes when changing directories. The other Answer –s are invalid.
242. To make the shell script named sortdoc executable by only the user, you would type ___________________.
Answer – – chmod u+x sortdoc.
Description – You must set the script as executable before a user can run it.
243. Enter the command that is used to delete five lines of text in vi: _______________
Answer – – 5dd.
244. If NUMBER is set to 4, what will be the result of the following? echo “‘$NUMBER'”
A. $NUMBER
B. ‘$NUMBER’
C. 4
D. ‘4’
Answer – – D
Description – The double quotes around the variable cause it to be translated to its value. The forward ticks are displayed literally. Remember that back ticks (`) are used for command substitution.
245. Which variable tells you the history number of the current command?
A. HISTORY
B. HISTCMD
C. HISTNUM
D. HISTCTRL
Answer – – B
Description – The HISTCMD variable holds the command number for the current command. All of the other Answer –s are invalid.
246. To put the date in the prompt, which string would you add?
A. \D
B. /d
C. /D
D. \d
Answer – – D
Description – The other Answers are invalid.
247. Given the following commands, which directory will the user be taken to, assuming that there is a Jason directory off each one?
debian:~# CDPATH=/documents:/shared:/music
debian:~# cd Jason
A. /documents/Jason
B. /shared/Jason
C. /music/Jason
D. ~/Jason
Answer – – A
Description – The cd command will go through each directory in the CDPATH variable, and change to the first correct one found.
248. If you want to clean up a directory every time you log out, you would edit the ________ file.
Answer – – .bash_logout.
Description – This file is executed each time a user logs out.
249. Which set option will keep you from accidentally overwriting an existing file with file redirection?
A. nowrite
B. noclobber
C. noklobber
D. nonuke
Answer – – B
Description – By enabling this option, you can prevent accidentally overwriting a file when redirecting text.
250. Which parameter is used to enable an option with set?
A. +s
B. -s
C. +o
D. -o
Answer – – D
Description – Remember that -o enables an option, while +o disables the option.
251. The first line of a script file for the /bin/bash shell should be ____________.
Answer – – #!/bin/bash.
Description – This line specifies the command interpreter to use for the script.
252. Which test parameter returns true if a string is 0 bytes long?
A. -z
B. -n
C. -s
D. -0
Answer – – A
Description – The -n test checks to see if a string is non-zero in length. The -s parameter tests to see a file exists and has a size greater than 0. There is no -0 test.
253. Which scripting clause matches a string to a pattern?
A. case
B. if/else
C. for loop
D. while loop
Answer – – A
Description – The case clause matches patterns, while the other clauses test expressions for true or false.
254. Which command moves five lines of text into a vi buffer named a?
A. a5dd
B. A5dd
C. “a5dd
D. “add5
Answer – – C
Description – The command must start with a ” symbol, and the buffer name is case sensitive.
255. Which metacharacter matches any single character?
A. .
B. *
C. ?
D. ,
Answer – – A
Description – The period matches any single character. The * will match multiple characters. The other Answers are invalid.
256. To find the next instance of the character B after the cursor in vi, you would enter _________________.
Answer – – fB.
257. Which variable sets the mail check time to be every 10 minutes?
A. MAIL=10
B. MAIL=600
C. MAILCHECK=10
D. MAILCHECK=600
Answer – – D
Description – The MAILCHECK variable defines how often to check for new mail in seconds. The MAIL variable stores the filename to check for new mail.
258. Which of the following is an example of a class C network address?
A. 10.254.90.135
B. 172.16.98.42
C. 255.255.255.255
D. 192.168.90.131
Answer – – D
Description – The address 192.168.90.131 is a class C address between the ranges of 192.0.0.0 and 223.0.0.0.
259. The _____________ is used to separate the network ID from the host ID in a TCP/IP address.
Answer – – subnet mask.
Description – The subnet mask is anded with the IP address to provide the network ID and the host ID.
260. How many available network IDs are provided by 12 binary bits?
A. 254
B. 4,094
C. 4,096
D. 65,534
Answer – – B
Description – There are 4,094 available network IDs provided by 12 bits. The formula for calculation is 212 – 2.
261. Which protocol provides connection-oriented delivery of packets using sessions?
A. IP
B. ARP
C. TCP
D. UDP
Answer – – C
Description – The TCP protocol is connection-oriented, using sessions to provide reliable transfer of packets.
262. By default, SMTP operates on which port?
A. 21
B. 23
C. 25
D. 119
Answer – – C
Description – By default, SMTP operates on port 25.
263. The ___________ protocol provides IP address–to–hardware address translation.
Answer – – ARP
Description – ARP provides hardware address–to–IP address mapping and translation.
264. Which command is used to upload a file from the local machine to a remote FTP server?
A. put
B. cp
C. mv
D. place
Answer – – A
Description – The put command is used to upload files to an FTP server.
265. Which utility allows you to view the domain name of the specified IP address?
A. hostname
B. domainname
C. dnsdomainname
D. host
Answer – – D
Description – The host utility allows you to view the host and domain name when an IP address is entered.
266. The _____________ utility provides information about the path of data between a local and remote host.
Answer – – traceroute
Description – The traceroute utility displays every hop between the local and remote hosts.
267. Which utility provides contact and name server information about the specified domain?
A. finger
B. host
C. nameserver
D. whois
Answer – – D
Description – The whois utility provides information about the registration, name servers, and contacts for the specified domain.
268. A Linux machine can provide DHCP configuration information to other hosts when running which application?
A. dhcpd
B. dhcpcd
C. bootproto
D. dhcp
Answer – – A
Description – The dhcpd daemon allows a Linux server to provide DHCP information to clients.
269. Which utility is used to change the IP address of a network interface?
A. ipconfig
B. ifconfig
C. hostname
D. netstat
Answer – – B
Description – The ifconfig utility is used to change the IP address of a network interface. The ipconfig utility is used by Windows-based systems.
270. Which two utilities can be used to view the routing table?
A. netstat
B. traceroute
C. route
D. ifconfig
Answer – – A and C
Description – The routing table can be viewed using the route command and using netstat -r.
271. On a Debian system, which file contains the hostname of the local machine?
A. /etc/hosts
B. /etc/HOSTS
C. /etc/hostname
D. /etc/HOSTNAME
Answer – – D
Description – Debian systems use the /etc/HOSTNAME file to store the hostname of the local machine. The /etc/hostname file is used by Red Hat.
272. Which file contains the name servers to be used by the local machine for hostname resolution?
A. /etc/hosts
B. /etc/resolv.conf
C. /etc/services/
D. /etc/network/interfaces
Answer – – B
Description – The /etc/resolv.conf file contains the domain search listing and the name servers to use for hostname resolution.
273. Which of the following is a correct entry in the /etc/hosts file?
A. deedee 10.254.90.135/ip
B. nameserver 10.254.90.131
C. search the-nashes.net
D. 10.254.90.135 deedee.the-nashes.net
Answer – – D
Description – Entries in the /etc/hosts file contain an IP address followed by the corresponding hostname.
274. Chat scripts are used to perform which of the following functions?
A. Specify connection device
B. Configure a PPP connection
C. Establish a PPP connection
D. Specify idle timeout of a PPP connection
Answer – – C
Description – Chat scripts are used to establish a PPP connection; pppd is used to configure the connection.
275. The pppd application must receive its IP address via DHCP.
A. True
B. False
Answer – – B
Description – pppd can utilize either static or dynamic IP addresses.
276. Which of the following is NOT a valid option of the pppd command?
A. reconnect
B. connect
C. disconnect
D. holdoff
Answer – – A
Description – reconnect is not a valid option of pppd.
277. Which of the following utilities is used to stop a network interface?
A. ifconfig
B. netstat
C. down
D. stop
Answer – – A
Description – The ifconfig utility is used to stop a network interface.
278. Which socket type is used in inetd.conf when the service uses TCP?
A. dgram
B. stream
C. raw
D. rdm
Answer – – B
Description – The stream type is always used with TCP, and dgram is used with UDP.
279. The inetd.conf file is read every 30 seconds by inetd to look for configuration changes.
A. True
B. False
Answer – – B
Description – Any time the inetd.conf file is changed, inetd needs to be restarted for the changes to take effect.
280. The account used for anonymous FTP should have which shell?
A. /bin/bash
B. /bin/csh
C. /bin/false
D. /bin/ksh
Answer – – C
Description – Anonymous FTP accounts should not have a valid shell statement in /etc/passwd. This limits login to FTP only.
281. Which entry in ftpaccess limits the number of failed password attempts?
A. loginfails
B. loginlimit
C. badpw
D. pwattempts
Answer – – A
Description – If a user exceeds the limit set by loginfails, they are disconnected.
282. Which tool is used to see who is logged in to your FTP server?
A. ftpstats
B. whoftp
C. ftpd -w
D. ftpwho
Answer – – D
Description – The ftpwho command shows who is connected to the FTP server.
283. What needs to be done to create a new mail alias for a user? (Choose all that apply.)
A. Add the alias to /etc/aliases.
B. Add the alias to /etc/mailboxes.
C. Run the newaliases command.
D. Run the addalias command.
Answer – – A and C
Description – Mail aliases are stored in /etc/aliases. Any time an entry is added the newaliases command needs to be run.
284. The _______ command is used to list messages currently in the mail queue.
Answer – – mailq.
Description – The mailq command shows any messages waiting in the queue as well as any errors that may keep them from being delivered.
285. To make your Web server perform the best, it should be run via inetd.
A. True
B. False
Answer – – B
Description – Only run Apache through inetd for a Web server that expects very few hits. The overhead of starting the Apache daemon every time a client connects severely impacts performance.
286. What needs to be done to run httpd through inetd? (Choose all that apply.)
A. Change the port number specified in httpd.conf.
B. Change the ServerType directive in httpd.conf.
C. Add an entry to inetd.conf for httpd.
D. Run inetd -d /usr/sbin/httpd.
Answer – – B and C
Description – An entry needs to be added to the inetd.conf file so that inetd knows to start the service when a user connects. The ServerType entry needs to be set correctly in httpd.conf so that Apache knows not to keep running when a connection completes.
287. By default Apache uses the /etc/passwd file for user authentication.
A. True
B. False
Answer – – B
Description – Apache uses a file created by htpasswd.
288. Which entry or entries in /etc/exports will share the /home directory only to users on the 192.168.10.0/24 network, which is made up of the domain mydomain.org?
A. /home 192.168.10.0 – 254(rw)
B. /home 192.168.10.0/24(ro)
C. /home *.mydomain.org(rw)
D. /home ANY.mydomain.org(rw)
Answer – – B and C
Description – Restrictions can be set using CIDR notation or using wildcards with domains.
289. After editing the /etc/exports file, the _______ command should be run (no parameters).
Answer – – exportfs.
Description – The exportfs command is used to display and change the currently exported directories.
290. Which smb.conf entry sets the Windows NT domain for Samba?
A. workgroup
B. domain
C. nt_domain
D. MS_DOMAIN
Answer – – A
Description – The workgroup entry sets both the workgroup name and the Windows NT domain name.
291. Which command(s) shows all the files on a Windows share using smbclient?
A. dir
B. list
C. cp
D. ls
Answer – – A and D
Description – Both dir and ls can be used to list files. The other Answers are invalid.
292. BIND v4 uses the _____ configuration file.
A. named.boot
B. named.conf
C. named.cf
D. conf.named
Answer – – A
Description – BIND v4 uses named.boot while BIND v8 uses named.conf.
293. Which DNS resource record is used to reverse map IP addresses to names?
A. A
B. MX
C. SRV
D. PTR
Answer – – D
Description – The PTR record is used for reverse queries.
294. Which DNS resource record shows the hosts that provide services?
A. SRV
B. LOC
C. A
D. CNAME
Answer – – A
Description – The SRV record shows which hosts provide certain services. The LOC record shows the physical location of a host.
295. Which field should be put at the front of the hosts entry in the nsswitch.conf file to have the system check /etc/hosts first?
A. files
B. NIS
C. dns
D. yp
Answer – – A
Description – The files entry tells the system to check /etc/hosts first. The dns entry specifies when to check with a DNS server.
296. Which mail server has the highest priority?
A. IN MX 10 mail
B. IN MX 20 mail
C. IN MX 100 mail
D. IN MX 0 mail
Answer – – D
Description – The lower the number set in the MX record, the higher the priority for the mail server.
297. Which file is displayed to users before they log in to a system via Telnet?
A. /etc/issue
B. /etc/login.net
C. /etc/motd.net
D. /etc/issue.net
Answer – – D
Description – The /etc/issue.net file is shown to local users before they log in.
298. Which would allow users from somedomain.org to access your FTP server?
A. hosts.allow: in.ftpd : ANY
B. hosts.deny: ftpd : ALL EXCEPT somedomain.org
C. hosts.allow: in.ftpd : somedomain.org
D. hosts.deny: in.ftpd : ALL
Answer – – C
Description – Option A is incorrect because to allow all hosts you must use the ALL wildcard, not ANY. Choice B specifies the wrong daemon name. Choice D denies all hosts from connecting to the FTP server.
299. Which service cannot be used with TCP wrappers?
A. SSH
B. Telnet
C. tftp
D. HTTP
Answer – – C
Description – tftp uses UDP, and TCP wrappers can be used only with TCP applications.
300. Which tool is used to check the logic of your TCP wrapper rules?
A. tcpdmatch
B. tcpwmatch
C. tcpdtest
D. tcpwquery
Answer – – A
Description – The other options are invalid.
301. Which tool can be used to see if a package has been tampered with?
A. verify
B. md5
C. integ
D. md5sum
Answer – – D
Description – The other commands are invalid.
302. Which commands would you run to create a shared directory named Share?
A. mkdir Share
B. chmod 770 Share
C. chmod u+s Share
D. chmod g+s Share
Answer – – A, B and D
Description – You must create the directory, set the proper permissions, and set the SGID bit.
303. Which entry in .rhosts allows user Angie from the host named deedee?
A. deedee +Angie
B. Angie deedee
C. +Angie deedee
D. deedee Angie
Answer – – D
Description – The format is HOST USER. An optional + sign can be used to enable a host.
304. Which of the following creates a large security risk in hosts.equiv?
A. +
B. !
C. ALL
D. ANY
Answer – – A
Description – By just putting the + sign, you allow any host to connect.
305. Which command copies the file /doc/MyDoc from the system webserver to a local file named MyNewDoc?
A. rcp MyNewDoc webserver:/doc/MyDoc
B. rpc webserver:/doc/MyDoc MyNewDoc
C. rcp webserver:/doc/MyDoc MyNewDoc
D. rpc webserver:/doc/MyDoc MyNewDoc
Answer – – C
Description – The syntax for Choice A is incorrect. The other options are invalid.
306. Which port is used by SSH?
A. 22
B. 23
C. 19
D. 53
Answer – – A
Description – Telnet uses port 23, and DNS uses port 53.
307. Which entry in sshd_config restricts root from a remote system?
A. LoginRootPermit
B. PermitRootLogin
C. NoRootLogin
D. DenyRootLogin
Answer – – B
Description – Unless this option is enabled, the root user will never be allowed to log in. The other options are invalid.
308. Which entry in sshd_config allows the use of .rhosts?
A. AllowRhosts
B. RhostsAllow
C. RSAAuthentication
D. RhostsAuthentication
Answer – – D
Description – This option can be used to support older style rhosts files that may already be on the system.
309. Which option causes ssh to use a different user name?
A. -l
B. -L
C. -u
D. -U
Answer – – A
Description – The -L option is used to specify a listening port.
310. Which command lists all keys being represented by ssh-agent?
A. ssh-agent -l
B. ssh-add -l
C. ssh-agent -L
D. ssh-add -L
Answer – – B
Description – The -L option lists all public keys.
311. Which tool converts the group file to use shadow passwords?
A. grpconv
B. groupconv
C. groupcv
D. grpconvert
Answer – – A
Description – The other options are invalid.
312. Which command clears the Input chain of rules?
A. ipchains -C input
B. ipchains -F input
C. ipchains -F ALL
D. ipchains -P input
Answer – – B
Description – The -C option is used to check a packet against the selected chain. The ALL chain is invalid. The -P option is used to set the policy for the specified chain.
313. Which command shows all of the current rules?
A. ipchains -L
B. ipchains -l
C. ipchains -S
D. ipchains -s
Answer – – A
Description – The -l option is used to enable kernel logging. The -S option is used to change the timeout for masquerading. The -s option specifies the source.
314. Which type of PAM module queries the user for a password?
A. password
B. session
C. account
D. auth
Answer – – D
Description – The password module is used to change authentication tokens.
315. Which command limits the amount of CPU time a user can use to 60 minutes?
A. ulimit -C 3600
B. ulimit -t 3600
C. ulimit -C 1h
D. ulimit -t 1h
Answer – – B
Description – The time must be specified in seconds. The -C option is invalid.
316. Which tool monitors for file changes?
A. Nessus
B. crack
C. Tripwire
D. nmap
Answer – – C
Description – Tripwire performs several checks to make sure files have not been tampered with.
317. SSH provides security against bad passwords.
A. True
B. False
Answer – – B
Description – SSH encrypts the connection between systems. It does not stop someone from guessing a badly chosen password.
318. Which of the following would cause cmd2 to be run independently of cmd1?
A. cmd1 ; cmd2
B. cmd1 | cmd2
C. cmd1 >> cmd2
D. cmd1 > cmd2
Answer – – A
Description – Choice A would run cmd1 and then cmd2 regardless of the output of cmd1. Choice B would run cmd1 sending the output to cmd2. Choice C would append the output of cmd1 to the file cmd2. Choice D would send the output of cmd1 to the file cmd2.
319. _____________ is the default signal number used with the kill command.
Answer – – 15
Description – The default signal used with the kill command is 15, sigterm.
320. The updatedb command is used to update the information searched by which command?
A. grep
B. find
C. locate
D. whois
Answer – – C
Description – Choice A, the grep utility, searches files for the specified expression. Choice B, the find utility, searches directories for files. Choice C, the locate utility, searches the slocate database. This database is updated using the updatedb command. Choice D does not search for files.
320. Which command is used to change the priority of a command as it is run?
A. job
B. nice
C. renice
D. top
Answer – – B
Description – Choice A, the job utility, is used to view backgrounded processes. Choice B, nice, is used to change the priority of a process as it is run. Choice C, renice, is used to change the priority of a process before it is run. Choice D, top, is used to view process information.
321. Which command would be used to produce the following permissions? -rw-rw-r– myfile
A. chown myfile
B. chmod 661 myfile
C. chmod 331 myfile
D. chmod 664 myfile
Answer – – D
Description – Choice A would change the ownership of myfile if the userid of the new owner were specified. Choice B would change the permissions of my file to -rw-rw—x. Choice C would change the permissions on myfile to –wx-wx–x. Choice D would change the permissions on myfile to -rw-rw-r–.
322. Which file is used to specify a user’s home directory?
A. /etc/passwd
B. /etc/skel
C. /etc/profile
D. /etc/bashrc
Answer – – A
Description – The /etc/passwd file contains the user’s home directory settings. Choice B, /etc/skel, contains files that are copied to all users’ home directories. Choice C, /etc/profile, contains systemwide environment settings. Choice D, /etc/bashr, contain global bash settings.
323. _____________ is used to view jobs scheduled to run at regular intervals.
Answer – – crontab
Description – The crontab command is used to view jobs scheduled to run using crond.
324. Which command will search the file editorial for all occurrences of the word lady and replace them with Lady?
A. sed -a s/lady/Lady editorial
B. tr l,L editorial
C. sed ‘s/lady/Lady/’ editorial
D. grep ‘lady’ editorial | tr Lady
Answer – – C
Description – Choice A does not follow the correct syntax for the sed command. Choice B would locate all instances of the letter l and replace them with L. Choice C would search for the word lady and replace it with Lady. Choice D would search for the word lady but would pipe it to the tr utility, not replace lady with Lady.
325. Which command allows you to view system resource usage in real time?
A. nice
B. renice
C. ps -aux
D. top
Answer – – D
Description – Choice A, nice, is used to set the priority of a process when it is run. Choice B, renice, would change the priority of a process after it has been run. Choice C, ps -aux, would view a snapshot of all running processes. Choice D, top, displays a real-time view of processes.
326. Which file contains a list of currently mounted file systems?
A. /etc/proc/
B. /mnt
C. /etc/fstab
D. /etc/mtab
Answer – – D
Description – Choice A, /etc/proc/, is not valid. Choice B, /mnt, is simply a directory. Choice C, /etc/fstab, contains a listing of file systems that can be mounted at boot. Choice D, /etc/mtab, contains a listing of all currently mounted file systems.
327. Which allows an environment variable declaration to be used system-wide?
A. echo
B. export
C. cat
D. env
Answer – – B
Description – Choice A, echo, can be used to view the assignment of environment variables. Choice B, export, makes the environment variable assignment available system-wide. Choice C, cat, is used to view the contents of a file. Choice D, env, is used to view all environment variables declared on the system.
328. Which command would move the file and directory contents of the /ME directory to the /YOU directory?
A. mv -a /ME /YOU
B. cp /ME/* /YOU/* ; rm -r /ME/*
C. mv /ME/* /YOU/*
D. cp -r /ME/* /YOU ; rm -r /ME
Answer – – D
Description – Choice A uses an incorrect option for the mv command. Choice B would copy all files from /ME to /YOU and delete /ME, but directories would not be copied. Choice C would produce a syntax error because the last argument when moving a directory must be a directory name. Choice D would recursively copy the files and directories in /ME to /YOU, after which they would be deleted from /ME.
329. What command would produce a file named xmaslist using the contents of the list file, arranging the contents alphabetically and numbering each line?
A. fmt list > xmaslist
B. sort list | nl > xmaslist
C. ln list | sort | xmaslist
D. sort list | ln | xmaslist
Answer – – B
Description – Choice A would create the xmaslist file from the contents of the list file while trying to create each line of the same length. Choice B would alphabetize the list, then number it and send the output to the xmaslist file. Choices C and D would produce errors because the ln command and the pipes are used incorrectly.
330. Which of the following commands would kill the process 1234 without giving it a chance to gracefully exit?
A. kill %1234
B. kill -now 1234
C. kill -9 1234
D. kill -12 1234
Answer – – C
Description – Only Choice C is correct. The -9 signal is used to kill a process without allowing it to end gracefully. The default signal, used with Answer – A, is -15, sigterm, the -now signal is not valid, and the -12 option is sigusr2.