Awk – An Advanced Filter & Perl – Master Manipulator

This MCQ-formatted quiz covers awk command operations and Perl as a general-purpose tool.

Start Quiz

Awk filter operates at the field level. True or false?

True

False

Which of the following will be used to print lines containing ‘manager’ in emp.lst?

awk ‘/manager/ { print }’ emp.lst

awk ‘/manager { print }’ emp.lst

awk ‘/manager/ { print } emp.lst

awk ‘manager { print }’ emp.lst

Awk uses __ for splitting a line into fields.

Special Parameters

Shell Variables

Environmental Variables

Command Arguments

Which built-in variable is used by the awk command to specify line numbers?

AR

NR

$$

$?

What is the default delimiter used by the awk command?

Tab

Whitespace

Double Space

|

The printf function uses __ for string data and __ for numeric data.

%f, %l

%s, %f

%s, %d

%s, %s

A user-defined variable is initialized to

Zero

Zero or Null String

Null

Operator

Which commands is used to assign executable permission to all of the files named “letter“?

Chmod ugo+r letter

Chmod ugo+rw letter

Chmod u+x letter

Chmod ugo+x letter

None of the above

Which of the following commands is used to list the contents of directories?

Is

Ip

Dir

Tar

None of the above

Which command is used to count just the number of characters in a file?

wc - 1

wc -c

wc -w

wc -r

None of the above

Which command is used to remove the read permission of the file ‘note‘ from both the group and others?

chmod go+r note

chmod go+rw note

chmod go-x note

chmod go-r note

None of the above

Which of the following commands is used to assign executable permission to the file owner named ‘note‘?

Chmod g+x note

Chmod u+w note

Chmod u+x note

Chmod ugo+x note

None of the above

Which filter, apart from Perl, is the most powerful?

Sed

Awk

Grep

Cut

If the selection_criteria is missing in the awk command statement, then the default action is

Print

Split

Print and Split

No default action

For pattern-matching, awk uses regular expressions in __ style.

SED

GREP

PERL

PRINT

Quiz/Test Summary
Title: Awk – An Advanced Filter & Perl – Master Manipulator
Questions: 15
Contributed by:
Ivan