102-500 · Question #175
What output will the command seq 10 produce?
The correct answer is B. The numbers 1 through 10 with one number per line. seq 10 generates a sequence starting at 1, ending at 10, printing each integer on its own line - making B correct. The seq command defaults to starting at 1 (not 0), so C is wrong; starting at 0 is Python's range() behavior, not seq. A is wrong because seq 10 terminates after…
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 through 9 with one number per line.
- DThe number 10 to standard output.
How the community answered
(40 responses)- A3% (1)
- B73% (29)
- C15% (6)
- D10% (4)
Explanation
seq 10 generates a sequence starting at 1, ending at 10, printing each integer on its own line - making B correct. The seq command defaults to starting at 1 (not 0), so C is wrong; starting at 0 is Python's range() behavior, not seq. A is wrong because seq 10 terminates after reaching 10 - a continuous stream would require something like while true. D is wrong because seq produces a sequence, not a single value; echo 10 would print just the number 10.
Memory tip: Think of seq as "sequence from 1 to N" - if you want a different start, you supply it explicitly (e.g., seq 0 10), otherwise it always begins at 1.
Topics
Community Discussion
No community discussion yet for this question.