System Calls and Operating System Services # MCQs Practice set

Q.1 What is the primary purpose of a system call?

To provide direct hardware access
To request a service from the operating system
To execute user programs faster
To replace kernel functions
Explanation - System calls act as the interface between user programs and the operating system, allowing applications to request services such as I/O operations or process management.
Correct answer is: To request a service from the operating system

Q.2 Which of the following is an example of a system call for process control?

open()
exec()
read()
write()
Explanation - exec() is a system call used to replace the current process with a new one, which falls under process control.
Correct answer is: exec()

Q.3 System calls provide an interface between:

Compiler and assembler
Kernel and hardware
User programs and the operating system
Application software and middleware
Explanation - System calls allow user programs to interact with the OS, acting as the interface between user-level and kernel-level operations.
Correct answer is: User programs and the operating system

Q.4 Which system call is used to create a new process in Unix?

fork()
exec()
create()
spawn()
Explanation - The fork() system call creates a new process by duplicating the calling process in Unix-based systems.
Correct answer is: fork()

Q.5 What type of system call is 'read()'?

File manipulation
Device management
Information maintenance
Process control
Explanation - The read() system call is used to read data from a file descriptor, making it a file manipulation system call.
Correct answer is: File manipulation

Q.6 Which of the following is NOT an operating system service?

File management
Memory management
Text editing
Process scheduling
Explanation - Text editing is an application-level function, not an OS service. OS services include process, memory, and file management.
Correct answer is: Text editing

Q.7 System calls are generally executed in which mode?

User mode
Kernel mode
Supervisor mode
Virtual mode
Explanation - System calls switch execution to kernel mode so the OS can safely access hardware and resources.
Correct answer is: Kernel mode

Q.8 Which system call is used to terminate a process?

exit()
end()
stop()
halt()
Explanation - The exit() system call ends the execution of a process and returns status information to the parent process.
Correct answer is: exit()

Q.9 In Unix, which system call is used to wait for a child process to terminate?

hold()
wait()
pause()
join()
Explanation - The wait() system call suspends execution of the calling process until one of its child processes terminates.
Correct answer is: wait()

Q.10 Which of the following is a category of system calls?

File manipulation
Instruction pipelining
Process parallelism
Disk defragmentation
Explanation - System calls are grouped into categories like process control, file manipulation, device management, etc.
Correct answer is: File manipulation

Q.11 The 'open()' system call is used for:

Starting a process
Accessing a file
Allocating memory
Creating a thread
Explanation - open() is used to open an existing file or create a new one and returns a file descriptor.
Correct answer is: Accessing a file

Q.12 Which OS service ensures that unauthorized users cannot access the system?

Accounting
Protection
Communication
Scheduling
Explanation - Protection services enforce access control and prevent unauthorized access to system resources.
Correct answer is: Protection

Q.13 What does the 'close()' system call do?

Shuts down the system
Ends a process
Releases a file descriptor
Clears memory
Explanation - close() is used to close an open file descriptor, freeing the resource for reuse.
Correct answer is: Releases a file descriptor

Q.14 Which system call is used to duplicate a file descriptor?

dup()
copy()
clone()
replicate()
Explanation - dup() creates a duplicate of an existing file descriptor, allowing the same file to be accessed in multiple ways.
Correct answer is: dup()

Q.15 In operating systems, 'pipe()' system call is used for:

Inter-process communication
Memory allocation
Disk scheduling
Deadlock prevention
Explanation - pipe() creates a unidirectional communication channel between processes, used in IPC.
Correct answer is: Inter-process communication

Q.16 Which of the following is a system call related to device management?

ioctl()
read()
exit()
wait()
Explanation - The ioctl() system call is used for device-specific input/output operations and control.
Correct answer is: ioctl()

Q.17 The 'getpid()' system call returns:

The parent process ID
The kernel version
The current process ID
The user ID
Explanation - getpid() returns the process ID of the calling process.
Correct answer is: The current process ID

Q.18 Which system call is used to change file permissions in Unix?

chmod()
chperm()
setperm()
fperm()
Explanation - chmod() is a system call that changes the access permissions of a file.
Correct answer is: chmod()

Q.19 Which of the following is NOT a type of system call?

Process control
File manipulation
Network routing
Information maintenance
Explanation - System calls fall into categories such as process control, file manipulation, communication, and information maintenance, but network routing is not one.
Correct answer is: Network routing

Q.20 System calls are generally invoked using:

Library functions
Command-line utilities
Assembly instructions
Background processes
Explanation - System calls are usually accessed through high-level library functions that wrap assembly-level instructions.
Correct answer is: Library functions

Q.21 Which system call is used to create a new file?

create()
open()
touch()
newfile()
Explanation - In Unix, open() with the correct flags can create a new file if it does not already exist.
Correct answer is: open()

Q.22 Which OS service keeps track of CPU and I/O usage for each process?

Protection
Communication
Accounting
Scheduling
Explanation - Accounting services record resource usage for processes, often used for billing or performance evaluation.
Correct answer is: Accounting

Q.23 Which of these is a communication-related system call?

send()
chmod()
fork()
exec()
Explanation - send() is a communication system call used for transmitting data between processes over sockets.
Correct answer is: send()

Q.24 In a system call interface, the kernel provides:

Direct user hardware access
A set of functions for user programs
High-level application software
Memory compilers
Explanation - The kernel provides system call functions that user applications can invoke to access OS services.
Correct answer is: A set of functions for user programs

Q.25 The 'alarm()' system call is used to:

Set a timer for a process
Start another process
Shutdown the system
Allocate memory
Explanation - The alarm() system call schedules a SIGALRM signal to be sent to the process after a specified time.
Correct answer is: Set a timer for a process