🎓 BookMCQ
← Back to 8. Main Memory

📝 Example of Intel 32 Architectures (31 MCQs)

📖 From Operating System • 8. Main Memory • 31 questions available

What is Example of Intel 32 Architectures?

Definition:
Intel IA-32 uses two-level paging with 4 KB4 \text{ KB} pages, segment-paging hybrid, and CR3 register pointing to page directory base for 32-bit virtual addressing.

Example:
Linear address 0xC04010000xC0401000 splits into dir =0x301= 0x301, table =0x001= 0x001, offset =0x000= 0x000 resolved via PD[0x301] → PT → frame.

Reason:
Legacy compatibility and segmentation support shaped early x86 OS design influencing Windows/Linux memory models despite complexity.

6
Easy
15
Medium
10
Hard

📝 All Example of Intel 32 Architectures MCQs

Q1. What is the width of a segment selector in IA‑32 protected mode?

A.16 bits ✅
B.32 bits
C.64 bits
D.8 bits
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: The selector is a 16‑bit value that indexes the descriptor table and contains privilege and requestor bits. Because the descriptor tables are indexed by a 13‑bit index, the selector fits in 16 bits, leaving room for the TI and RPL fields. The other choices describe sizes that are not used for selectors, so they are incorrect. Understanding selector width helps when writing assembly that loads segment registers.

Q2. Which register holds the base address of the current code segment?

A.CS ✅
B.DS
C.ES
D.SS
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: CS (Code Segment) register always points to the segment that contains the currently executing instructions. DS, ES, and SS reference data, extra, and stack segments respectively, and they do not affect instruction fetch. Recognizing the role of CS is essential for addressing code correctly, especially when performing far jumps or calls that change both segment and offset.

Q3. In IA‑32, what is the maximum size of a single segment?

A.4 GB ✅
B.2 GB
C.1 GB
D.8 GB
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: A segment can be as large as the full 32‑bit address space, i.e., 2322^{32} bytes, which equals 4 GB. The limit field can be set to its maximum value, allowing the segment to span the entire linear address range. The other options are smaller fractions of the address space and therefore do not represent the maximum possible segment size.

Q4. Why does IA‑32 provide both segmentation and paging rather than using only one memory‑management scheme?

A.Segmentation gives logical grouping while paging enables fine‑grained protection ✅
B.Paging provides logical grouping and segmentation gives fine‑grained protection
C.Both are redundant; one is kept for backward compatibility
D.Only segmentation is used for virtual memory
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Segmentation lets programmers think in terms of modules such as code, stack, or data, assigning each a name and offset, which matches the programmer’s view of memory. Paging then breaks the linear address space into uniform 4 KB pages, allowing the OS to manage physical memory efficiently and enforce protection at a finer granularity. The combination offers both conceptual clarity and practical flexibility, unlike the other choices.

Q5. How does the descriptor privilege level (DPL) interact with the current privilege level (CPL) when a far call is made?

A.The call succeeds only if DPL ≥ CPL
B.The call succeeds only if DPL ≤ CPL ✅
C.DPL is ignored for far calls
D.CPL is set to DPL after the call
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: When a far call targets a code segment, the CPU checks that the segment’s DPL is less than or equal to the caller’s CPL to prevent less‑privileged code from jumping into more‑privileged code without proper checks. If DPL > CPL, the call is blocked, preserving security. The other options misinterpret the direction of the privilege comparison or ignore the check entirely.

Q6. What advantage does a flat memory model provide when all segments have a limit of 4 GB?

A.Simplifies address calculation because logical and linear addresses are identical ✅
B.Improves cache performance by aligning segments on page boundaries
C.Allows each thread to have its own private stack without extra setup
D.Enables the use of 16‑bit real‑mode instructions
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: When every segment spans the full 4 GB, the offset inside the segment is effectively the same as the linear address, eliminating the need for segment‑to‑linear translation. This simplifies programming and compiler design. While page alignment and private stacks are useful, they are not direct consequences of a flat model, and 16‑bit real‑mode instructions are unrelated.

Q7. In a typical IA‑32 program, which segment usually contains the global variables?

A.Data segment ✅
B.Code segment
C.Stack segment
D.Heap segment
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The data segment (often called .data) is allocated for global and static variables that have a defined lifetime for the duration of the program. The code segment holds executable instructions, the stack segment is used for function call frames, and the heap segment serves dynamic allocation. Confusing these segments leads to incorrect memory accesses, especially when using far pointers.

