Linux MCQ-01: Linux Command-Line Tools

The assessment test is an excellent way to test yourself before starting to study. It gives you an idea of where you should start and why.

In an assessment test, test your current skills from beginning to advance lever for any subject or topic to check “what do you know and from where you should start learning?”

Here I have put some basic questions for Linux assessment, so you can test your Linux skill and choose right path for Linux Learning.

Questions

1.    Which of the following commands is implemented as an internal command in bash?

  1. cat
  2. echo
  3. tee
  4. sed

2.    How does man display information by default on most Linux systems?

  1. Using a custom X-based application
  2. Using the Mozilla web browser
  3. Using the less pager
  4. Using the Vi editor

3.    You want to store the standard output of the ifconfig command in a text file (file.txt) for future reference, and you want to wipe out any existing data in the file. How would you do so?

  1. ifconfig < file.txt
  2. ifconfig >> file.txt
  3. ifconfig > file.txt
  4. ifconfig | file.txt

4.    You type echo $PROC and the computer replies Go away. What does this mean?

  1. No currently running processes are associated with your shell, so you may log out without terminating them.
  2. The remote computer PROC is not accepting connections; you should contact its administrator to correct the problem.
  3. Your computer is handling too many processes; you must kill some of them to regain control of the computer.
  4. You, one of your configuration files, or a program you’ve run has set the $PROC environment variable to Go away.

5.    You type a command into bash and pass a long filename to it, but after you enter the command, you receive a File not found error message because of a typo in the filename. How might you proceed?

  1. Retype the command and be sure you type the filename correctly, letter by letter.
  2. Retype the command, but press the Tab key after typing a few letters of the long filename to ensure that the filename is entered correctly.
  3. Press the up arrow key and use bash’s editing features to correct the typo.
  4. Any of the above.

6.    Which of the following commands will print lines from the file test.txt that matches to changes and changed?

  1. grep change[ds] test.txt
  2. sed change[d-s] test.txt
  3. od “change’d|s’” test.txt
  4. cat test.txt changes changed

7.    What programs might you use to learn what your system’s load average is? [select all that apply.]

  1. ld
  2. load
  3. top
  4. uptime

8.    What program would you use to display the end of a configuration file?

  1. uniq
  2. cut
  3. tail
  4. wc

9.    Which of the following commands will number the lines in example.txt? [Select all that apply.]

  1. fmt example.txt
  2. nl example.txt
  3. cat -b example.txt
  4. cat -n example.txt

10.    How would you remove two lines of text from a file using Vi?

  1. In command mode, position the cursor on the first line and type 2dd
  2. In command mode, position the cursor on the last line and type 2yy
  3. In insert mode, position the cursor at the start of the first line, hold the Shift key down while pressing the down arrow key twice, and hit the Delete key on the keyboard.
  4. In insert mode, position the cursor at the start of the first line and press Ctrl+K twice.

11.    Which of the following regular expression will match the string dig and dug but not dog?

  1. d.g
  2. d[iu]g
  3. d[i-u]g
  4. di*g

12.    Which of the following commands creates a display of processes, showing the parent/child relationship through links between their names?

  1. ps –forest
  2. ps aux
  3. ps -e
  4. All of the above

13.    What is the effect of the following command?

         $ myprog  &>  input.txt

  1. Standard error to myprog is taken from input.txt.
  2. Standard input to myprog is taken from input.txt.
  3. Standard input and standard error from myprog are written to input.txt.
  4. All of the above.

14.    How many commands can you pipe together at once?

  1. 2
  2. 3
  3. 4
  4. An arbitrary number

15.    Which of the following commads will change all occurrences of dog in the file pets.txt

  1. sed -s “dog” “mutt” pets.txt
  2. grep -s “dog||mutt” pets.txt
  3. sed ‘s/dog/mutt/’ pets.txt
  4. cat pets.txt | grep -c “dog” “mutt”

