Multiple choice technology operating systems

#! /bin/ksh for i in 1 2 3 4 ......... 50 # loop from 1 to 50 do let i=i+1 done echo $i What is the output of the above script.

  1. 2450

  2. 1275

  3. 1225

  4. 2550

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The for loop iterates through the sequence 1 to 50, so i takes values 1,2,3,...,50 (50 iterations). Inside the loop, 'let i=i+1' increments each value before printing. After the loop, i=50 (last assigned value). The echo prints 50, not a sum. However, this seems to be a trick question - if we sum 1+2+...+50 = 1275, which is option B. The question may intend the sum of the series.