Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

QUESTION 31 Which statement best describes when filename generation (expansion)

ID: 3905231 • Letter: Q

Question

QUESTION 31

Which statement best describes when filename generation (expansion) can occur?

Inside of single quotes

Inside of double quotes

Inside of backquotes

B & C

A & B & C

4 points   

QUESTION 32

The return status is available to the shell in the shell variable $?.

True

False

2 points   

QUESTION 33

Given the following shell script, testcmd

Match each line below to the correct description of the results.

./testcmd > outfile 2>&1

./testcmd 2>outfile >&2

./testcmd >&2 2>outfile

./testcmd 2>&1 >outfile

Standard output is redirected to outfile, and standard error is redirected to standard output (outfile) resulting both standard output and standard error being redirected to outfile

Standard error is redirected to standard output (terminal), standard output is redirected to outfile. The result is that the text, "line sent to standard error" will be printed on the terminal and the text, "line sent to standard output" will be writtent to outfile.

Standard error is redirected to outfile, and standard output is redirected to standard error (outfile). The result is both standard error and standard output are redirected to outfile.

Standard output is redirected to standard error (terminal) and standard error is recirected to outfile. The result is that out file will contain the text "line sent to standard error" and the text "line sent to standard output" will be printed on the terminal.

8 points   

QUESTION 34

True

False

2 points   

QUESTION 35

A command which reads from standard input and writes to stderr is a filter.

True

False

2 points   

QUESTION 36

The uniq command will remove duplicate consecutive lines.

True

False

2 points   

QUESTION 37

Running the command

sort -u

is always the same as running the command

uniq

True

False

2 points   

QUESTION 38

Given the scripts inner and outer that are both executable and exist in the same directory.

The script inner:

#!/bin/sh
echo $#
exit

The script outer

#!/bin/sh

./inner $*
./inner $@
./inner "$*"
./inner "$@"
exit

and given the command

./outer "A B C" "A B C"

which of the following are false?

The value of $# in outer is 6

The value of $# in outer greater than or equal to 1

The value of $# in outer is 2

When the script inner is called with the argument "$*" the value of $# in inner is always equal to 1

4 points   

QUESTION 39

The command

cut -d: -f1 | more < /etc/passwd

would correctly print the first field of the password file and send the results to the program more.

True

False

2 points   

Click Save and Submit to save and submit. Click Save All Answers to save all answers.

a.

Inside of single quotes

b.

Inside of double quotes

c.

Inside of backquotes

d.

B & C

e.

A & B & C

Explanation / Answer

Solution:

Answer 31)

Solution: - the option is (a) because the file name generation is always happens inside single quotes.

Answer 32)

Solution: - True. Using $? We get the return code of previous executed command. If it is 0 then the command is successfully executed.

Answer 33 )

A             ---- a

B             ---- c

C             ---- d

D             ---- b

Answer 34)

Solution: - True

Using cd / we moved to / directory and using tar command we are compressing the etc directory then we are moving to /temp directory and extracting the compressed file over there.

Answer 35) False

Filter reads from standard input and returns it as standard output

Answer 36) True

Uniq command removes duplicate line.

Answer 37) False

Answer 38) c) the value of $# is equals to 6 not 2

Answer 39) False -> It will show the whole content of /etc/passwd file

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote