nerdexam
LPI

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…

Shells and Shell Scripting

Question

What output does the command seq 10 produce?

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)
  • A
    17% (8)
  • B
    2% (1)
  • C
    6% (3)
  • D
    4% (2)
  • E
    71% (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: seq is 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: seq starts at 1, not 0 - zero-based counting would require seq 0 9.
  • D is wrong: seq 10 produces 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

#seq command#number generation#shell utilities#command arguments

Community Discussion

No community discussion yet for this question.

Full 102-500 Practice