Multiple choice technology programming languages

17.) How to duplicate file descriptors?

  1. a) duplicate()

  2. b) dup()

  3. c) cp()

  4. d) mknod()

Reveal answer Fill a bubble to check yourself
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.