CS703 – Operating Systems: Midterm Important MCQs (73 Solved Questions)
Virtual University of Pakistan • Read every solved MCQ with its verified answer key directly on this page. Free, no login required.
All 664 Midterm Packs · CS703 Course Page · CS703 Subjective Pack (45 Q&As)
-
The two main functions of an operating system are to provide the user with an extended (virtual) machine and to:
Topic: Operating System Basics and System Calls
- Manage the I/O devices and other system resources ✓ Correct answer
- Compile user programs into machine code
- Provide a graphical user interface
- Connect the computer to the Internet
-
System calls provide the interface between:
Topic: Operating System Basics and System Calls
- A process and the operating system ✓ Correct answer
- The compiler and the hardware
- Two user applications
- The user and the command interpreter
-
Which of the following is NOT one of the main types of system calls?
Topic: Operating System Basics and System Calls
- Process control
- File management
- Device management
- Program compilation ✓ Correct answer
-
In the top-down view of an operating system, all services are involved and accomplished through ______ calls.
Topic: Operating System Basics and System Calls
- System ✓ Correct answer
- Data
- Process
- Memory
-
A trap is caused by ______ and is synchronous.
Topic: Operating System Basics and System Calls
- An event external to the processor
- The executing program itself ✓ Correct answer
- A hardware device failure
- Another process
-
Which of the following operations may safely be performed in user mode?
Topic: Operating System Basics and System Calls
- Disabling all interrupts
- Setting the date-time clock
- Reading the date-time clock ✓ Correct answer
- Changing the memory map
-
Multiprogramming keeps the CPU busy mainly by:
Topic: Operating System Basics and System Calls
- Running several programs on several processors
- Switching the CPU to another process while one process waits for I/O ✓ Correct answer
- Increasing the clock speed of the CPU
- Using larger main memory
-
Spooling uses ______ as a huge buffer for holding output for devices such as printers.
Topic: Operating System Basics and System Calls
- Cache memory
- A register file
- The disk ✓ Correct answer
- Main memory
-
On early computers there was no DMA, so every byte of data read or written was handled by the CPU. The main implication of this was that:
Topic: Operating System Basics and System Calls
- Multiprogramming was impossible to implement
- The CPU remained fully occupied doing I/O, so multiprogramming gained little in CPU utilization ✓ Correct answer
- Programs could not use interrupts
- The operating system had to be written in assembly language
-
The main purpose of having two distinct modes, kernel mode and user mode, is to:
Topic: Operating System Basics and System Calls
- Make programs run faster
- Protect the operating system from erroneous or malicious user programs ✓ Correct answer
- Allow more than one user to log in
- Reduce the size of the kernel
-
The command interpreter is usually kept separate from the kernel because:
Topic: Operating System Basics and System Calls
- It runs faster outside the kernel
- It is not needed for the kernel's working and can be changed or replaced without modifying the kernel ✓ Correct answer
- The kernel cannot read user commands
- It must be written in a different language
-
Which of the following is NOT one of the five major activities of an operating system in regard to process management?
Topic: Operating System Basics and System Calls
- Creation and deletion of processes
- Suspension and resumption of processes
- Provision of mechanisms for process synchronization
- Disk scheduling ✓ Correct answer
-
In a microkernel-based system, policy decisions are made in user space, while the mechanisms are implemented in:
Topic: Kernel Architecture and Process Assignment
- The microkernel ✓ Correct answer
- Registers
- User applications
- Device drivers
-
In ______ architecture of process assignment, key kernel functions always run on a particular processor.
Topic: Kernel Architecture and Process Assignment
- Kernel level
- Master/Slave ✓ Correct answer
- Peer
- Global
-
In ______ architecture of process assignment, the operating system can execute on any processor and each processor does its own self-scheduling.
Topic: Kernel Architecture and Process Assignment
- Global Queue
- Master/Slave
- Peer Architecture ✓ Correct answer
- Kernel level
-
A non-process kernel executes the kernel code outside of any ______.
Topic: Kernel Architecture and Process Assignment
- Address space
- Module
- Event
- Process ✓ Correct answer
-
The primary disadvantage of the microkernel architecture is:
Topic: Kernel Architecture and Process Assignment
- It is less secure than a monolithic kernel
- The overhead of inter-process communication and message passing between user processes and system services ✓ Correct answer
- New services cannot be added to it
- It cannot support multiprocessing
-
An important benefit of the microkernel architecture is that:
Topic: Kernel Architecture and Process Assignment
- Adding a new service does not require modifying the kernel ✓ Correct answer
- It eliminates the need for system calls
- It makes device drivers run in kernel mode
- It removes all communication overhead
-
Separating policy from mechanism in a microkernel-based operating system means that:
Topic: Kernel Architecture and Process Assignment
- All policies are fixed inside the kernel
- Basic mechanisms are implemented in the kernel while policy decisions are made by user-level servers ✓ Correct answer
- User programs make all mechanism decisions
- The kernel contains no mechanisms at all
-
Load sharing in a multiprocessor system refers to making sure that:
Topic: Kernel Architecture and Process Assignment
- All processes share a single address space
- No processor sits idle while other processors have waiting processes ✓ Correct answer
- All processors run at the same clock speed
- Processes are never migrated between processors
-
A progress graph is used to depict:
Topic: Kernel Architecture and Process Assignment
- The memory layout of a process
- The discrete execution state space of concurrent threads ✓ Correct answer
- The order of disk requests
- The hierarchy of file directories
-
If a parent process terminates without reaping its child, the child process will be reaped by the ______ process.
Topic: Processes and Threads
- Fork
- Init ✓ Correct answer
- Shell
- Scheduler
-
Explicit reaping is only required for ______ running processes.
Topic: Processes and Threads
- Short
- Medium
- Long ✓ Correct answer
- All
-
The fork() system call returns ______ in the child process.
Topic: Processes and Threads
- The child's PID
- -1
- 0 ✓ Correct answer
- The parent's PID
-
A process that has terminated but whose parent has not yet reaped it is called a:
Topic: Processes and Threads
- Orphan process
- Zombie process ✓ Correct answer
- Daemon process
- Init process
-
All threads belonging to the same process share:
Topic: Processes and Threads
- Their own separate address spaces
- The process address space, including code, data and heap ✓ Correct answer
- Only the CPU registers
- Nothing at all
-
A thread may fail to be created when:
Topic: Processes and Threads
- The process already has one thread
- The system has reached its limit on the number of threads or has insufficient resources such as memory ✓ Correct answer
- The thread has no name
- The CPU is idle
-
A multithreaded solution on a single-processor system performs better than a single-threaded solution when:
Topic: Processes and Threads
- The program is purely CPU-bound
- A thread frequently blocks, for example on a page fault, so another thread can use the CPU in the meantime ✓ Correct answer
- The program uses no shared data
- There is only one kernel thread
-
A function is called ______ if and only if it accesses no shared variables when called from multiple threads.
Topic: Processes and Threads
- Atomic
- Reentrant ✓ Correct answer
- Recursive
- Idempotent
-
User ______ can create lots of kernel work, i.e. many network packets may come in that the operating system has to process when doing a read or write system call.
Topic: Processes and Threads
- Process
- Thread ✓ Correct answer
- Input
- Output
-
In the fork_test() code discussed in lectures, five new processes are created in total (excluding the calling process). The final printf("Whatsup") line is therefore printed:
Topic: Processes and Threads
- Five times
- Six times ✓ Correct answer
- Ten times
- Three times
-
Threads are considered harmful mainly because:
Topic: Processes and Threads
- They use too much memory
- Synchronization bugs such as race conditions and deadlocks are easy to introduce and very hard to find and fix ✓ Correct answer
- They cannot run on multiprocessors
- They make programs run slower
-
The process table is needed in a timesharing system in order to:
Topic: Processes and Threads
- Store the files of all users
- Keep track of the state of every process so that a preempted process can be restarted later ✓ Correct answer
- Hold the passwords of users
- Schedule disk requests
-
A queue of threads waiting for something inside a critical region is called a:
Topic: Synchronization
- Semaphore
- Condition variable ✓ Correct answer
- Monitor
- Mutex
-
If two threads are waiting for a lock and both see it ______, only one of them will grab it.
Topic: Synchronization
- Locked
- Free ✓ Correct answer
- Busy
- Held
-
A semaphore is a variable that is manipulated atomically through the two operations:
Topic: Synchronization
- Lock and unlock
- Wait and signal ✓ Correct answer
- Open and close
- Read and write
-
When a semaphore is used for mutual exclusion, its initial value is:
Topic: Synchronization
- 0
- 1 ✓ Correct answer
- Equal to the number of threads
- -1
-
Condition variables support exactly three operations, which are:
Topic: Synchronization
- Wait, signal and broadcast ✓ Correct answer
- P, V and test
- Lock, unlock and trylock
- Sleep, wakeup and kill
-
Condition variables are not cumulative, which is why they must be used together with a:
Topic: Synchronization
- Critical section
- Monitor
- Semaphore
- Mutex ✓ Correct answer
-
Because condition variables are not cumulative, a signal that is sent when no thread is waiting is:
Topic: Synchronization
- Stored for the next waiting thread
- Lost, because signals are not remembered ✓ Correct answer
- Converted into a broadcast
- Sent to the kernel
-
The lost wakeup problem in condition-variable implementations can be resolved by:
Topic: Synchronization
- Busy waiting
- The deferred signal approach or the speculative signal approach ✓ Correct answer
- Disabling all interrupts
- Using a larger number of locks
-
In a monitor, at any one moment:
Topic: Synchronization
- Many processes may execute monitor procedures simultaneously
- Only one process may be active inside the monitor ✓ Correct answer
- No process may wait inside the monitor
- Condition variables cannot be used
-
In the readers/writers problem, the access rules are that:
Topic: Synchronization
- Many readers and many writers may access the data together
- Many readers may read at the same time, but a writer must have exclusive access ✓ Correct answer
- Only one reader may read at a time
- Writers always have priority over readers
-
Which of the following is NOT one of the classical synchronization problems?
Topic: Synchronization
- Bounded buffer problem
- Readers and writers problem
- Dining philosophers problem
- Banker's algorithm ✓ Correct answer
-
A race condition occurs when:
Topic: Synchronization
- Two threads use different variables
- The outcome of a program depends on the order in which threads execute ✓ Correct answer
- A thread waits too long for a lock
- The CPU runs out of work
-
A thread that returns from a wait on a condition variable must test the condition expression again before proceeding, because:
Topic: Synchronization
- The signal operation erases the condition
- Returning from wait is only a hint that the condition may have become true; another thread may have changed the state first ✓ Correct answer
- Condition variables always wake up all threads
- The lock is never released during a wait
-
______ scheduling assigns priorities to tasks on the basis of their periods.
Topic: CPU Scheduling
- Round robin
- Rate-monotonic ✓ Correct answer
- Earliest deadline first
- Shortest job first
-
In rate-monotonic scheduling, priorities are assigned so that a task with a shorter period gets:
Topic: CPU Scheduling
- Lower priority
- Higher priority ✓ Correct answer
- The same priority as all other tasks
- No priority
-
The rate-monotonic scheduling algorithm uses:
Topic: CPU Scheduling
- Non-preemptive scheduling with dynamic priorities
- Preemptive scheduling with static priorities ✓ Correct answer
- Preemptive scheduling with dynamic priorities
- Non-preemptive scheduling with static priorities
-
The STCF (Shortest Time to Completion First) scheduler runs the job that:
Topic: CPU Scheduling
- Arrived first
- Has the least amount of work left to do ✓ Correct answer
- Has the highest priority
- Has the longest remaining time
-
In SCHED_FIFO scheduling, once a thread starts running it continues to run until it:
Topic: CPU Scheduling
- Is preempted by any newly ready thread
- Blocks or voluntarily yields the CPU ✓ Correct answer
- Uses up one time quantum
- Receives an interrupt
-
Which of the following scheduling algorithms is non-preemptive?
Topic: CPU Scheduling
- Round robin
- Shortest remaining time first
- First-Come First-Served (FCFS) ✓ Correct answer
- Rate-monotonic
-
In preemptive scheduling, the operating system:
Topic: CPU Scheduling
- Never interrupts a running process
- Can suspend a running process and give the CPU to another process ✓ Correct answer
- Runs each process to completion
- Is used only in batch systems
-
Putting two pointers to the same PCB in the ready queue of a round-robin scheduler effectively:
Topic: CPU Scheduling
- Decreases the priority of that process
- Gives that process CPU time more often, i.e. preferential (higher priority) treatment ✓ Correct answer
- Causes a deadlock
- Doubles the memory of the process
-
Interrupts are caused by events ______ to the processor.
Topic: CPU Scheduling
- Internal
- External ✓ Correct answer
- Similar
- Identical
-
In priority scheduling, low-priority processes may wait indefinitely. This problem is called ______ and is commonly solved by aging.
Topic: CPU Scheduling
- Deadlock
- Starvation ✓ Correct answer
- Thrashing
- Fragmentation
-
Which of the following is NOT one of the four necessary conditions for deadlock?
Topic: Deadlock
- Mutual exclusion
- Hold and wait
- Preemption ✓ Correct answer
- Circular wait
-
Preventing deadlock by imposing a total ordering on all resources and requiring requests in increasing order ensures that ______ never occurs.
Topic: Deadlock
- Mutual exclusion
- Hold and wait
- Circular wait ✓ Correct answer
- No preemption
-
If a system is in an unsafe state, then:
Topic: Deadlock
- The system is certainly deadlocked
- Deadlock is possible, but the processes may still complete their execution without entering a deadlock ✓ Correct answer
- All processes are blocked forever
- The operating system must be restarted
-
Three processes share 4 resources of the same type and every process needs at most 2 resources. The system is guaranteed to be deadlock-free because:
Topic: Deadlock
- Resources are preemptible
- At least one process can always obtain both resources it needs, complete, and release them ✓ Correct answer
- Each process holds exactly one resource
- The scheduler uses round robin
-
In a resource allocation graph with single-instance resources, a cycle in the graph indicates that:
Topic: Deadlock
- The system is in a safe state
- A deadlock exists among the processes in the cycle ✓ Correct answer
- All processes will complete
- More resources are needed
-
Deadlock prevention works by ensuring that:
Topic: Deadlock
- All processes finish quickly
- At least one of the four necessary conditions for deadlock can never hold ✓ Correct answer
- Resources are always preemptible
- The system never enters a safe state
-
In ______ allocation, the application explicitly allocates and frees memory space.
Topic: Dynamic Memory Allocation
- Implicit
- Explicit ✓ Correct answer
- Automatic
- Static
-
______ fragmentation occurs when there is enough total heap memory available, but no single free block is large enough to satisfy a request.
Topic: Dynamic Memory Allocation
- Internal
- External ✓ Correct answer
- Heap
- Memory
-
Internal fragmentation is the wasted space that occurs:
Topic: Dynamic Memory Allocation
- Between two free blocks
- Inside an allocated block, because the block is larger than the requested payload ✓ Correct answer
- When the heap is completely full
- In the free list links
-
In an implicit free list, the allocator finds a free block by:
Topic: Dynamic Memory Allocation
- Following pointers stored in free blocks
- Scanning the blocks of the heap one by one using the size in each block's header ✓ Correct answer
- Asking the operating system for each request
- Using a hash table of block sizes
-
In an explicit free list, the doubly linked list contains:
Topic: Dynamic Memory Allocation
- All blocks of the heap
- Only the free blocks ✓ Correct answer
- Only the allocated blocks
- Only blocks larger than a fixed size
-
The worst-case allocation time of an implicit free list is proportional to:
Topic: Dynamic Memory Allocation
- The number of free blocks only
- The total number of blocks in the heap ✓ Correct answer
- The size of the largest block
- A constant
-
With simple segregated free lists (without coalescing while freeing), freeing a block takes:
Topic: Dynamic Memory Allocation
- Time proportional to the heap size
- Constant time, because the block is simply placed on the list for its size class ✓ Correct answer
- Time proportional to the number of free blocks
- Time proportional to the block size
-
Coalescing in dynamic memory allocation means:
Topic: Dynamic Memory Allocation
- Splitting a free block into two smaller blocks
- Merging adjacent free blocks into one larger free block ✓ Correct answer
- Copying a block to a new location
- Marking a block as allocated
-
In the boundary-tag method, each block carries a header and a footer so that the allocator can:
Topic: Dynamic Memory Allocation
- Encrypt the block contents
- Find and merge with the previous free block when a block is freed ✓ Correct answer
- Sort the blocks by size
- Detect stack overflows
-
With a 4-byte header, a 4-byte footer, double-word (8-byte) alignment and no zero-size payloads allowed, the minimum block size is:
Topic: Dynamic Memory Allocation
- 8 bytes
- 12 bytes
- 16 bytes ✓ Correct answer
- 24 bytes
-
In a block header word, the allocation status (allocated or free) is usually stored in:
Topic: Dynamic Memory Allocation
- The most significant byte
- The least significant bit(s) of the size word ✓ Correct answer
- A separate bitmap only
- The footer only