Processes and Threads # MCQs Practice set

Q.1 Which of the following best defines a process in an operating system?

A program in execution
A set of instructions stored on disk
A background job
A hardware resource
Explanation - A process is essentially a program in execution, which includes the program code, current activity, and associated resources.
Correct answer is: A program in execution

Q.2 What is the smallest unit of CPU scheduling?

Thread
Process
Instruction
Job
Explanation - Threads are the smallest unit of CPU scheduling, representing a single sequence of execution within a process.
Correct answer is: Thread

Q.3 Which of these is NOT a component of a process?

Program Counter
Stack
Registers
Cache Memory
Explanation - A process consists of program code, program counter, registers, and stack. Cache memory is hardware, not part of a process.
Correct answer is: Cache Memory

Q.4 What is the main advantage of using threads over processes?

Less memory overhead
No context switching
Faster compilation
Direct hardware access
Explanation - Threads share code and resources of the process, reducing memory overhead compared to processes.
Correct answer is: Less memory overhead

Q.5 Which state is NOT a valid process state?

Running
Waiting
Ready
Finished
Explanation - Common process states include New, Ready, Running, Waiting, and Terminated. 'Finished' is not standard terminology.
Correct answer is: Finished

Q.6 Context switching occurs between:

Processes only
Threads only
Processes and threads
Only within a CPU cycle
Explanation - Context switching can occur between processes or between threads depending on the scheduling unit.
Correct answer is: Processes and threads

Q.7 What is the role of the Process Control Block (PCB)?

Stores process scheduling info
Controls I/O devices
Handles deadlock
Executes system calls
Explanation - PCB contains all the necessary information about a process including state, program counter, registers, and scheduling details.
Correct answer is: Stores process scheduling info

Q.8 Which of the following is unique for each process?

Process ID
Thread ID
Instruction Set
Program Counter
Explanation - Each process has a unique identifier called the Process ID (PID).
Correct answer is: Process ID

Q.9 Multithreading on a single-core CPU achieves:

Parallelism
True concurrency
Time-slicing
Hardware-level execution
Explanation - On a single-core CPU, multithreading is achieved via time-slicing, not true parallelism.
Correct answer is: Time-slicing

Q.10 Which type of threads are managed by the operating system kernel?

User-level threads
Kernel-level threads
Green threads
Application threads
Explanation - Kernel-level threads are managed and scheduled directly by the operating system kernel.
Correct answer is: Kernel-level threads

Q.11 A process in the ‘Ready’ state means:

Waiting for I/O
Executing instructions
Waiting for CPU
Terminated
Explanation - A process in 'Ready' state is prepared to run but is waiting for CPU allocation.
Correct answer is: Waiting for CPU

Q.12 Which of the following is true about threads?

Each thread has its own address space
Threads share the address space of the process
Threads do not require synchronization
Threads cannot communicate
Explanation - Threads share the process address space, which makes communication easier but requires synchronization.
Correct answer is: Threads share the address space of the process

Q.13 Which of these is NOT an advantage of multithreading?

Improved responsiveness
Resource sharing
Increased throughput
Guaranteed security
Explanation - Multithreading improves responsiveness, throughput, and sharing but doesn’t guarantee security.
Correct answer is: Guaranteed security

Q.14 When two threads access shared data simultaneously without synchronization, it may cause:

Deadlock
Context switching
Race condition
Paging
Explanation - A race condition occurs when multiple threads access shared resources concurrently without proper synchronization.
Correct answer is: Race condition

Q.15 Which scheduling algorithm is commonly used for threads?

First-Come, First-Served
Round Robin
Priority Scheduling
All of the above
Explanation - Threads can be scheduled using FCFS, Round Robin, or Priority Scheduling, depending on OS design.
Correct answer is: All of the above

Q.16 In a multithreaded process, which part is shared among all threads?

Registers
Program Counter
Heap and Code
Stack
Explanation - Threads share the process’s code and heap but each thread has its own registers and stack.
Correct answer is: Heap and Code

Q.17 The mechanism that saves and restores process state during switching is:

Context switching
Deadlock handling
Process creation
Paging
Explanation - Context switching saves the state of a running process and restores another process's state to continue execution.
Correct answer is: Context switching

Q.18 Which system call is used to create a new process in UNIX?

exec()
fork()
wait()
exit()
Explanation - The fork() system call creates a new process by duplicating the calling process.
Correct answer is: fork()

Q.19 Which thread model maps many user threads to one kernel thread?

One-to-One
Many-to-One
Many-to-Many
Hybrid
Explanation - In Many-to-One, multiple user threads map to a single kernel thread, limiting concurrency.
Correct answer is: Many-to-One

Q.20 What happens to child processes when a parent process terminates in UNIX?

They terminate automatically
They continue execution
They become orphan processes
They are blocked
Explanation - Orphan processes are adopted by the init process if the parent terminates before them.
Correct answer is: They become orphan processes

Q.21 What does the exec() system call do?

Creates a new process
Replaces the process image
Waits for child process
Terminates a process
Explanation - exec() replaces the current process image with a new program, without creating a new process.
Correct answer is: Replaces the process image

Q.22 Which of these is an inter-process communication mechanism?

Pipes
Semaphores
Message Queues
All of the above
Explanation - Pipes, semaphores, and message queues are widely used IPC mechanisms.
Correct answer is: All of the above

Q.23 In thread libraries, which model requires less kernel involvement?

User-level threads
Kernel-level threads
Hybrid threads
Lightweight processes
Explanation - User-level threads are managed in user space, requiring minimal kernel involvement.
Correct answer is: User-level threads

Q.24 Zombie process refers to:

A process in deadlock
A terminated process with entry in process table
A process waiting for I/O
A process consuming CPU endlessly
Explanation - A zombie process is a terminated process whose exit status has not been collected by its parent.
Correct answer is: A terminated process with entry in process table

Q.25 Which process scheduling is most suitable for interactive systems?

First-Come, First-Served
Round Robin
Shortest Job Next
Priority Scheduling
Explanation - Round Robin scheduling ensures fairness and responsiveness, making it suitable for interactive systems.
Correct answer is: Round Robin