Multiple choice technology operating systems

Consider the script let i=2 while (( i <= ($l - 1) )); do if (( ($l % i ) == 0 )); then print $i $l $? 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

This script checks if $l is prime by testing divisibility from 2 upward. If $l % i == 0 (divisible), it prints and breaks with exit status 0 (success). If no divisor found, loop completes naturally, exit status is 1 (failure) from the last comparison. The 'print' statement only executes when not prime (divisor found), so output appears when not prime; no output when prime.