NEOCODE

Advanced Security MCQs

SEGMENTATION

1. In segmentation, memory is divided into:

Correct Answer: b) Variable-size blocks

Explanation:
Segmentation divides memory into variable-sized segments that correspond to logical units of a program (functions, arrays, etc.).

2. Segmentation allows:

Correct Answer: a) Logical division of a program

Explanation:
Segmentation provides a logical view of memory by dividing programs into meaningful units like functions, arrays, or data structures.

3. The mapping between segment and physical address is stored in:

Correct Answer: b) Segment Table

Explanation:
The segment table contains base addresses and lengths for each segment, used by the MMU to translate logical to physical addresses.

4. The main disadvantage of segmentation is:

Correct Answer: a) External fragmentation

Explanation:
Variable-sized segments lead to external fragmentation as free memory becomes broken into small, non-contiguous pieces over time.

PAGE REPLACEMENT ALGORITHMS

5. Which page replacement algorithm replaces the page that will not be used for the longest time?

Correct Answer: c) Optimal

Explanation:
The Optimal algorithm (OPT) replaces the page that won't be used for the longest time in the future, though it's theoretical as it requires future knowledge.

6. The Belady's anomaly occurs in:

Correct Answer: a) FIFO

Explanation:
Belady's anomaly is the counter-intuitive situation where increasing the number of page frames leads to more page faults in FIFO replacement.

7. The most commonly used page replacement algorithm is:

Correct Answer: b) LRU

Explanation:
Least Recently Used (LRU) approximates optimal behavior by replacing the page that hasn't been used for the longest time, based on past references.

8. The LRU page replacement algorithm can be implemented using:

Correct Answer: d) All of the above

Explanation:
LRU can be implemented with: (1) a stack that moves referenced pages to top, (2) a queue with reference bits, or (3) counters tracking last use timestamps.

FRAGMENTATION (INTERNAL & EXTERNAL)

9. Internal fragmentation occurs in:

Correct Answer: a) Paging

Explanation:
Internal fragmentation occurs in paging when a process doesn't completely fill its last page, wasting the remaining space in that fixed-size frame.

10. External fragmentation occurs in:

Correct Answer: b) Segmentation

Explanation:
External fragmentation happens in segmentation when free memory becomes divided into small, non-contiguous blocks that can't satisfy new requests.

11. Compaction is used to reduce:

Correct Answer: b) External fragmentation

Explanation:
Compaction moves allocated memory blocks together to create larger contiguous free blocks, reducing external fragmentation (but is computationally expensive).

12. Which of the following does not suffer from external fragmentation?

Correct Answer: a) Paging

Explanation:
Paging eliminates external fragmentation because any page can be placed in any available frame, though it may cause internal fragmentation.

VIRTUAL MEMORY & DEMAND PAGING

13. Virtual memory allows:

Correct Answer: a) Execution of programs larger than physical memory

Explanation:
Virtual memory creates the illusion of a very large memory space by using disk storage to extend physical RAM, enabling execution of large programs.

14. Demand paging loads a page into memory only when:

Correct Answer: b) It is referenced

Explanation:
Demand paging follows the "lazy loading" principle - pages are only loaded when they're actually needed (on first access), saving memory space.

15. A page fault occurs when:

Correct Answer: a) A page is not found in memory

Explanation:
A page fault happens when a program accesses a page that's mapped in its address space but not currently loaded in physical memory.