📝 Types of System Calls in operating system (30 MCQs)
Functional Categories of Operating System System Calls
System calls are commonly classified according to the operating system services they request. Major categories include process control, file management, device management, information maintenance, communication, and protection. Each category connects applications with a specific kernel responsibility, allowing programs to create processes, manipulate files, access devices, obtain system information, exchange data, and enforce controlled resource access through standard programming interfaces.
Why System Calls Are Classified by Their Operations
Applications perform different activities and therefore require distinct kernel facilities. Separating system calls into functional categories clarifies their purpose and supports organised programming interfaces. Process operations must manage execution and resources, while file operations concern persistent data and communication calls exchange information. These categories describe service purposes rather than requiring every operating system to implement identical names or interfaces.
Process, File, Device, Information, and Communication Calls
Process-control calls create, execute, and terminate processes; file-management calls open, read, write, and close files. Device-management calls request device operations or configuration. Information-maintenance calls retrieve system data and update attributes. Communication calls establish channels and transfer messages, while protection calls manage permissions and access rights. Their implementation depends on the operating system and supported hardware.
Combining Process Control and File Management Operations
Consider a Unix-like application that creates a child process using fork(), executes another program using exec(), and waits using wait(). The running program may then open a file through open(), retrieve data through read(), and close it through close(). These operations illustrate different system-call categories collaborating within one application workflow.
System Call Categories and Application Requirements
These categories support virtually every application, from text editors and databases to network servers and administrative utilities. Their separation allows specialised kernel subsystems to manage different resources. However, a system-call category does not guarantee identical behaviour across platforms, and some operations require multiple calls. Excessive system-call activity can also increase privilege-transition and processing overhead.
Misconceptions About System Call Classification
'Every file operation belongs to process control' is incorrect because file management handles file access and modification. 'Communication calls only work across different computers' is incorrect because processes can communicate on one machine. 'System calls in one category always have identical names across operating systems' is incorrect because interfaces differ between platforms.
Exam Focus: Classifying System Calls by Function
Practise assigning operations to process control, file management, device management, information maintenance, communication, and protection. Recognise examples such as fork(), exec(), wait(), open(), read(), write(), and close() in Unix-like systems. Questions may ask you to identify the appropriate category, distinguish related operations, or trace several calls within a process and file-handling sequence.
Key Terms of System Call Categories
- Process control - Manages process execution and termination.
- File management - Controls file operations.
- Device management - Requests device operations.
- Information maintenance - Retrieves or updates system information.
- Communication - Exchanges data between processes.
- Protection - Controls resource permissions.
📝 All Types of System Calls in operating system MCQs
Q1. A word-processing application creates a child process to handle printing, waits for that process to finish, and then continues editing. Which system-call category covers these operations?
📖 Explanation: Process-control calls create, execute, synchronize, and terminate processes. Operations such as fork(), wait(), and exit() control execution and relationships between processes. They let programs manage their lifecycle through controlled kernel services.
Q2. A backup program needs to create a destination file, read the source, write copied bytes, and close both files. Which category supplies these operations?
📖 Explanation: File-management calls support creating, opening, reading, writing, repositioning, closing, and deleting files. A backup utility uses these operations to access file contents and maintain the destination copy safely through standard operating-system interfaces.
Q3. A printer utility asks the operating system to reserve a printer, send data to it, and release it afterward. Which category best describes these requests?
📖 Explanation: Device-management calls request, release, read, write, or configure hardware devices. The operating system coordinates access to the printer and controls it through a protected driver interface, preventing applications from directly controlling shared hardware.
Q4. A monitoring utility requests the current process identifier and the current system time. Which system-call category provides this type of data?
📖 Explanation: Information-maintenance calls obtain or update system and process attributes, including identifiers, time, date, and system information. They report administrative facts without directly transferring file data or creating processes, supporting monitoring and system administration.
Q5. Two processes on the same computer need to exchange messages through a kernel-managed message queue. Which system-call category is involved?
📖 Explanation: Communication calls allow processes to exchange information using mechanisms such as pipes, message queues, sockets, or shared memory. A message queue provides kernel-managed delivery between cooperating processes without requiring direct access to each other's memory.
Q6. An administrator changes a file's access permissions so that ordinary users can read it but cannot modify it. Which system-call category is most directly involved?
📖 Explanation: Protection calls control access to resources by checking identities, permissions, and privileges. Changing a file's access mode alters which operations users may perform, helping enforce the system's security policy across users and processes.
Q7. A command interpreter launches an application by creating a process and loading a program into it. Which pair of operations is most closely associated with this task?
📖 Explanation: Process creation and program replacement are commonly performed with fork() followed by exec(). The first creates a child process, while the second loads a new executable image into that process.
Q8. A program needs to determine whether a file exists and retrieve its size and modification time without reading its contents. Which operation is most appropriate?
📖 Explanation: A file-attribute query such as stat() retrieves metadata including file type, size, permissions, and timestamps. It obtains these attributes without reading file data, keeping metadata inspection separate from content transfer through the file interface.
Q9. A process wants to send a short block of data to another process through a pipe. Which operation does the sending process normally use?
📖 Explanation: A process sends data through a pipe by writing bytes to its write end. The receiving process obtains those bytes by reading from the corresponding read end, using the operating system's communication mechanism.
Q10. A system utility asks the operating system to return the machine's host name and kernel release information. Which category includes this request?
📖 Explanation: Information-maintenance calls retrieve system-wide attributes such as host name, operating-system release, and resource information. These requests provide descriptive system data rather than changing process execution or transferring application files, supporting diagnostics and administration.
Q11. A media application opens a large video file, reads several blocks, then needs to continue from a known byte position. Which file-related operation supports changing the current offset?
📖 Explanation: A file-positioning call changes the offset associated with an open file description. The application can then read from a selected location without sequentially consuming every preceding byte, which is useful for random-access workloads.
Q12. A camera application must obtain exclusive access to a camera, configure its capture mode, and then release it. Which classification best fits the key system requests?
📖 Explanation: The camera is a hardware device, so reserving it, configuring its mode, and releasing it are device-management operations. The kernel mediates these requests to coordinate access and protect device state.
Q13. A system-management tool changes a process's scheduling priority and retrieves its resource-usage statistics. Which interpretation is most accurate?
📖 Explanation: Changing a process priority modifies a process attribute, while retrieving resource usage obtains accounting information. System interfaces classify requests by the resource or information being controlled, not merely by the program making them.
Q14. A developer creates a socket, connects it to a remote server, sends a request, and receives a response. Which system-call category primarily supports this sequence?
📖 Explanation: Socket operations establish endpoints and exchange data between processes, often across different computers. Creating, connecting, sending, and receiving through sockets are communication services provided by the operating system for networked applications.
Q15. A file server checks a user's identity and access rights before allowing a write request. Which system-call concern is central to this check?
📖 Explanation: Protection mechanisms verify whether a subject is permitted to perform a requested operation on a resource. Checking identity and write permissions prevents unauthorized modification even when a valid file descriptor is supplied.
Q16. A parent process opens a log file and then creates a child using fork(). The child writes to the inherited descriptor. Which statement best describes the relationship?
📖 Explanation: After fork(), the child inherits copies of the parent's descriptors. Corresponding descriptors can refer to the same open-file description, so they may share the current file offset and status flags.
Q17. A student classifies stat() as a file-reading call because it returns a file's size. What is the conceptual mistake?
📖 Explanation: stat() retrieves metadata describing a file, such as size, timestamps, and permissions. It does not transfer the file's contents; reading data bytes is a separate file-management operation that returns actual file data.
Q18. A monitoring trace shows: getpid() returns 812 ; time() returns 1795171200 ; uname() returns system information. Which category best groups all three calls?
📖 Explanation: getpid(), time(), and uname() provide process or system attributes rather than transferring application data. They are information-maintenance operations because their primary purpose is retrieving information about execution or the system.
Q19. A process calls open() and receives descriptor 3, then calls read() and receives 20, followed by close() returning success. What do the three calls accomplish, in order?
📖 Explanation: open() establishes access and returns a descriptor, read() reports the number of bytes transferred, and close() releases the descriptor. The return value 20 indicates that twenty bytes were read successfully.
Q20. A server uses shared memory for high-volume communication between two local processes. Which additional requirement is especially important?
📖 Explanation: Shared memory avoids repeated message copying, but both processes can access the same data concurrently. Mutexes, semaphores, or other synchronization mechanisms are needed to prevent races and maintain consistent shared state.
Q21. A service runs with elevated privileges and accepts a user-supplied file path. It checks the file's permissions, then opens the path in a separate system call. What security issue can arise if the path is changed between the calls?
📖 Explanation: Separating authorization from the actual open creates a time-of-check to time-of-use race. An attacker may replace a path component after checking, causing the privileged service to open an unintended object.
Q22. A network server executes socket(), bind(), listen(), accept(), recv(), and send(). Which grouping correctly describes the purpose of these calls?
📖 Explanation: socket(), bind(), listen(), and accept() establish and manage a communication endpoint. recv() and send() exchange data over that endpoint, combining connection management and data transfer within the operating system's networking interface.
Q23. A program creates a shared-memory object, attaches it to its address space, accesses the shared region, and later detaches it. Which sequence of conceptual operations is represented?
📖 Explanation: Shared-memory interfaces create a region, map or attach it into a process address space, permit shared access, and detach it when no longer needed. Separate cleanup calls may remove the shared object after users finish.
Q24. A student says chmod() transfers file contents because it changes what users can do with a file. Which correction is technically accurate?
📖 Explanation: chmod() changes permission bits associated with a file, affecting authorization decisions. File-content transfer is performed by calls such as read() and write(), while permission changes operate on metadata rather than the stored data.
Q25. A resource manager must allow a process to change its user identity from a privileged identity to an ordinary identity after setup. Which system-call area is most directly involved?
📖 Explanation: Identity and privilege-management interfaces control credentials used in access checks. Changing user or group identity can reduce a process's authority after privileged initialization, according to the operating system's credential and authorization rules.
Q26. A utility records this trace: chmod(file, 0640) succeeds ; stat(file) reports permissions 0640 ; read(file) returns 12 bytes. Which interpretation correctly distinguishes the calls?
📖 Explanation: chmod() updates access permissions, stat() retrieves file attributes, and read() transfers file data. These calls act on authorization metadata, descriptive metadata, and content bytes, respectively, keeping three distinct file operations separate.
Q27. A process requests a device-specific operation through ioctl(), then uses read() to obtain data from the same device. Why are both operations useful?
📖 Explanation: ioctl() handles device-specific control functions such as setting modes or querying status. read() retrieves data from the device stream or buffer, so control and data-transfer operations have distinct purposes defined by the device driver.
Q28. A communication trace contains these events: Process A creates a pipe ; A writes 9 bytes ; Process B reads 4 bytes ; B reads 5 bytes ; A closes its write end. How many bytes remain unread after the second read?
📖 Explanation: The first read consumes four of the nine bytes, leaving five. The second read consumes those remaining five bytes, so the pipe buffer contains no unread data after the second successful read.
Q29. A process requests access() on a pathname and receives permission to read it. Before the process later opens the file, its permissions are changed. Which principle should a secure application follow?
📖 Explanation: An access() check is only a point-in-time test and does not reserve the object or guarantee a later operation will succeed. The actual open or read must still be checked by the kernel.
Q30. A privileged server must create a child, communicate a job description to it, obtain the child's completion status, and record the completion time. Which mapping of operations to system-call categories is correct?
📖 Explanation: Creating and waiting for a child are process-control tasks, transferring its job description is communication, and retrieving completion time is information maintenance. Separating requests by purpose clarifies the system services involved.