nerdexam
CompTIA

LX0-104 · Question #371

Which of the following statements is true when querying the extended attributes of a file that has no extended attributes set?

The correct answer is C. No output will be produced and getfattr will exit with a value of 0.. This question tests the behavior and exit status of the getfattr command when querying a file that has no extended attributes set.

Administrative Tasks

Question

Which of the following statements is true when querying the extended attributes of a file that has no extended attributes set?

Options

  • Agetfattr will print a warning and exit with a value of 0.
  • Bgetfattr will print a warning and exit with a value of 1.
  • CNo output will be produced and getfattr will exit with a value of 0.
  • DNo output will be produced and getfattr will exit with a value of 1.

How the community answered

(29 responses)
  • B
    3% (1)
  • C
    90% (26)
  • D
    7% (2)

Why each option

This question tests the behavior and exit status of the `getfattr` command when querying a file that has no extended attributes set.

Agetfattr will print a warning and exit with a value of 0.

`getfattr` does not print a warning; it simply outputs nothing if no attributes are found, and it exits successfully.

Bgetfattr will print a warning and exit with a value of 1.

`getfattr` does not print a warning and exits with a successful status of 0, not an error status of 1.

CNo output will be produced and getfattr will exit with a value of 0.Correct

When `getfattr` is executed on a file that has no extended attributes set, the command correctly determines this state, produces no output as there are no attributes to display, and exits with a status code of 0 to indicate successful completion of the query.

DNo output will be produced and getfattr will exit with a value of 1.

`getfattr` exits with a successful status of 0, not an error status of 1, when no extended attributes are found.

Concept tested: getfattr behavior with no attributes

Source: https://linux.die.net/man/1/getfattr

Topics

#Extended Attributes#getfattr#command behavior

Community Discussion

No community discussion yet for this question.

Full LX0-104 Practice