Linux – Multiple Choice Questions – MCQ – 301 to 330 Questions with Explanation

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.

For Linux MCQ 331 – 360 | Main Linux MCQ Page

You may also like:

Sarcastic Writer

Step by step hacking tutorials about wireless cracking, kali linux, metasploit, ethical hacking, seo tips and tricks, malware analysis and scanning.

Related Posts