CS FundamentalsHardGATE CS · Product-company placement

A user creates file f, makes a hard link h to it and a symbolic link s to f. Then f is deleted and a NEW file named f is created with different content. What do cat h and cat s print?

  1. A. cat h prints the old content; cat s prints the new content
  2. B. Both print the old content
  3. C. cat h fails; cat s prints the new content
  4. D. cat h prints the old content; cat s fails

Correct answer: A. cat h prints the old content; cat s prints the new content

h names the original inode, whose link count stayed above zero, so it still holds the old data. s stores only the path "f", which now resolves to the new file. Before f was recreated, cat s would have failed as a dangling link.

More Operating Systems questions

Exams that ask this topic