Which of the following is syntactically valid in a standard Bash shell script…

PYQ IBPS SO CRP SPL-XIV (2024)

Which of the following is syntactically valid in a standard Bash shell script for iterating through a list of values using a for loop?

  1. A.

    for(i=0; i<5; i++)
    {
    }

  2. B.

    for i in 1 2 3 4 5
    do
    echo $i
    done

  3. C.

    foreach i = 1 to 5
    echo $i
    end

  4. D.

    loop i from 1 to 5
    print $i

  5. E.

    for i = 1:5
    echo $i
    endfor

Attempted by 123 students.

Sign up free to check your answer

Sign up free

Explore the full course: Ibps So It Mains

Loading lesson…