0% found this document useful (0 votes)
28 views5 pages

Questions - PDNA - Sequence - Lec 7

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views5 pages

Questions - PDNA - Sequence - Lec 7

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Chapter 7 | Linux

Multiple-Choice Questions:
1. What does the "wc" command do?

a) Prints newline, word, and byte counts for each file

b) Sorts the content of a file alphabetically

c) Removes duplicated lines from a file

d) Compares the contents of two files and outputs the differences

2. Which option prints the character counts using the "wc" command?

a) -m

b) -c

c) -l

d) -w

3. The "sort" command is used to:

a) Reorder the content of a file alphabetically

b) Remove duplicated lines from a file

c) Compare the contents of two files and output the common entries

d) Display the differences between two files

4. Which command removes duplicated lines from a file?

a) uniq

b) join

c) diff

d) cut

5. The "join" command is used to:

a) Reorder the content of a file alphabetically

b) Remove duplicated lines from a file

c) Compare the contents of two files and output the common entries

d) Display the differences between two files

6. The "diff" command is used to:


a) Reorder the content of a file alphabetically

b) Remove duplicated lines from a file

c) Compare the contents of two files and output the common entries

d) Display the differences between two files

7. The "grep" command is used to:

a) Search for the occurrence of a specific pattern in a file

b) Extract specific fields from a file

c) Sort the content of a file alphabetically

d) Remove duplicated lines from a file

8. The "cut" command is used to:

a) Search for the occurrence of a specific pattern in a file

b) Extract specific fields from a file

c) Sort the content of a file alphabetically

d) Remove duplicated lines from a file

9. By default, the standard output of any command will appear:

a) On the terminal screen

b) Redirected to a file

c) Discarded

d) Displayed in a pop-up window

10. Which symbol is used for redirecting the output of a command to a file?

a) >

b) |

c) <

d) &

11. What does the "-c" option do with the "uniq" command?

a) Outputs each line with its number of repeats

b) Sorts the output in ascending order

c) Compares the contents of two files and outputs the common entries

d) Removes duplicated lines from a file


13. How can you extract fields 2 and 3 from a file using the "cut" command with space as the separator?

a) cut -d':' -f2,3 <filename>

b) cut -d',' -f2,3 <filename>

c) cut -d' ' -f2,3 <filename>

d) cut -d'-' -f2,3 <filename>

14. What is the purpose of using the "-v" option with the "grep" command?

a) Extract lines containing a specific pattern

b) Extract lines that do not contain a specific pattern

c) Sort the output in reverse order

d) Verbose output mode

15. The "sort" command outputs a sorted order of the file content based on a specified:

a) Sort key

b) Field delimiter

c) Line number

d) File size

16. Which option can be used with the "sort" command to sort numerically?

a) -n

b) -c

c) -r

d) -u

17. What does the "diff" command display by default?

a) Number of lines in each file

b) Common lines between two files

c) Different lines between two files

d) Size of the differences between two files

18. When redirecting the output of a command to a file using ">", if the file exists:

a) The output will be displayed on the terminal screen

b) The result will be appended to the end of the file

c) An error will be thrown


d) The result will be overwritten in the file

19. What does the "-f" option specify in the "cut" command?

a) Field specifier

b) File name

c) Field delimiter

d) File format

20. The "uniq" command requires a sorted file as input because:

a) It removes duplicated lines based on consecutive entries

b) It compares the contents of two files and outputs the common entries

c) It reorders the content of a file alphabetically

d) It displays the differences between two files

True or False Questions:


1. The "wc" command prints newline, word, and byte counts for each file. (True/False)

2. The "sort" command is used to remove duplicated lines from a file. (True/False)

3. The "uniq" command outputs a file with no duplicated lines. (True/False)

4. The "join" command compares the contents of two files and outputs the differences. (True/False)

5. The "diff" command compares the contents of two files and displays the common entries.
(True/False)

6. The "sort" command outputs a sorted order of the file content based on a specified sort key.
(True/False)

7. The "grep" command extracts specific fields from a file. (True/False) cut

8. The "cut" command is used to search for the occurrence of a specific pattern in a file. (True/False)

9. By default, the standard output of any command will appear redirected to a file. (True/False)

10. The symbol ">" is used for redirecting the input of a command from a file. (True/False)

(note: The symbol ">" is used for redirecting the output of a command to a file, not for redirecting the
input of a command from a file.)

11. The "-c" option with the "uniq" command outputs each line with its number of repeats. (True/False)

12. The "join" command requires sorted files as input. (True/False)

13. The "-v" option with the "grep" command extracts lines that do not contain a specific pattern.
(True/False)
14. The "sort" command outputs the file content based on line numbers. (True/False)

15. The "-n" option with the "sort" command sorts the file content alphabetically. (True/False)

16. The "diff" command displays the common lines between two files by default. (True/False)

17. When redirecting the output of a command to a file using ">", if the file exists, the result will be
appended to the end of the file. (True/False)

(note: When redirecting the output of a command to a file using ">", if the file exists, the existing
content of the file will be overwritten with the new output which means its previous content will be
replaced entirely. If you want to append the output to the end of the file without overwriting the
existing content, you can use ">>" instead of ">" as the redirection operator.)

18. The "-f" option in the "cut" command specifies the field delimiter (True/False)

19. The "uniq" command removes duplicated lines based on consecutive entries. (True/False)

(note: The "uniq" command removes duplicated lines based on consecutive entries. It compares each
line of a sorted file with the line immediately preceding it, and if they are identical, it removes the
duplicate line. It only considers consecutive duplicate entries and does not remove duplicates that are
not adjacent to each other.)

‫ يقارن األمر كل سطر في الملف المرتب مع السطر الذي‬.‫" يزيل التكرار إذا كان السطرين المتتاليين في الملف نفسهما‬uniq" ‫األمر‬
‫ يعتبر األمر فقط التكرارات المتتالية وال يزيل التكرارات التي ليست مجاورة‬.‫ يتم إزالة السطر المكرر‬،‫ وإذا كانا متطابقين‬،‫يليه مباشرة‬
.‫لبعضها البعض‬

20. The "grep" command compares the contents of two files and outputs the common entries.
(True/False)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy