Linux – Multiple Choice Questions – MCQ – 241 to 270 Questions with Explanation

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'”

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?


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

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?


Answer – – D
Description – The address is a class C address between the ranges of and

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?


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.

For Linux MCQ 271 – 300 | 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