LX0-104 · Question #551
Which of the following outputs 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 sequences of numbers, and when given a single argument, it produces a sequence from 1 up to that number, with each number on a new line.
Question
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 though 9 with one number per line.
- DThe number 10 to standard output.
How the community answered
(53 responses)- A2% (1)
- B92% (49)
- C2% (1)
- D4% (2)
Why each option
The `seq` command generates sequences of numbers, and when given a single argument, it produces a sequence from 1 up to that number, with each number on a new line.
`seq` does not produce a continuous stream or increment by 10 by default; it stops at the specified number and defaults to increments of 1.
When `seq` is invoked with a single argument, it defaults to producing numbers starting from 1, incrementing by 1, and ending at the specified argument. Thus, `seq 10` generates the integers 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, each on a separate line.
`seq` defaults to starting from 1, not 0, when a single argument is provided.
`seq` generates a sequence of numbers, not just the single specified number.
Concept tested: Linux seq command basic usage
Topics
Community Discussion
No community discussion yet for this question.