Q8. Which of the following best describes the purpose of the limit field in a segment descriptor?

A.It defines the maximum offset that can be added to the base address ✅
B.It stores the segment’s selector value
C.It indicates the privilege level of the segment
D.It holds the segment’s type (code or data)
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The limit field tells the CPU the highest valid offset within the segment, preventing accesses beyond the segment’s intended range. The selector is a separate register value, privilege level is encoded in the DPL bits, and the type bits identify whether the segment holds code or data. Misunderstanding the limit can cause segmentation faults.

Q9. How does the IA‑32 processor translate a logical address <segment, offset> to a linear address?

A.It adds the segment base to the offset and checks the limit ✅
B.It multiplies the segment number by 16 and adds the offset
C.It ignores the segment and uses only the offset
D.It uses a hash of the segment and offset
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The processor looks up the segment selector to obtain the base address, then adds the offset, producing a linear address. The limit is verified to ensure the offset does not exceed the segment size. Multiplying by 16 applies only to real‑mode segment:offset calculations, not protected mode, and ignoring the segment would defeat segmentation entirely.

Q10. Why might a compiler place the heap and the stack in separate segments rather than interleaving them?

A.To prevent accidental overwrites between dynamic and automatic storage ✅
B.To allow both to share the same page tables
C.Because the CPU requires distinct segment selectors for heap and stack
D.To enable the use of 64‑bit registers
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Separating heap and stack isolates dynamically allocated memory from automatic variables, reducing the risk that a runaway pointer corrupts the call stack. Although both can be mapped with the same page tables, keeping them in distinct segments simplifies protection checks. The CPU does not mandate separate selectors, and 64‑bit registers are unrelated to IA‑32 segmentation.

Q11. A program uses a far pointer with selector 0x0010 and offset 0x2000. If the descriptor for selector 0x0010 has a base of 0x00400000 and a limit of 0x0000FFFF, what linear address will be generated?

A.4202496 ✅
B.1056768
C.8192
D.4325376
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The linear address is calculated by adding the base (0x00400000) to the offset (0x2000), yielding 0x00402000. The limit of 0x0000FFFF permits offsets up to 65535, so the offset 0x2000 is within bounds. The other alternatives either ignore the base or misuse the selector value, leading to incorrect addresses.

Q12. When a task switch occurs, which segment registers are automatically reloaded from the Task State Segment (TSS)?

A.CS, DS, ES, FS, GS, SS ✅
B.Only CS and SS
C.Only DS and ES
D.All general‑purpose registers
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The TSS contains saved values for all segment registers, allowing the CPU to restore the complete execution context of the new task. This includes code, data, extra, stack, and other segment registers. General‑purpose registers are also stored in the TSS but are not segment registers; they are restored by the task‑switch mechanism as well.

Q13. If a program attempts to access offset 0x8000 in a segment whose limit is 0x7FFF, what exception is raised?

A.General Protection Fault ✅
B.Page Fault
C.Segment Not Present Fault
D.Invalid Opcode Fault
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The CPU detects that the offset exceeds the segment’s limit and raises a General Protection Fault (exception 13). A Page Fault occurs only when paging translation fails, Segment Not Present is raised when the descriptor’s present bit is clear, and Invalid Opcode is unrelated to address limits.

Q14. Why is the descriptor type field important for distinguishing code and data segments?

A.It determines whether execution or write permission checks are applied ✅
B.It sets the segment’s base address
C.It defines the segment’s limit
D.It indicates the segment’s privilege level
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The type field tells the CPU if the segment contains executable code or writable data, influencing permission checks such as execute‑only or read‑only. The base and limit are stored in separate fields, and privilege level is encoded elsewhere. Without the correct type, the processor could allow illegal operations, compromising security.

Q15. In a protected‑mode IA‑32 system, which of the following statements about the Global Descriptor Table (GDT) is true?

A.It is shared by all tasks and holds system‑wide segment descriptors ✅
B.Each task has its own private GDT
C.The GDT can only hold 8 descriptors
D.The GDT is optional in protected mode
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The GDT resides in a fixed location and contains descriptors that are common to all tasks, such as code, data, and system segments. Individual tasks use the Local Descriptor Table (LDT) for private descriptors. The GDT can hold up to 8192 entries, far more than 8, and it is mandatory for protected‑mode operation.

