Multiple choice technology programming languages

Which file test can be done to see if a file exists and has a nonzero size?

  1. -s

  2. -l

  3. -S

  4. -k

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

In Perl, file test operator -s checks if a file exists AND has a non-zero size (it returns the file size in bytes if true). The -l operator tests for symbolic link, -S tests for socket file, and -k tests for sticky bit. This is useful when you need to verify a file has content before processing it.