MCQOPTIONS
Saved Bookmarks
This section includes 15 Mcqs, each offering curated multiple-choice questions to sharpen your Unix knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
grep command supports both extended and regular expressions. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 2. |
POSIX identifies regular expressions as belonging to ____ categories. |
| A. | 3 |
| B. | 2 |
| C. | 4 |
| D. | 5 |
| Answer» C. 4 | |
| 3. |
For taking patterns from a file, -f option is specified with grep command. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 4. |
_____ option is used when we need to match multiple patterns in a single invocation of grep command? |
| A. | -a |
| B. | -e |
| C. | -n |
| D. | -i |
| Answer» C. -n | |
| 5. |
Which option displays only the filename containing the pattern? |
| A. | -i |
| B. | -n |
| C. | -e |
| D. | -l |
| Answer» E. | |
| 6. |
______ option counts the number of lines containing the pattern? |
| A. | -c |
| B. | -i |
| C. | -e |
| D. | -n |
| Answer» B. -i | |
| 7. |
Which option is used for displaying the line numbers containing the pattern along with lines? |
| A. | -v |
| B. | -i |
| C. | -e |
| D. | -n |
| Answer» E. | |
| 8. |
Which option is used with grep command for deleting lines? |
| A. | -v |
| B. | -e |
| C. | -a |
| D. | -i |
| Answer» B. -e | |
| 9. |
Which option is used with grep command for ignoring the case in pattern searching? |
| A. | -a |
| B. | -v |
| C. | -i |
| D. | -e |
| Answer» D. -e | |
| 10. |
If there are special characters in a pattern, then we’ve to enclose them in ______ |
| A. | single quotes |
| B. | double quotes |
| C. | without any quotes |
| D. | all quotes |
| Answer» C. without any quotes | |
| 11. |
grep command can be used for searching a pattern in more than one file. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 12. |
When the pattern is not found in a file, grep command silently returns the prompt. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 13. |
Which one of the following command will be used for searching “director” in emp.lst? |
| A. | grep “director” |
| B. | grep -v “director” emp.lst |
| C. | grep -director emp.lst |
| D. | grep “director” emp.lst |
| Answer» E. | |
| 14. |
Which one of the following is the correct syntax for grep command? |
| A. | grep options filename(s) |
| B. | grep options pattern |
| C. | grep pattern filename |
| D. | grep options pattern filename(s) |
| Answer» E. | |
| 15. |
Which one of the following command is used for searching for a pattern in one or more file(s)? |
| A. | cd |
| B. | cp |
| C. | paste |
| D. | grep |
| Answer» E. | |