System Calls MCQs-Operating Systems
System Calls (Operating Systems)
- Which of the following is not a typical category of system call?
A. Process control
B. File manipulation
C. Memory locking in user space without kernel involvement
D. Device manipulation
Answer: C.
Explanation: Memory locking (e.g.,mlock) requires kernel involvement; “memory locking purely in user space without kernel involvement” is not a system call category. - A process calls
fork()and the call succeeds. Which of the following is true immediately afterfork()returns?
A. Parent and child have identical PIDs.
B.fork()returns 0 in the parent and child.
C. Child inherits open file descriptors from parent.
D. Child starts executing at a different entry point in the executable.
Answer: C.
Explanation: Child inherits copies of parent’s open file descriptors.fork()returns 0 in child, child and parent have different PIDs, and child continues at same instruction. - Which system call replaces the current process image with a new program?
A.fork()
B.execve()
C.wait()
D.clone()
Answer: B.
Explanation:execve()loads a new program into the calling process, replacing its memory image. - If a program calls
exit(5), what will be the exit status observed by the parent viawait()?
A. 5
B. 0
C. 128+5
D. Status must be decoded from wait’s status word (macro required)
Answer: D.
Explanation:wait()returns a status word; use macros (e.g.,WEXITSTATUS(status)) to obtain 5. Directly reading raw word is incorrect. - Which of the following
open()flag combinations will create a file if it does not exist and truncate it to zero length?
A.O_RDONLY
B.O_CREAT|O_TRUNC|O_WRONLY
C.O_APPEND|O_RDONLY
D.O_EXCL|O_RDONLY
Answer: B.
Explanation:O_CREATcreates if absent;O_TRUNCtruncates; open must allow write. - Which system call moves the file offset for a file descriptor?
A.seek()
B.lseek()
C.fseek()
D.setpos()
Answer: B.
Explanation: POSIXlseek()sets the file offset on a file descriptor. - Which syscall provides a memory map of a file into a process’s address space?
A.brk()
B.mmap()
C.sbrk()
D.mlock()
Answer: B.
Explanation:mmap()maps files or anonymous memory into the process address space. - What does
dup2(oldfd, newfd)guarantee?
A.newfdbecomes a duplicate ofoldfd; ifnewfdwas open it is closed first.
B.oldfdis closed and newfd points elsewhere.
C. Duplicates fds but resetsO_CLOEXEC.
D.dup2always returns -1 on success.
Answer: A.
Explanation:dup2duplicatesoldfdtonewfd, closingnewfdfirst if necessary. - Which syscall returns the process ID of the calling process?
A.getppid()
B.getpid()
C.gettid()
D.getuid()
Answer: B.
Explanation:getpid()returns calling process PID. - A process wants to sleep for at least 150 milliseconds with nanosecond precision. Which syscall is most appropriate?
A.sleep(0.15)
B.usleep()
C.nanosleep()
D.select()
Answer: C.
Explanation:nanosleep()supports nanosecond precision (spec struct timespec). - Which syscall is used to change the protections (read/write/execute) on a mapped memory region?
A.mprotect()
B.chmod()
C.munmap()
D.madvise()
Answer: A.
Explanation:mprotect()changes protection of an existing mapping. waitpid(pid, &status, WNOHANG)returns 0. What does that mean?
A. Child terminated with exit code 0.
B. Specified child has not changed state (still running).
C. Error occurred.
D. Child signaled with SIGCHLD.
Answer: B.
Explanation:WNOHANGmakeswaitpidnon-blocking; 0 means no child status change.- Which syscall can atomically create a new file and fail if it already exists?
A.open(name, O_CREAT)
B.open(name, O_CREAT | O_EXCL)
C.truncate()
D.fopen()
Answer: B.
Explanation:O_EXCLwithO_CREATensures atomic create-fail-if-exists behavior. - Which of the following is true about
vfork()compared tofork()?
A.vfork()clones the whole address space likefork()but slower.
B.vfork()suspends the parent until child either callsexecor_exit.
C.vfork()returns different values in parent and child same asfork()but swaps PID semantics.
D.vfork()is POSIX-standard and recommended for general use overfork().
Answer: B.
Explanation:vfork()shares address space and suspends parent until child callsexec/_exitto avoid copy; it’s risky. - Which syscall is used to obtain file metadata (size, permissions, timestamps) for a pathname?
A.open()
B.stat()
C.fstat()
D.lstat()
Answer: B.
Explanation:stat()acts on pathname;fstat()on fd;lstat()does not follow symlinks. - In POSIX, sending a signal using
kill(pid, SIGTERM)to a negative pid (e.g., -123) does what?
A. Delivers to process with PID = -123.
B. Delivers to all processes with group ID 123.
C. Error.
D. Broadcast to all processes.
Answer: B.
Explanation: Negative pid (not -1) targets process group with ID absolute value. open()returns -1 and setserrnotoEMFILE. What is the cause?
A. File system quota exceeded.
B. Process has reached its per-process file descriptor limit.
C. No such file exists.
D. Permission denied.
Answer: B.
Explanation:EMFILEindicates process has too many open files.- Which syscall can be used to atomically read from a file descriptor at an offset without changing the file offset?
A.read()
B.pread()
C.lseek()+read()
D.readv()
Answer: B.
Explanation:pread()reads at offset without altering file descriptor’s offset. - What does
ftruncate(fd, 1024)do if the file was previously 2048 bytes?
A. Extends the file to 1024 bytes.
B. Truncates file to 1024 bytes (shorter).
C. No effect.
D. Increases file size to 3072 bytes.
Answer: B.
Explanation:ftruncate()changes file length; if smaller, data beyond new length is discarded. - Which syscall is best suited to implement nonblocking multiplexed I/O on a small number of file descriptors?
A.epoll_wait()
B.select()
C.kqueue()
D.aio_read()
Answer: B.
Explanation: For small fixed setsselect()is simplest;epollis better for large numbers. read()returns 0 bytes. Which is the correct interpretation?
A. Read failed.
B. End-of-file reached.
C. Blocking call interrupted by signal.
D. Buffer is full.
Answer: B.
Explanation:read()returning 0 indicates EOF for regular files/sockets closed.- Which system call creates a pipe and returns two file descriptors?
A.socketpair()
B.pipe()
C.mkfifo()
D.mknod()
Answer: B.
Explanation:pipe()creates an anonymous pipe and returns read and write fds. - To atomically change the permissions of a file descriptor (not pathname), which syscall is used?
A.chmod()
B.fchmod()
C.umask()
D.chown()
Answer: B.
Explanation:fchmod()operates on an open file descriptor. - Which syscall is used to create a new POSIX shared memory object?
A.shmget()
B.shm_open()
C.mmap()alone
D.open()
Answer: B.
Explanation: POSIXshm_open()creates/open shared memory object;shmget()is System V. - Which syscall returns the parent process ID of the calling process?
A.getpid()
B.getppid()
C.getpgrp()
D.getuid()
Answer: B.
Explanation:getppid()returns parent PID. - Which of these system calls is asynchronous-signal-safe and can be called from a signal handler?
A.malloc()
B.printf()
C.write()
D.strtok()
Answer: C.
Explanation:write()is async-signal-safe;malloc/printf/strtokare not. - Which syscall is used to change the current working directory?
A.chdir()
B.fchdir()
C. Both A and B
D.setcwd()
Answer: C.
Explanation:chdir()changes by path;fchdir()changes to directory referred by fd. - A process wants to create a thread-like execution with shared memory and file descriptors — which syscall (Linux-specific) is used?
A.fork()
B.clone()
C.execve()
D.vfork()
Answer: B.
Explanation:clone()can be used to create threads that share resources. - Which syscall can be used to change the CPU scheduling policy of the calling process?
A.nice()
B.setpriority()
C.sched_setscheduler()
D.setrlimit()
Answer: C.
Explanation:sched_setscheduler()sets scheduling policy and priority. - Which of the following will NOT be duplicated into the child after
fork()?
A. File descriptor table entries
B. Shared memory mappings (in some implementations)
C. Thread states (user-level threads in the parent)
D. Environment variables
Answer: C.
Explanation: Only the calling thread continues; other user-level threads are not duplicated. gettimeofday()gives time with microsecond resolution. Which syscall gives nanosecond-resolution POSIX time?
A.gettimeofday()
B.clock_gettime()
C.time()
D.ftime()
Answer: B.
Explanation:clock_gettime()provides nanosecond resolution for various clocks.- Which syscall is used to block until a file descriptor is ready for read/write and can also set a timeout (using
struct timeval)?
A.select()
B.poll()
C.epoll_wait()
D.ioctl()
Answer: A.
Explanation:select()usesfd_setandstruct timevaltimeout;poll()usesstruct pollfd. - What is the purpose of
fcntl(fd, F_SETFL, flags)?
A. Set file status flags likeO_NONBLOCK.
B. Lock file permanently.
C. Duplicate file descriptor.
D. Obtain file metadata.
Answer: A.
Explanation:fcntlwithF_SETFLchanges status flags like nonblocking. - Which system call is used to change the root directory for the current process (chroot jail)?
A.chdir()
B.chroot()
C.pivot_root()
D.mount()
Answer: B.
Explanation:chroot()changes the apparent root directory;pivot_root()is different. - Which of the following syscalls can grant a process the ability to setuid without being root, when used with appropriate capabilities?
A.setuid()
B.setresuid()
C.seteuid()
D. Capabilities management (e.g., viacapset) is required — none of the above alone.
Answer: D.
Explanation: Granting such privileges without root requires Linux capabilities (capability APIs). - What does
madvise()do?
A. Modify file permissions.
B. Give the kernel advice about use of memory range.
C. Map device into memory.
D. Lock memory pages.
Answer: B.
Explanation:madvise()tells kernel intended usage patterns (e.g., SEQUENTIAL, RANDOM). - Which syscall is used to atomically wait for futex (fast userspace mutex) operations?
A.futex()(Linux specific)
B.pthread_mutex_lock()
C.sem_wait()
D.select()
Answer: A.
Explanation:futex()is Linux syscall to wait/wake on user-space addresses. - Which syscall allows a process to retrieve or set resource limits (e.g., max file descriptors)?
A.getrlimit()/setrlimit()
B.ulimit()
C.getpriority()
D.prlimit()
Answer: A.
Explanation:getrlimit/setrlimitmanage resource limits;prlimitcan do both atomically. sendfile(out_fd, in_fd, &offset, count)is used to:
A. Read file into user buffer.
B. Copy data between descriptors in kernel space (zero-copy).
C. Send a file over network using user space.
D. None of the above.
Answer: B.
Explanation:sendfile()copies data kernel-to-kernel, avoiding user-space copies.- Which syscall removes a link (name) from the filesystem?
A.unlink()
B.rmdir()
C.remove()
D.delete()
Answer: A.
Explanation:unlink()removes a name;rmdir()removes empty directory. - Which syscall returns the file descriptor limit for the process?
A.sysconf(_SC_OPEN_MAX)
B.getrlimit(RLIMIT_NOFILE, ...)
C.ulimit -n(shell builtin)
D. Both A and B are valid.
Answer: D.
Explanation:sysconfgives POSIX limit;getrlimitgives resource limit—both relevant. - Which syscall is used to sleep but is interrupted by signals and reports remaining time?
A.sleep()
B.nanosleep()
C.pause()
D.alarm()
Answer: B.
Explanation:nanosleep()returns remaining time if interrupted by a signal. stat.st_modeindicates file type and permissions. Which syscall fillsstatgiven an open file descriptor?
A.stat()
B.fstat()
C.lstat()
D.statf()
Answer: B.
Explanation:fstat(fd, &statbuf)fills info for open fd.- Which of the following operations is NOT atomic on a modern POSIX filesystem?
A.link()creation of a new hard link to an existing inode.
B. Renaming a file in the same filesystem usingrename().
C. Appending a singlewrite()withO_APPENDflag of 1 byte (atomic if < PIPE_BUF?)
D. Checking-if-file-exists followed by create (two separate system calls)
Answer: D.
Explanation: Existence check then create is not atomic; race conditions possible. - What does
ioctl(fd, request, argp)generally do?
A. Generic device-specific control operation.
B. Change process priority.
C. Duplicate a file descriptor.
D. Set file descriptor non-blocking.
Answer: A.
Explanation:ioctlis device/control specific; can do many device-dependent tasks. - Which system call is used to get or set signal dispositions (handler functions)?
A.signal()
B.sigaction()
C.sigprocmask()
D.kill()
Answer: B.
Explanation:sigaction()is the POSIX-recommended API to set handlers and flags. - Which of the following
open()modes will open a file for appending and write-only?
A.O_WRONLY | O_APPEND
B.O_WRONLY | O_TRUNC
C.O_RDONLY | O_APPEND
D.O_RDWR | O_APPEND
Answer: A.
Explanation:O_WRONLY | O_APPENDopens write-only and appends each write. - Which call makes file descriptor
fdnon-blocking?
A.fcntl(fd, F_SETFL, O_NONBLOCK)replacing other flags blindly.
B.fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK)
C.ioctl(fd, FIONBIO, &on)
D. Both B and C are correct methods.
Answer: D.
Explanation: Bothfcntl(using GETFL then SETFL) andioctlwithFIONBIOcan set nonblocking. - Which syscall allows a process to atomically change file ownership by descriptor (not pathname)?
A.chown()
B.fchown()
C.lchown()
D.setuid()
Answer: B.
Explanation:fchown(fd, owner, group)changes owner for open file descriptor. - What is the effect of
umask(0022)?
A. Sets default file creation mask so new files are not group/other writable.
B. Grants world write permissions.
C. Clears the process’s file creation mask entirely.
D. Is meaningless for directories.
Answer: A.
Explanation: umask sets bits removed from default mode; 0022 removes write from group/other. - Which syscall can change the effective UID of a process (drop privileges temporarily)?
A.setuid()
B.seteuid()
C.setresuid()
D.seteuid()is best for temporarily dropping/raising if permitted.
Answer: D (seteuid()).
Explanation:seteuid()changes effective UID without affecting real UID, facilitating temporary privilege drop. - Which syscall returns the number of bytes available to read without blocking on a pipe or socket (Linux)?
A.ioctl(fd, FIONREAD, &n)
B.select()
C.poll()
D.read()
Answer: A.
Explanation:FIONREADviaioctlreturns the number of bytes readable without blocking. - Which of the following calls can create a FIFO special file (named pipe) at pathname?
A.pipe()
B.mkfifo(path, mode)
C.mknod(path, S_IFIFO | mode, 0)
D. Both B and C
Answer: D.
Explanation:mkfifois convenience wrapper;mknodcan also create FIFO withS_IFIFO. - Which syscall is used for high-performance edge-triggered I/O on Linux?
A.select()
B.poll()
C.epoll_create()/epoll_ctl()/epoll_wait()
D.kqueue()
Answer: C.
Explanation:epollfamily supports edge-triggered high-performance I/O. - A process calls
execve()and it fails withEACCES. Which is not a likely cause?
A. Executable lacks execute bit.
B. One of the directories in path lacks execute permission for the user.
C. File is a script whose interpreter lacks execute permissions.
D. Insufficient memory in kernel to load program.
Answer: D.
Explanation:EACCESindicates permission issues; memory shortage would be ENOMEM. - Which syscall can atomically change the name of a file (rename) even if a file with the new name exists (on POSIX)?
A.rename()(behavior is atomic within same filesystem)
B.link()thenunlink()
C.remove()
D.renameat()only
Answer: A.
Explanation:rename()atomically replaces the target if in same filesystem. - Which syscall would a daemon use to dissociate from controlling terminal and run in background?
A.fork()thensetsid()
B.fork()thenchroot()
C.vfork()thenexecve()
D.daemon()(glibc wrapper)
Answer: A (common approach) — also D exists as wrapper.
Explanation: Standard steps: fork, setsid, chdir, umask;daemon()is a convenience wrapper in libc. - Which system call is used to obtain a file descriptor for a socket after a passive
listen()?
A.accept()
B.connect()
C.bind()
D.listen()
Answer: A.
Explanation:accept()returns a new fd for an incoming connection. - Which syscall provides real-time POSIX message queues?
A.msgget()(System V)
B.mq_open()(POSIX)
C.pipe()
D.shm_open()
Answer: B.
Explanation:mq_opencreates/opens POSIX message queues; System V usesmsgget. - Which syscall can be used to atomically set the time-of-day clock?
A.gettimeofday()
B.settimeofday()
C.clock_settime()withCLOCK_REALTIME
D. Both B and C (B is legacy, C is POSIX)
Answer: D.
Explanation:clock_settime(CLOCK_REALTIME, ...)is POSIX;settimeofdayalso can set time on many unices.
Perfect ✅ — here are the remaining 40 tricky, plagiarism-free GATE-level MCQs (61–100) on System Calls in Operating Systems, continuing from the previous 60.
Each question includes 4 options (A–D) and a detailed explanation.
61.
Which syscall allows a process to execute another program without creating a new process?
A. execve()
B. fork()
C. clone()
D. system()
Answer: A
Explanation: execve() replaces the current process image; no new process is created.
62.
Which syscall provides the same functionality as read() and write() but allows scatter/gather I/O?
A. pread() and pwrite()
B. readv() and writev()
C. readmany() and writemany()
D. iowrite() and ioread()
Answer: B
Explanation: readv()/writev() perform vectorized I/O across multiple buffers.
63.
When a process calls kill(getpid(), SIGKILL), what happens?
A. Nothing, SIGKILL is ignored by kernel.
B. The process terminates immediately, cannot be caught.
C. The signal is queued but never delivered.
D. The process goes into zombie state.
Answer: B
Explanation: SIGKILL cannot be caught or ignored; the process is terminated instantly.
64.
Which syscall is used to duplicate an existing file descriptor to the lowest available number?
A. dup()
B. dup2()
C. fcntl()
D. open()
Answer: A
Explanation: dup() duplicates an fd to the lowest-numbered unused descriptor.
65.
A process executes pipe(fd) and gets descriptors fd[0] and fd[1]. Which is true?
A. fd[0] is for writing, fd[1] for reading.
B. fd[0] is for reading, fd[1] for writing.
C. Both are bidirectional.
D. Both can read/write alternately.
Answer: B
Explanation: fd[0] — read end; fd[1] — write end.
66.
select() uses three fd sets. Which are they?
A. readfds, writefds, exceptfds
B. inputfds, outputfds, signalfds
C. openfds, blockfds, eventfds
D. none of these
Answer: A
Explanation: select() monitors readiness for reading, writing, and exceptional conditions.
67.
Which syscall can directly load an ELF binary into memory and execute it?
A. execve()
B. system()
C. load()
D. run()
Answer: A
Explanation: execve() is used by all exec-family calls to load new executables.
68.
When wait() is called by a parent process with no terminated children, it will:
A. Return immediately with -1.
B. Block until a child terminates.
C. Return status 0.
D. Kill all children.
Answer: B
Explanation: wait() blocks until one child terminates.
69.
Which syscall creates a symbolic link?
A. link()
B. symlink()
C. mklink()
D. ln()
Answer: B
Explanation: symlink() creates a symbolic (soft) link, unlike link() which makes hard link.
70.
Which syscall detaches a shared memory segment in System V IPC?
A. shmctl()
B. shmget()
C. shmdt()
D. semctl()
Answer: C
Explanation: shmdt() detaches the mapped shared memory segment from the process.
71.
Which syscall wakes a process sleeping in pause()?
A. Any signal delivery
B. sleep()
C. alarm()
D. nanosleep()
Answer: A
Explanation: pause() suspends until a signal is caught.
72.
Which syscall retrieves user identity of the caller process?
A. getuid()
B. geteuid()
C. Both A and B
D. setuid()
Answer: C
Explanation: getuid() returns real UID, geteuid() returns effective UID.
73.
Which syscall is used to remap an already mapped region to a new address?
A. mremap()
B. mmap()
C. munmap()
D. mprotect()
Answer: A
Explanation: mremap() changes the size or location of an existing mapping.
74.
When read() is called on a socket with no data and no peer, it returns:
A. Blocks forever
B. 0
C. -1 and sets errno to EPIPE
D. Random data
Answer: B
Explanation: 0 indicates EOF; peer has closed connection.
75.
Which syscall is used to monitor multiple file descriptors and return events in a list instead of sets?
A. select()
B. poll()
C. epoll()
D. futex()
Answer: B
Explanation: poll() uses a list of struct pollfd, more scalable than select().
76.
Which syscall is used to remove a System V shared memory segment?
A. shmdt()
B. shmctl(id, IPC_RMID, NULL)
C. shmget()
D. munmap()
Answer: B
Explanation: shmctl with IPC_RMID marks the segment for deletion.
77.
Which syscall is used to set an interval timer to generate periodic signals?
A. setitimer()
B. alarm()
C. nanosleep()
D. sleep()
Answer: A
Explanation: setitimer() can generate SIGALRM periodically based on timer type.
78.
Which syscall can attach a process to another process for debugging?
A. ptrace()
B. debug()
C. gdb()
D. trace()
Answer: A
Explanation: ptrace() allows one process to control another for debugging.
79.
Which syscall can change ownership of a file symbolic link itself, not the target?
A. chown()
B. fchown()
C. lchown()
D. setowner()
Answer: C
Explanation: lchown() modifies ownership of the link itself.
80.
Which syscall is used to map a region of memory that should not be swapped out?
A. mlock()
B. mmap()
C. mprotect()
D. mremap()
Answer: A
Explanation: mlock() locks pages into RAM, preventing swapping.
81.
What does the syscall fsync(fd) do?
A. Flushes file data to disk immediately.
B. Flushes only user-space buffers.
C. Flushes kernel buffers but not metadata.
D. Deletes file cache.
Answer: A
Explanation: fsync() ensures all modified data and metadata are written to storage.
82.
Which syscall is used to adjust the kernel’s view of the process’s data segment end (heap size)?
A. brk()
B. sbrk()
C. mmap()
D. Both A and B
Answer: D
Explanation: brk() sets program break; sbrk() changes it incrementally.
83.
Which syscall helps in creating a directory?
A. mkdir()
B. mknod()
C. open()
D. make()
Answer: A
Explanation: mkdir(path, mode) creates a new directory.
84.
Which syscall is used to remove a directory that is empty?
A. rmdir()
B. unlink()
C. remove()
D. delete()
Answer: A
Explanation: rmdir() removes an empty directory.
85.
Which syscall can report pending signals for the calling process?
A. sigpending()
B. sigprocmask()
C. sigaction()
D. kill()
Answer: A
Explanation: sigpending() retrieves pending signals.
86.
Which syscall waits for an event on a futex word with a timeout?
A. futex(FUTEX_WAIT, ...)
B. sem_wait()
C. waitpid()
D. select()
Answer: A
Explanation: futex() allows wait with optional timeout.
87.
Which syscall returns the controlling terminal name for a process’s file descriptor 0?
A. ttyname(0)
B. isatty(0)
C. gettty()
D. termname()
Answer: A
Explanation: ttyname() returns terminal pathname for fd.
88.
Which syscall is used to dynamically load kernel modules in Linux?
A. insmod()
B. init_module()
C. modprobe()
D. sysmodule()
Answer: B
Explanation: init_module() is the actual syscall used by insmod.
89.
What is returned by fork() if creation of child process fails?
A. -1
B. 0
C. PID of parent
D. Undefined value
Answer: A
Explanation: On failure, fork() returns -1 and sets errno.
90.
Which syscall is used to rename files across different filesystems in Linux?
A. rename() works across filesystems
B. rename() fails with EXDEV; must use copy + unlink
C. link() works for that
D. mv() system command does internally via link()
Answer: B
Explanation: rename() cannot move across filesystems — returns EXDEV.
91.
Which syscall can create an eventfd object for lightweight event notifications?
A. pipe()
B. eventfd()
C. signalfd()
D. futex()
Answer: B
Explanation: eventfd() creates an event counter usable for interprocess signaling.
92.
Which syscall provides an interface to asynchronous I/O completion notification via a file descriptor?
A. aio_read()
B. io_setup()
C. io_getevents()
D. io_uring_setup()
Answer: D
Explanation: io_uring family provides efficient kernel-level async I/O.
93.
Which syscall is used to mount a filesystem?
A. mount()
B. umount()
C. fsattach()
D. attach()
Answer: A
Explanation: mount(source, target, fstype, flags, data) mounts a filesystem.
94.
Which syscall retrieves information about mounted filesystems?
A. stat()
B. getmntent()
C. readmnt()
D. mountinfo()
Answer: B
Explanation: getmntent() reads /etc/mtab or /proc/mounts.
95.
Which syscall sends a file descriptor over a Unix domain socket?
A. send()
B. sendmsg()
C. write()
D. sendfile()
Answer: B
Explanation: sendmsg() with ancillary data (SCM_RIGHTS) transfers fds.
96.
Which syscall can create a timer that notifies via file descriptor instead of signal?
A. setitimer()
B. timerfd_create()
C. nanosleep()
D. clock_settime()
Answer: B
Explanation: timerfd_create() provides timer events as readable fd.
97.
Which syscall can change permissions of a symbolic link without affecting its target?
A. chmod()
B. lchmod()
C. fchmod()
D. setperm()
Answer: B
Explanation: lchmod() changes permissions of link itself (on supported systems).
98.
Which syscall is used to flush all pending filesystem writes to disk globally?
A. sync()
B. fsync()
C. fdatasync()
D. flush()
Answer: A
Explanation: sync() requests kernel to write all dirty buffers to disk.
99.
Which syscall can be used to get detailed CPU usage statistics for the current process and its children?
A. getrusage()
B. times()
C. clock_gettime()
D. sched_getaffinity()
Answer: A
Explanation: getrusage() provides CPU time and resource usage info.
100.
Which syscall allows direct reading/writing to another process’s memory (Linux)?
A. ptrace()
B. process_vm_readv() / process_vm_writev()
C. readv()
D. mmap()
Answer: B
Explanation: process_vm_readv() and process_vm_writev() perform cross-process memory operations efficiently.
.
