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. |
Which option is used for reading an awk program from a file? |
| A. | -e |
| B. | -f |
| C. | -i |
| D. | -F |
| Answer» C. -i | |
| 2. |
awk allows the user to use variables of his own choice. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 3. |
awk uses __ and __ as comparison operators. |
| A. | $$, ^^ |
| B. | ||, && |
| C. | %%, ## |
| D. | ||, @@ |
| Answer» C. %%, ## | |
| 4. |
awk uses ___ operator for concatenating strings. |
| A. | > |
| B. | | |
| C. | * |
| D. | no operator available |
| Answer» E. | |
| 5. |
A user-defined variable is initialized to ____ |
| A. | zero |
| B. | zero or null string |
| C. | null |
| D. | operator |
| Answer» C. null | |
| 6. |
awk doesn’t use $ in evaluation or assignment of variables. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 7. |
The printf function uses ___ for string data and ___ for numeric. |
| A. | %f, %l |
| B. | %s, %f |
| C. | %s, %d |
| D. | %s, %s |
| Answer» D. %s, %s | |
| 8. |
What is the default delimiter used by awk? |
| A. | tab |
| B. | whitespace |
| C. | double space |
| D. | | |
| Answer» C. double space | |
| 9. |
Which built-in variable is used by the awk to specify the line numbers? |
| A. | AR |
| B. | NR |
| C. | $$ |
| D. | $? |
| Answer» C. $$ | |
| 10. |
awk uses ______ for splitting a line into fields. |
| A. | special parameters |
| B. | shell variables |
| C. | env variables |
| D. | command arguments |
| Answer» B. shell variables | |
| 11. |
For pattern-matching, awk uses regular expressions in ____ style. |
| A. | sed |
| B. | grep |
| C. | perl |
| D. | |
| Answer» B. grep | |
| 12. |
The default action if selection_criteria is missing is ____ |
| A. | |
| B. | split |
| C. | print and split |
| D. | no default action |
| Answer» B. split | |
| 13. |
Which of the following will be used to print lines containing ‘manager’ in emp.lst? |
| A. | awk ‘/manager/ { print }’ emp.lst |
| B. | awk ‘/manager { print }’ emp.lst |
| C. | awk ‘/manager/ { print } emp.lst |
| D. | awk ‘manager { print }’ emp.lst |
| Answer» B. awk ‘/manager { print }’ emp.lst | |
| 14. |
Awk filter operates at field level. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 15. |
Which filter apart from perl, is the most powerful? |
| A. | sed |
| B. | awk |
| C. | grep |
| D. | cut |
| Answer» C. grep | |