17.) How to duplicate file descriptors?
-
a) duplicate()
-
b) dup()
-
c) cp()
-
d) mknod()
B
Correct answer
Explanation
dup() is the POSIX system call used to duplicate file descriptors. It creates a new file descriptor that refers to the same open file description as the original, sharing the file offset and status flags. dup2() is a related call that allows specifying the descriptor number. cp() is for file copying, mknod() creates device nodes.