Q16. A compiler generates a code segment with base 0x00100000 and limit 0x0000FFFF. If a function located at offset 0x0F000 attempts to call a function at offset 0x11000, what will happen?

A.The call will raise a General Protection Fault ✅
B.The call will succeed because both offsets are within the segment
C.The call will cause a Page Fault
D.The call will be redirected to the heap
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The second function’s offset (0x11000) exceeds the segment limit (0x0FFFF), so the CPU detects the violation and triggers a General Protection Fault. Even though both functions reside in the same logical segment, the limit prevents the out‑of‑range offset. The other options either ignore the limit or misinterpret the fault type.

Q17. A developer writes assembly that loads DS with selector 0x0028, but the descriptor’s present bit is cleared. What exception occurs when the next memory read uses DS?

A.Segment Not Present Fault ✅
B.General Protection Fault
C.Page Fault
D.Invalid Opcode Fault
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: When a segment selector references a descriptor whose present bit is 0, any attempt to use that segment causes a Segment Not Present exception (interrupt 11). The General Protection Fault deals with privilege or limit violations, while a Page Fault relates to paging, and Invalid Opcode is unrelated to segment presence.

Q18. What is the effect of setting the granularity (G) flag to 1 in a segment descriptor?

A.The limit is interpreted in 4 KB units ✅
B.The limit is interpreted in byte units
C.The segment becomes non‑executable
D.The segment is forced to 16‑bit mode
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: When G = 1, the 20‑bit limit field is multiplied by 4096 (4 KB), allowing segments larger than 1 MB. If G = 0, the limit is taken as a byte count. The flag does not affect executability or operand size, which are controlled by other descriptor bits.

Q19. A program defines a far pointer to a function in a different segment. Which instruction form should be used to invoke the function?

A.CALL far ptr ✅
B.CALL near ptr
C.JMP far ptr
D.JMP near ptr
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: A far call transfers control to a new segment and offset, requiring the CALL instruction with a far pointer operand. Near calls only modify the offset within the current segment. Using a near form would keep the existing segment, leading to incorrect execution. The same reasoning applies to JMP, but the question asks specifically about invoking a function, so CALL is appropriate.

Q20. If a system uses paging with a 4 KB page size, how many pages are needed to map a 2 MB segment?

A.512 pages ✅
B.256 pages
C.1024 pages
D.128 pages
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: A 2 MB segment equals 2×1024KB=2048KB2 \times 1024 \text{KB} = 2048 \text{KB}. Dividing by the 4 KB page size gives 2048/4=5122048 / 4 = 512 pages. The other numbers result from incorrect division or mis‑interpreting the segment size.

Q21. During a context switch, why must the kernel save the values of the segment registers?

A.Because they contain the base addresses needed to locate variables and code ✅
B.Because they hold the current instruction pointer
C.Because they store the CPU’s flag register
D.Because they are used for floating‑point operations
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: Segment registers point to the base of code, data, stack, and extra segments, which are essential for locating memory references after the switch. The instruction pointer (EIP) and flag register are saved separately, and floating‑point operations use the x87/MMX registers, not segment registers.

Q22. A program runs in protected mode with a flat address space. Which of the following statements is true about its segment selectors?

A.All selectors can have the same base address of 0 x0 ✅
B.Selectors must have distinct base addresses
C.Selectors are ignored entirely
D.Selectors must be 32‑bit values
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: In a flat model, each segment selector typically points to a descriptor whose base is 0, making logical and linear addresses identical. Distinct bases are unnecessary, and selectors are still 16‑bit values, not 32‑bit. The CPU still uses the selector to locate the descriptor, even if the base is the same.

Q23. A developer creates a custom LDT entry with a descriptor type of 0x2 (read‑only data). Which operation will cause a fault if attempted on this segment?

A.Writing to the segment ✅
B.Reading from the segment
C.Executing code in the segment
D.Loading the segment selector into DS
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: A descriptor marked as read‑only data permits reads but not writes; attempting to store data triggers a General Protection Fault. Reads are allowed, executing code is prohibited by the type (code segments are needed for execution), and loading the selector is allowed as long as the descriptor is present.

Q24. When an IA‑32 processor performs a far jump, which registers are affected?

