Multiple choice technology operating systems

Consider the script let i=2 while (( i <= ($l - 1) )); do if (( ($l % i ) == 0 )); then print $? break; fi let i=i+1 done What is the program all about and what are the possible outputs

  1. checks prime number; returns one when not prime and zero when prime

  2. checks prime number; returns none when not prime and zero when prime

  3. checks prime number; returns zero when not prime and one when prime

  4. checks prime number; returns zero when not prime and none when prime

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

The script checks if a number $l is prime by testing divisibility from 2 to l-1. The 'break' statement exits when a divisor is found. The key is understanding that 'print $?' displays the exit status of the last command - 'break' exits with status 0 (success), so when a divisor is found (not prime), it prints 0. When no divisor is found (prime), the loop completes normally and nothing is printed (none/empty).