Back to Practice OS & Networking

Memory Management - Practice MCQs for CCAT

50 Questions Section B: Programming OS & Networking

Memory Management Question Bank for C-CAT

Topic-wise Memory Management MCQs for CDAC C-CAT preparation with answers and explanations.

Q1.
Paging eliminates:
AInternal fragmentation
BExternal fragmentation
CBoth
DNeither
Show Answer & Explanation

Correct Answer: B - External fragmentation

Paging eliminates external fragmentation (may have internal).

Q2.
Segmentation is based on:
AFixed size partitions
BRandom allocation
CLogical divisions of program
DContiguous allocation
Show Answer & Explanation

Correct Answer: C - Logical divisions of program

Segmentation divides memory based on logical units (code, data, stack).

Q3.
Which page replacement is optimal?
AFIFO
BLRU
CRandom
DOptimal (Belady's)
Show Answer & Explanation

Correct Answer: D - Optimal (Belady's)

Optimal algorithm replaces page not needed for longest time (theoretical).

Q4.
TLB stands for:
ATranslation Lookaside Buffer
BTable Lookup Buffer
CTransfer Load Buffer
DTotal Logical Block
Show Answer & Explanation

Correct Answer: A - Translation Lookaside Buffer

TLB is a cache for page table entries to speed up address translation.

Q5.
Best fit allocation:
AUses smallest sufficient hole
BUses first available hole
CUses largest hole
DRandom hole
Show Answer & Explanation

Correct Answer: A - Uses smallest sufficient hole

Best fit finds smallest hole that is big enough.

Q6.
First fit allocation:
AScans all holes
BUses first sufficient hole
CUses best hole
DUses worst hole
Show Answer & Explanation

Correct Answer: B - Uses first sufficient hole

First fit allocates first hole that is large enough.

Q7.
Internal fragmentation occurs in:
AVariable partitioning
BBest fit
CSegmentation
DFixed partitioning/Paging
Show Answer & Explanation

Correct Answer: D - Fixed partitioning/Paging

Fixed size partitions cause internal fragmentation (unused space within partition).

Q8.
Page table maps:
APhysical to virtual
BProcess to memory
CDisk to memory
DVirtual page to physical frame
Show Answer & Explanation

Correct Answer: D - Virtual page to physical frame

Page table translates virtual page numbers to physical frame numbers.

Q9.
Demand paging loads pages:
AAll at once
BNever
COnly when needed
DRandomly
Show Answer & Explanation

Correct Answer: C - Only when needed

Demand paging loads pages into memory only when accessed.

Q10.
Belady's anomaly is seen in:
ALRU
BOptimal
CLFU
DFIFO
Show Answer & Explanation

Correct Answer: D - FIFO

FIFO can have more page faults with more frames (Belady's anomaly).

Q11.
Virtual memory allows:
AOnly physical memory access
BNo page faults
CFaster disk access
DPrograms larger than physical memory to run
Show Answer & Explanation

Correct Answer: D - Programs larger than physical memory to run

Virtual memory allows execution of programs larger than available physical memory.

Q12.
Page fault occurs when:
APage is in memory
BCPU is idle
CRequired page is not in memory
DProcess terminates
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.

Q13.
Thrashing occurs when:
ACPU utilization is high
BSystem spends more time paging than executing
CMemory is empty
DNo page faults occur
Show Answer & Explanation

Correct Answer: B - System spends more time paging than executing

Thrashing occurs when excessive paging reduces CPU utilization dramatically.

Q14.
Working set model is used to:
AIncrease page faults
BSpeed up disk
CDetermine optimal page allocation
DCompress memory
Show Answer & Explanation

Correct Answer: C - Determine optimal page allocation

Working set model determines the set of pages a process actively uses.

Q15.
Compaction is used to:
ACreate fragmentation
BReduce external fragmentation
CIncrease memory size
DDelete processes
Show Answer & Explanation

Correct Answer: B - Reduce external fragmentation

Compaction combines free memory fragments into one contiguous block.

Q16.
Logical address is also called:
APhysical address
BDisk address
CReal address
DVirtual address
Show Answer & Explanation

Correct Answer: D - Virtual address

Logical address (virtual address) is generated by CPU; mapped to physical address.

Q17.
MMU stands for:
AMain Memory Unit
BMemory Management Unit
CMemory Mapping Unit
DMultiple Memory Unit
Show Answer & Explanation

Correct Answer: B - Memory Management Unit

MMU (Memory Management Unit) translates virtual addresses to physical addresses.

Q18.
Page size is typically:
AVariable
BEqual to frame size and fixed
CDetermined by user
DFixed (power of 2)
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).

Q19.
LRU page replacement:
AReplaces first loaded page
BReplaces random page
CReplaces least recently used page
DReplaces most used page
Show Answer & Explanation

Correct Answer: C - Replaces least recently used page

LRU replaces the page that has not been used for the longest time.

Q20.
Swapping involves:
AExchanging data between cache and RAM
BMoving entire process between memory and disk
CCopying files
DNetwork data transfer
Show Answer & Explanation

Correct Answer: B - Moving entire process between memory and disk

Swapping moves entire processes between main memory and disk.

Q21.
What is the purpose of paging in memory management?
ATo speed up the CPU
BTo increase disk space
CTo allow physical memory to be non-contiguous by dividing it into fixed-size frames
DTo manage network buffers
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.

Q22.
What is a page fault?
AAn error in the page table
BA hardware failure
CA situation where the referenced page is not in physical memory and must be brought in from disk
DA page size mismatch
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.

Q23.
Which page replacement algorithm is known as the optimal algorithm?
AOptimal (OPT/MIN)
BLRU
CFIFO
DClock
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.

Q24.
What is segmentation?
ADividing memory into fixed-size blocks
BA networking protocol
CA type of disk scheduling
DDividing memory into variable-size logical units based on the program's structure
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.

Q25.
In a paging system with a page size of 4 KB and a 32-bit logical address, how many bits are used for the page offset?
A10
B16
C14
D12
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.

Q26.
What is the Belady's anomaly?
ALRU performs worse than FIFO
BOptimal algorithm fails in some cases
CIn FIFO page replacement, increasing the number of frames can increase the number of page faults
DPage fault rate always decreases with more frames
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.

Q27.
What is the Translation Lookaside Buffer (TLB)?
AA high-speed cache that stores recent page table entries for faster address translation
BA buffer for disk I/O
CA network buffer
DA CPU register
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.

Q28.
What is internal fragmentation?
AWasted space between allocated memory blocks
BMemory corruption
CFragmentation of files on disk
DWasted space within an allocated memory block due to fixed partition sizes
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.

Q29.
What is external fragmentation?
AMemory wasted inside allocated blocks
BFree memory is scattered in small non-contiguous blocks that cannot satisfy a request
CDisk fragmentation
DNetwork packet loss
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.

Q30.
In a system using LRU page replacement with 3 frames, given the reference string 7,0,1,2,0,3,0,4,2,3, how many page faults occur?
A7
B8
C9
D10
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.

Q31.
What is virtual memory?
AExtra RAM installed on the motherboard
BMemory used by virtual machines only
CA technique that allows execution of processes not completely in memory by using disk as an extension
DCache memory
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.

Q32.
What is demand paging?
ALoading all pages of a process at startup
BPaging used only in real-time systems
CPre-loading pages before they are needed
DLoading a page into memory only when it is needed (on demand)
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.

Q33.
What is the working set of a process?
AThe total memory allocated to a process
BThe set of pages referenced by the process in the most recent time window
CThe number of CPU cycles used
DThe set of files opened by the process
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.

Q34.
What is compaction in memory management?
ACompressing files on disk
BRemoving unused pages
CMoving processes to create a single large block of free memory to reduce external fragmentation
DCompressing data in RAM
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.

Q35.
What is the purpose of a page table?
ATo map logical page numbers to physical frame numbers
BTo store the contents of pages
CTo count the number of pages
DTo store page replacement history
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.

Q36.
In segmentation, what happens if the offset exceeds the segment limit?
AThe segment is extended
BA segmentation fault (trap) is generated
CThe offset wraps around
DNothing happens
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.

Q37.
What is the effective memory access time if TLB hit ratio is 90%, TLB access time is 20 ns, and memory access time is 100 ns?
A120 ns
B130 ns
C140 ns
D220 ns
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.

Q38.
What is a page replacement algorithm?
AAn algorithm that decides which page to remove from memory when a new page needs to be loaded
BAn algorithm to create new pages
CAn algorithm to encrypt pages
DAn algorithm for disk scheduling
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.

Q39.
What is the FIFO page replacement algorithm?
AReplace the page that has been in memory the longest
BReplace the most recently used page
CReplace the least recently used page
DReplace a random page
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.

Q40.
What is the LRU page replacement algorithm?
AReplace the page that has not been used for the longest time
BReplace the most frequently used page
CReplace the largest page
DReplace the first page loaded
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.

Q41.
What is a multi-level page table?
AA page table stored on multiple disks
BA hierarchical page table that divides the page table into multiple levels to save memory
CA page table with multiple entries per page
DA table for multi-core processors
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.

Q42.
What is the purpose of the valid/invalid bit in a page table entry?
ATo indicate whether the page is currently in physical memory
BTo indicate page size
CTo indicate page priority
DTo store the frame number
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.

Q43.
In a system with a logical address space of 64 pages and a physical memory of 32 frames, each of size 1 KB, what is the size of the logical address space?
A32 KB
B16 KB
C128 KB
D64 KB
Show Answer & Explanation

Correct Answer: D - 64 KB

Logical address space = Number of pages × Page size = 64 × 1 KB = 64 KB.

Q44.
What is the Second Chance (Clock) page replacement algorithm?
AA modified FIFO algorithm that gives pages a second chance based on a reference bit
BA modified LRU algorithm
CA random replacement algorithm
DA priority-based algorithm
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.

Q45.
What is the difference between logical and physical addresses?
AThey are the same
BLogical address is generated by CPU; physical address is the actual memory location
CPhysical address is generated by CPU; logical address is on disk
DLogical addresses are only used in paging
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.

Q46.
What is copy-on-write in the context of fork()?
AParent and child share memory pages until one of them modifies a page, at which point a copy is made
BParent and child always share the same memory
CThe child immediately copies all parent memory
DIt prevents the child from writing to memory
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.

Q47.
How many page table entries are needed for a process with a 32-bit address space and 4 KB pages?
A210
B232
C212
D220
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.

Q48.
What is an inverted page table?
AA single page table for the entire system with one entry per physical frame
BA page table sorted in reverse order
CA page table stored on disk
DA table that maps frames to processes
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.

Q49.
What is the buddy system in memory allocation?
ATwo processes sharing memory
BA memory allocation scheme that divides memory into power-of-2 sized blocks and splits/merges them
CA distributed memory system
DA cache management technique
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.

Q50.
What causes thrashing and how can it be resolved?
AExcessive page faults due to insufficient frames; resolved by reducing degree of multiprogramming or using working set model
BCPU overheating; resolved by cooling
CToo many threads; resolved by killing threads
DDisk failure; resolved by replacing disk
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.

Showing 1-10 of 50 questions