nerdexam
CompTIA

LX0-104 · Question #1

What output will the following command produce? seq 1 5 20

The correct answer is A. 1. The seq command generates numbers in a sequence based on a start, increment, and end value. For seq 1 5 20, the command starts at 1, increments by 5, and generates numbers up to 20.

Shells, Scripting and Data Management

Question

What output will the following command produce? seq 1 5 20

Options

  • A1
  • B1
  • C1
  • D2
  • E5

How the community answered

(51 responses)
  • A
    94% (48)
  • B
    2% (1)
  • E
    4% (2)

Why each option

The `seq` command generates numbers in a sequence based on a start, increment, and end value. For `seq 1 5 20`, the command starts at 1, increments by 5, and generates numbers up to 20.

A1Correct

The `seq` command with `FIRST INCREMENT LAST` syntax generates a sequence starting at FIRST, incrementing by INCREMENT, and stopping when the next number would exceed LAST. For `seq 1 5 20`, the numbers generated are 1, 6, 11, and 16, with 1 being the first value.

B1

This choice is identical to the correct choice 'A', implying the same correct technical reason.

C1

This choice is identical to the correct choice 'A', implying the same correct technical reason.

D2

The `seq` command's first argument specifies the starting number, which is 1, not 2.

E5

The `seq` command's first argument specifies the starting number, which is 1, not 5, and 5 is the increment value, not the start.

Concept tested: Linux seq command usage

Source: https://www.man7.org/linux/man-pages/man1/seq.1.html

Topics

#seq command#shell commands#command output

Community Discussion

No community discussion yet for this question.

Full LX0-104 Practice