16.    You use top to examine the CPU time being consumed by various processes on your system. You discover that one process, dfcomp, is consuming over 90 percent of your system’s CPU time. What can you conclude?

  1. Very little; dfcomp could be legitimately consuming that much CPU time or it could be an unauthorized or malfunctioning program.
  2. No program should consume 90 percent of a variable CPU time; dfcomp is clearly malfunctioning and should be terminated.
  3. This is normal; dfcomp is the kernel’s main scheduling process, and it consumes any unused CPU time.
  4. This behavior is normal if your CPU is less powerful than a 1.5 GHz Pentium 4, but on newer system, no program should consume 90 percent of CPU time.

17.    Which two of the following commands are equivalent to one another? [Select two.]

  1. nice –value 10 crunch
  2. nice -n -10 crunch
  3. nice -10 crunch
  4. nice crunch

18.    Which of the following are restrictions on ordinary user’s abilities to run renice ? [Select all that apply.]

  1. Users may not modify the priorities of processes  that are already running.
  2. Users may not modify the priorities of other user’s processes.
  3. Users may not decrease the priority (that is, increase the priority value) of their own processes.
  4. Users may not increase the priority (that is , decrease the priority value) of their own processes.

19.    What is the effect of the following command?

         $ pr example.txt | lpr

  1. The file example.txt is formatted for printing and sent to the lpr program.
  2. The files example.txt and lpr are combined together into one file and sent to standard output.
  3. Tabs are converted to spaces in example.txt and the result is saved in lpr.
  4. None of the above.

20.    A user types kill -9 12345 at a bash prompt. What is the probable intent, assuming the user typed the correct command?

  1. To cut off a network connection using TCP port 12345
  2. To display the number of processes that have been killed with signal 12345 in the last nine days.
  3. To cause a server with process ID 12345 to reload its configuration file
  4. To terminate a misbehaving or hung program with process ID 12345

Answers

1.   b

2.   c

3.   c

4.   d

5.   d

6.   a

7.    c, d

8.   c

9.   b, c, d

10.   a

11.   b

12.   a

13.   c

14.   d

15.   c

16.   a

17.   c, d

18.   b, d

19.   a

20.   d

The assessment test is an excellent way to test yourself before starting to study. It gives you an idea of where you should start and why.

In an assessment test, test your current skills from beginning to advance lever for any subject or topic to check “what do you know and from where you should start learning?”

Here I have put some basic questions for Linux assessment, so you can test your Linux skill and choose right path for Linux Learning.

Questions

1.    Which of the following commands is implemented as an internal command in bash?

  1. cat
  2. echo
  3. tee
  4. sed

2.    How does man display information by default on most Linux systems?

  1. Using a custom X-based application
  2. Using the Mozilla web browser
  3. Using the less pager
  4. Using the Vi editor

3.    You want to store the standard output of the ifconfig command in a text file (file.txt) for future reference, and you want to wipe out any existing data in the file. How would you do so?

  1. ifconfig < file.txt
  2. ifconfig >> file.txt
  3. ifconfig > file.txt
  4. ifconfig | file.txt

4.    You type echo $PROC and the computer replies Go away. What does this mean?

  1. No currently running processes are associated with your shell, so you may log out without terminating them.
  2. The remote computer PROC is not accepting connections; you should contact its administrator to correct the problem.
  3. Your computer is handling too many processes; you must kill some of them to regain control of the computer.
  4. You, one of your configuration files, or a program you’ve run has set the $PROC environment variable to Go away.

5.    You type a command into bash and pass a long filename to it, but after you enter the command, you receive a File not found error message because of a typo in the filename. How might you proceed?

  1. Retype the command and be sure you type the filename correctly, letter by letter.
  2. Retype the command, but press the Tab key after typing a few letters of the long filename to ensure that the filename is entered correctly.
  3. Press the up arrow key and use bash’s editing features to correct the typo.
  4. Any of the above.

6.    Which of the following commands will print lines from the file test.txt that matches to changes and changed?

  1. grep change[ds] test.txt
  2. sed change[d-s] test.txt
  3. od “change’d|s’” test.txt
  4. cat test.txt changes changed

7.    What programs might you use to learn what your system’s load average is? [select all that apply.]

  1. ld
  2. load
  3. top
  4. uptime

8.    What program would you use to display the end of a configuration file?

  1. uniq
  2. cut
  3. tail
  4. wc

9.    Which of the following commands will number the lines in example.txt? [Select all that apply.]

  1. fmt example.txt
  2. nl example.txt
  3. cat -b example.txt
  4. cat -n example.txt

10.    How would you remove two lines of text from a file using Vi?

  1. In command mode, position the cursor on the first line and type 2dd
  2. In command mode, position the cursor on the last line and type 2yy
  3. In insert mode, position the cursor at the start of the first line, hold the Shift key down while pressing the down arrow key twice, and hit the Delete key on the keyboard.
  4. In insert mode, position the cursor at the start of the first line and press Ctrl+K twice.

11.    Which of the following regular expression will match the string dig and dug but not dog?

  1. d.g
  2. d[iu]g
  3. d[i-u]g
  4. di*g

12.    Which of the following commands creates a display of processes, showing the parent/child relationship through links between their names?

  1. ps –forest
  2. ps aux
  3. ps -e
  4. All of the above

13.    What is the effect of the following command?

         $ myprog  &>  input.txt

  1. Standard error to myprog is taken from input.txt.
  2. Standard input to myprog is taken from input.txt.
  3. Standard input and standard error from myprog are written to input.txt.
  4. All of the above.

14.    How many commands can you pipe together at once?

  1. 2
  2. 3
  3. 4
  4. An arbitrary number

15.    Which of the following commads will change all occurrences of dog in the file pets.txt

  1. sed -s “dog” “mutt” pets.txt
  2. grep -s “dog||mutt” pets.txt
  3. sed ‘s/dog/mutt/’ pets.txt
  4. cat pets.txt | grep -c “dog” “mutt”

16.    You use top to examine the CPU time being consumed by various processes on your system. You discover that one process, dfcomp, is consuming over 90 percent of your system’s CPU time. What can you conclude?

  1. Very little; dfcomp could be legitimately consuming that much CPU time or it could be an unauthorized or malfunctioning program.
  2. No program should consume 90 percent of a variable CPU time; dfcomp is clearly malfunctioning and should be terminated.
  3. This is normal; dfcomp is the kernel’s main scheduling process, and it consumes any unused CPU time.
  4. This behavior is normal if your CPU is less powerful than a 1.5 GHz Pentium 4, but on newer system, no program should consume 90 percent of CPU time.

17.    Which two of the following commands are equivalent to one another? [Select two.]

  1. nice –value 10 crunch
  2. nice -n -10 crunch
  3. nice -10 crunch
  4. nice crunch

18.    Which of the following are restrictions on ordinary user’s abilities to run renice ? [Select all that apply.]

  1. Users may not modify the priorities of processes  that are already running.
  2. Users may not modify the priorities of other user’s processes.
  3. Users may not decrease the priority (that is, increase the priority value) of their own processes.
  4. Users may not increase the priority (that is , decrease the priority value) of their own processes.

19.    What is the effect of the following command?

         $ pr example.txt | lpr

  1. The file example.txt is formatted for printing and sent to the lpr program.
  2. The files example.txt and lpr are combined together into one file and sent to standard output.
  3. Tabs are converted to spaces in example.txt and the result is saved in lpr.
  4. None of the above.

20.    A user types kill -9 12345 at a bash prompt. What is the probable intent, assuming the user typed the correct command?

  1. To cut off a network connection using TCP port 12345
  2. To display the number of processes that have been killed with signal 12345 in the last nine days.
  3. To cause a server with process ID 12345 to reload its configuration file
  4. To terminate a misbehaving or hung program with process ID 12345

Answers

1.   b

2.   c

3.   c

4.   d

5.   d

6.   a

7.    c, d

8.   c

9.   b, c, d

10.   a

11.   b

12.   a

13.   c

14.   d

15.   c

16.   a

17.   c, d

18.   b, d

19.   a

20.   d

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Related Articles