102-500 · Question #17
What output does the command seq 10 produce?
The correct answer is E. The numbers 1 through 10 with one number per line. seq 10 generates the integers 1 through 10, one per line, to standard output - making E correct. The seq command with a single argument treats that argument as the upper bound, starting from 1 with an increment of 1 by default. A is wrong: seq is not an infinite stream; it…
Question
Options
- AA continuous stream of numbers increasing in increments of 10 until the command is stopped.
- BIt creates no output because a second parameter is missing.
- CThe number 0 through 9 with one number per line.
- DThe number 10 to standard output.
- EThe numbers 1 through 10 with one number per line.
How the community answered
(48 responses)- A17% (8)
- B2% (1)
- C6% (3)
- D4% (2)
- E71% (34)
Explanation
seq 10 generates the integers 1 through 10, one per line, to standard output - making E correct. The seq command with a single argument treats that argument as the upper bound, starting from 1 with an increment of 1 by default.
- A is wrong:
seqis not an infinite stream; it terminates after reaching the upper bound. - B is wrong: a single argument is perfectly valid for
seq; the second parameter is optional. - C is wrong:
seqstarts at 1, not 0 - zero-based counting would requireseq 0 9. - D is wrong:
seq 10produces ten numbers (1–10), not just the single number 10.
Memory tip: Think of seq N as "sequence from 1 to N" - one argument means the end, and it always starts at 1 unless you tell it otherwise (e.g., seq 0 9 or seq 2 2 10).
Topics
Community Discussion
No community discussion yet for this question.