A.CS and EIP are loaded with the target segment and offset ✅
B.Only EIP is changed, CS remains the same
C.Only CS is changed, EIP remains the same
D.Both CS and DS are swapped
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: A far jump supplies both a new segment selector and a new offset, causing the CPU to load CS with the selector and EIP with the offset. The other registers stay unchanged unless the target code modifies them. Swapping CS and DS does not happen automatically.

Q25. A system uses a segment descriptor with a limit of 0xFFFFF and granularity flag set to 1. What is the actual maximum byte offset allowed?

A.0xFFFFF×4096+4095=0xFFFFFFFF0xFFFFF \times 4096 + 4095 = 0xFFFFFFFF
B.0xFFFFF bytes
C.0xFFFFF×4096=0xFFFFF0000xFFFFF \times 4096 = 0xFFFFF000
D.0xFFFFFFFF bytes
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: When G = 1, the 20‑bit limit is multiplied by 4096 (4 KB) and the resulting value is added to 4095 to get the highest byte address. This yields 0xFFFFF×4096+4095=0xFFFFFFFF0xFFFFF \times 4096 + 4095 = 0xFFFFFFFF, the top of the 32‑bit address space. The other options either omit the added 4095 or treat the limit as a byte count.

Q26. If a program’s stack segment has a limit of 0x0FFF and the stack pointer (ESP) is currently 0x1000, what will happen on the next PUSH instruction?

A.A General Protection Fault will occur ✅
B.The value will be pushed without error
C.A Page Fault will be raised
D.The stack will wrap around to zero
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The PUSH operation decrements ESP before storing the value. Decrementing from 0x1000 to 0x0FFC moves ESP within the segment limit, but the initial ESP value already exceeds the limit, so the CPU raises a General Protection Fault before the push can complete. The other options ignore the limit violation.

Q27. A compiler places the code segment at selector 0x0010 with base 0x00080000 and limit 0x000FFFF. A function at offset 0x0F000 calls another function at offset 0x12000. What is the correct way to reach the second function?

A.Use a far call with a new selector ✅
B.Use a near call because both offsets are within the same segment
C.Increase the segment limit
D.Change the base address to 0x00100000
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Because the second function’s offset (0x12000) exceeds the segment limit (0x0FFFF), a near call would violate the limit and trigger a General Protection Fault. The proper solution is to use a far call that switches to a selector whose descriptor encompasses the target offset, or adjust the limit. Changing the base does not affect the offset limit.

Q28. When an IA‑32 processor accesses a linear address that is not mapped in the page tables, which exception is generated?

A.Page Fault ✅
B.General Protection Fault
C.Segment Not Present Fault
D.Invalid Opcode Fault
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: If paging is enabled and the linear address lacks a valid page‑table entry, the CPU raises a Page Fault (interrupt 14). This is distinct from a General Protection Fault, which deals with segment violations, and Segment Not Present, which concerns descriptor presence. Invalid Opcode is unrelated to memory translation.

Q29. A developer wants to ensure that a data segment cannot be executed. Which descriptor bit should be cleared?

A.Executable (E) bit ✅
B.Writable (W) bit
C.Present (P) bit
D.Granularity (G) bit
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Clearing the Executable bit marks the segment as data‑only, preventing the CPU from fetching instructions from it. The Writable bit controls write permissions, the Present bit indicates whether the descriptor is valid, and the Granularity flag affects limit scaling, none of which directly stop execution.

Q30. During a program load, the loader sets up a segment with a base of 0x00400000 and a limit of 0x0000FFFF. If the program tries to read from address 0x0040FFFE, what will happen?

A.The read succeeds because the address is within the limit ✅
B.A General Protection Fault is raised
C.A Page Fault occurs
D.The processor raises an Invalid Opcode exception
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The logical address resolves to linear 0x0040FFFE, which is less than base + limit (0x0040FFFF). Therefore the access is permitted. The other fault types would only occur if the offset exceeded the limit or if paging denied the page.

Q31. Why does the IA‑32 architecture allow a segment selector to be loaded with a value that does not correspond to any descriptor?

A.It enables software to deliberately cause a Segment Not Present fault for testing ✅
B.It is an error that the CPU silently ignores
C.It allows the selector to act as a general‑purpose register
D.It forces the CPU into real‑mode operation
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Loading an invalid selector triggers a Segment Not Present exception, which can be used by operating systems to detect erroneous selectors or to implement certain protection mechanisms. The CPU does not ignore the error, nor does the selector become a general‑purpose register, and it does not switch modes.

🔗 Related Topics (MCQs)