nerdexam
CompTIA

LX0-104 · Question #117

What output will the command seq 10 produce?

The correct answer is B. The numbers 1 through 10 with one number per line. The seq command generates a sequence of numbers. When given a single argument, it defaults to producing numbers from 1 up to that argument, with each number on a new line.

Shells, Scripting and Data Management

Question

What output will the command seq 10 produce?

Options

  • AA continuous stream of numbers increasing in increments of 10 until stopped.
  • BThe numbers 1 through 10 with one number per line.
  • CThe numbers 0 through 9 with one number per line.
  • DThe number 10 to standard output.

How the community answered

(50 responses)
  • A
    2% (1)
  • B
    92% (46)
  • C
    4% (2)
  • D
    2% (1)

Why each option

The seq command generates a sequence of numbers. When given a single argument, it defaults to producing numbers from 1 up to that argument, with each number on a new line.

AA continuous stream of numbers increasing in increments of 10 until stopped.

seq generates a finite sequence based on its arguments, not a continuous stream, and seq 10 does not specify an increment of 10.

BThe numbers 1 through 10 with one number per line.Correct

The seq command, when provided with a single positive integer argument N, outputs a sequence of numbers starting from 1 up to and including N, with each number printed on a separate line, using a default increment of 1. Therefore, seq 10 will output numbers 1, 2, ..., 10.

CThe numbers 0 through 9 with one number per line.

By default, seq starts from 1, not 0.

DThe number 10 to standard output.

seq produces a sequence of numbers, not just the final number.

Concept tested: Generating number sequences with seq command

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

Topics

#seq command#shell utilities#sequence generation

Community Discussion

No community discussion yet for this question.

Full LX0-104 Practice