Memory Management Question Bank for C-CAT
Topic-wise Memory Management MCQs for CDAC C-CAT preparation with answers and explanations.
Show Answer & Explanation
Correct Answer: B - External fragmentation
Paging eliminates external fragmentation (may have internal).
Show Answer & Explanation
Correct Answer: C - Logical divisions of program
Segmentation divides memory based on logical units (code, data, stack).
Show Answer & Explanation
Correct Answer: D - Optimal (Belady's)
Optimal algorithm replaces page not needed for longest time (theoretical).
Show Answer & Explanation
Correct Answer: A - Translation Lookaside Buffer
TLB is a cache for page table entries to speed up address translation.
Show Answer & Explanation
Correct Answer: A - Uses smallest sufficient hole
Best fit finds smallest hole that is big enough.
Show Answer & Explanation
Correct Answer: B - Uses first sufficient hole
First fit allocates first hole that is large enough.
Show Answer & Explanation
Correct Answer: D - Fixed partitioning/Paging
Fixed size partitions cause internal fragmentation (unused space within partition).
Show Answer & Explanation
Correct Answer: D - Virtual page to physical frame
Page table translates virtual page numbers to physical frame numbers.
Show Answer & Explanation
Correct Answer: C - Only when needed
Demand paging loads pages into memory only when accessed.
Show Answer & Explanation
Correct Answer: D - FIFO
FIFO can have more page faults with more frames (Belady's anomaly).
Show Answer & Explanation
Correct Answer: D - Programs larger than physical memory to run
Virtual memory allows execution of programs larger than available physical memory.
Show Answer & Explanation
Correct Answer: C - Required page is not in memory
Page fault occurs when the required page is not found in main memory.
Show Answer & Explanation
Correct Answer: B - System spends more time paging than executing
Thrashing occurs when excessive paging reduces CPU utilization dramatically.
Show Answer & Explanation
Correct Answer: C - Determine optimal page allocation
Working set model determines the set of pages a process actively uses.
Show Answer & Explanation
Correct Answer: B - Reduce external fragmentation
Compaction combines free memory fragments into one contiguous block.
Show Answer & Explanation
Correct Answer: D - Virtual address
Logical address (virtual address) is generated by CPU; mapped to physical address.
Show Answer & Explanation
Correct Answer: B - Memory Management Unit
MMU (Memory Management Unit) translates virtual addresses to physical addresses.
Show Answer & Explanation
Correct Answer: B - Equal to frame size and fixed
Page size equals frame size and is fixed, typically a power of 2 (e.g., 4KB).
Show Answer & Explanation
Correct Answer: C - Replaces least recently used page
LRU replaces the page that has not been used for the longest time.
Show Answer & Explanation
Correct Answer: B - Moving entire process between memory and disk
Swapping moves entire processes between main memory and disk.
Show Answer & Explanation
Correct Answer: C - To allow physical memory to be non-contiguous by dividing it into fixed-size frames
Paging divides physical memory into fixed-size frames and logical memory into pages of the same size. This eliminates external fragmentation and allows a process's physical memory to be non-contiguous.
Show Answer & Explanation
Correct Answer: C - A situation where the referenced page is not in physical memory and must be brought in from disk
A page fault occurs when a process references a page that is not currently in physical memory. The OS must then load the required page from disk into a free frame, which involves a context switch and disk I/O.
Show Answer & Explanation
Correct Answer: A - Optimal (OPT/MIN)
The Optimal (OPT/MIN) algorithm replaces the page that will not be used for the longest period of time in the future. It has the lowest page fault rate but is impractical as it requires future knowledge.
Show Answer & Explanation
Correct Answer: D - Dividing memory into variable-size logical units based on the program's structure
Segmentation divides the logical address space into variable-size segments based on the program's logical structure (code, data, stack, etc.). Each segment has a base address and a limit.
Show Answer & Explanation
Correct Answer: D - 12
Page offset bits = log₂(page size) = log₂(4 KB) = log₂(4096) = 12 bits. The remaining 20 bits (32 - 12) are used for the page number.
Show Answer & Explanation
Correct Answer: C - In FIFO page replacement, increasing the number of frames can increase the number of page faults
Belady's anomaly is a phenomenon where increasing the number of page frames results in an increase in page faults for the FIFO page replacement algorithm. This counterintuitive behavior doesn't occur with LRU or OPT.
Show Answer & Explanation
Correct Answer: A - A high-speed cache that stores recent page table entries for faster address translation
The TLB is a high-speed associative memory (cache) that stores recently used page table entries. It speeds up address translation by avoiding the need to access the page table in main memory for every memory reference.
Show Answer & Explanation
Correct Answer: D - Wasted space within an allocated memory block due to fixed partition sizes
Internal fragmentation occurs when allocated memory is larger than the requested memory. In paging, the last page of a process may not be completely filled, wasting the remaining space within that frame.
Show Answer & Explanation
Correct Answer: B - Free memory is scattered in small non-contiguous blocks that cannot satisfy a request
External fragmentation occurs when total free memory is sufficient for a request but is scattered in small non-contiguous blocks. Compaction or paging can solve this problem.
Show Answer & Explanation
Correct Answer: B - 8
With 3 frames and LRU replacement, faults occur for 7, 0, 1, 2, 3, 4, the later 2, and the final 3. The two references to 0 after it is already loaded are hits. Total page faults = 8.
Show Answer & Explanation
Correct Answer: C - A technique that allows execution of processes not completely in memory by using disk as an extension
Virtual memory is a memory management technique that allows processes to execute even if they are not entirely loaded in physical memory. It uses disk storage to extend available memory, providing an illusion of larger memory.
Show Answer & Explanation
Correct Answer: D - Loading a page into memory only when it is needed (on demand)
Demand paging loads pages into memory only when they are referenced. Initially, no pages are in memory. When a page fault occurs, the required page is loaded from disk. This reduces memory usage and startup time.
Show Answer & Explanation
Correct Answer: B - The set of pages referenced by the process in the most recent time window
The working set of a process is the set of pages that the process has referenced in the most recent Δ time window. It approximates the locality of the process and is used to prevent thrashing.
Show Answer & Explanation
Correct Answer: C - Moving processes to create a single large block of free memory to reduce external fragmentation
Compaction shuffles memory contents to place all free memory together in one large block. It solves external fragmentation but is expensive as it requires moving processes and updating all addresses.
Show Answer & Explanation
Correct Answer: A - To map logical page numbers to physical frame numbers
A page table maps each logical page number to its corresponding physical frame number. Each process has its own page table. The page table also contains valid/invalid bits and protection bits.
Show Answer & Explanation
Correct Answer: B - A segmentation fault (trap) is generated
If the offset is greater than or equal to the segment limit, the hardware generates a segmentation fault (trap to the OS) because the address is outside the bounds of the segment, indicating an illegal memory access.
Show Answer & Explanation
Correct Answer: B - 130 ns
On a TLB hit, time = 20 + 100 = 120 ns. On a miss, time = 20 + 100 + 100 = 220 ns. Effective access time = 0.9 x 120 + 0.1 x 220 = 108 + 22 = 130 ns.
Show Answer & Explanation
Correct Answer: A - An algorithm that decides which page to remove from memory when a new page needs to be loaded
A page replacement algorithm determines which existing page in memory should be removed (swapped out) when a new page needs to be loaded and no free frames are available.
Show Answer & Explanation
Correct Answer: A - Replace the page that has been in memory the longest
FIFO (First In, First Out) page replacement replaces the page that has been in memory the longest (the oldest page). It is simple to implement using a queue but suffers from Belady's anomaly.
Show Answer & Explanation
Correct Answer: A - Replace the page that has not been used for the longest time
LRU (Least Recently Used) replaces the page that has not been used for the longest period of time. It approximates the optimal algorithm and does not suffer from Belady's anomaly.
Show Answer & Explanation
Correct Answer: B - A hierarchical page table that divides the page table into multiple levels to save memory
A multi-level page table divides the large page table into smaller tables arranged hierarchically. Only the needed portions are kept in memory, significantly reducing the memory required for page tables.
Show Answer & Explanation
Correct Answer: A - To indicate whether the page is currently in physical memory
The valid/invalid bit indicates whether a page is in physical memory (valid) or not (invalid). If a process tries to access a page marked as invalid, a page fault trap is generated.
Show Answer & Explanation
Correct Answer: D - 64 KB
Logical address space = Number of pages × Page size = 64 × 1 KB = 64 KB.
Show Answer & Explanation
Correct Answer: A - A modified FIFO algorithm that gives pages a second chance based on a reference bit
The Second Chance (Clock) algorithm is a modified FIFO that uses a reference bit. When a page is to be replaced, if its reference bit is set, it gets a 'second chance' — the bit is cleared and the next page is considered.
Show Answer & Explanation
Correct Answer: B - Logical address is generated by CPU; physical address is the actual memory location
A logical (virtual) address is generated by the CPU during program execution. A physical address is the actual address in main memory. The Memory Management Unit (MMU) translates logical addresses to physical addresses.
Show Answer & Explanation
Correct Answer: A - Parent and child share memory pages until one of them modifies a page, at which point a copy is made
Copy-on-write (COW) is an optimization where, after fork(), parent and child share the same pages marked read-only. When either process writes to a shared page, a private copy is made. This avoids unnecessary copying.
Show Answer & Explanation
Correct Answer: D - 220
Number of pages = Address space size / Page size = 232 / 212 = 220 = 1,048,576 page table entries. This is why multi-level page tables or inverted page tables are used for large address spaces.
Show Answer & Explanation
Correct Answer: A - A single page table for the entire system with one entry per physical frame
An inverted page table has one entry per physical frame (instead of one per logical page). Each entry records which process and page is stored in that frame. It saves memory but makes lookups slower without hashing.
Show Answer & Explanation
Correct Answer: B - A memory allocation scheme that divides memory into power-of-2 sized blocks and splits/merges them
The buddy system allocates memory in blocks whose sizes are powers of 2. When a block is freed, it can be merged with its 'buddy' (adjacent block of the same size) to form a larger block, reducing fragmentation.
Show Answer & Explanation
Correct Answer: A - Excessive page faults due to insufficient frames; resolved by reducing degree of multiprogramming or using working set model
Thrashing occurs when processes don't have enough frames, causing excessive page faults. Solutions include reducing the degree of multiprogramming, using the working set model, or page-fault frequency control.