nerdexam
LPI

102-500 · Question #87

What output does the command seq 1 5 20 produce?

The correct answer is B. 1. seq 1 5 20 follows the syntax seq FIRST INCREMENT LAST, generating numbers starting at 1, stepping by 5, up to but not exceeding 20. That produces: 1, 6, 11, 16 - making option B correct because it represents this sequence starting from 1 with a step of 5. Option A is wrong…

Shells and Shell Scripting

Question

What output does the command seq 1 5 20 produce?

Options

  • A1
  • B1
  • C1
  • D2
  • E5

How the community answered

(29 responses)
  • A
    3% (1)
  • B
    83% (24)
  • D
    10% (3)
  • E
    3% (1)

Explanation

seq 1 5 20 follows the syntax seq FIRST INCREMENT LAST, generating numbers starting at 1, stepping by 5, up to but not exceeding 20. That produces: 1, 6, 11, 16 - making option B correct because it represents this sequence starting from 1 with a step of 5.

Option A is wrong because it likely reflects a misreading of the arguments (e.g., treating it as seq 1 20 with no increment, giving 1–20 one-by-one). Options C and D are wrong because they imply a different starting point or step size - D starting at 2 suggests confusing the increment argument with the start. Option E (5) is wrong because 5 is the increment, not the starting value or a standalone output.

Memory tip: Think of seq arguments as "From, By, To" - seq 1 5 20 reads as "from 1, by 5s, to 20." If only two arguments are given (seq 1 20), the increment defaults to 1.

Topics

#seq command#number sequences#shell commands#command parameters

Community Discussion

No community discussion yet for this question.

Full 102-500 Practice