In this section of Operating System Main Memory – Memory Management.it contain Operating System Main Memory – Memory Allocation to a process using Stacks MCQs (Multiple Choice Questions Answers).All the MCQs (Multiple Choice Question Answers) requires in detail reading of Operating System subject as the hardness level of MCQs have been kept to advance level.
This MCQs section is mainly focused on below lists of topics
- Use of stack..
- The memory Allocation Model for a process.
1. Variables whose scope is associated with functions, procedures, or blocks, in a program and parameters of function or procedure calls. This kind of data is allocated on the___________
- Heap
- stack
- CPU register
- Program Counter
This data is allocated when a function, procedure or blocks is entered and is deallocated when it is exited.
2. In Stack, Allocation and deallocations are performed in a _________Manner in response to push and pop operations.
- FIFO
- LIFO
- FILO
- LILO
We assume each entry in the stack to be of some standard size, say l bytes. Only the last entry in the stack is accessible at any time. Contiguous area of memory is reserved for the stack.
3. A pointer called the ______ points to the first entry of the stack, while a pointer called the _____ points to the last entry allocated in the stack.
- top of Stack (TOS),Frame Base (FB)
- top of Stack (TOS),Stack Base (SB)
- Stack Base (SB),top of Stack (TOS)
- Frame Base (FB),top of Stack (TOS)
4. During execution of a program, a stack is used to support function calls. the group of stack entries that pertain to one function call is called
- stack
- Frame Base
- base Frame
- Stack frame
A stack frame is pushed on the stack when function is called.
5. Stack frame contains
- Address of the function's parameters
- values of the functions parameters
- the return address
- All of the above
During execution of the function, the run time support of the programming language in which the program is coded creates local data of the function within the stack frame. At the end of the function's execution, the entire stack frame us popped off the stack and the return address contained in it is used to pass control back to the calling program.
6. The first entry in the stack frame contains
- The next value of the frame base.
- The previous value of the frame base.
- the return address of the function
- All of the above.
7. The second entry in the stack frame contains
- The next value of the frame base
- The previous value of the frame base.
- the return address of the function
- All of the above.
8. The frame base points to the
- Last entry in the stack frame
- the return address of the function
- the last local data in the stack frame
- First entry in the stack frame
9. The TOS points to the
- the last local data in the stack frame
- Last entry in the stack frame
- the return address of the function
- First entry in the stack frame
10. The size of a program can be obtained from its
- Directory entry
- size of the stack
- PCD-program controlled dynamic data vary during execution of the program
- all of the above
- The code and static data components in the program are allocated memory area that exactly matches their size.
- The PCD data and stack share a single large area of memory but grow in opposite directions when memory is allocated to new data.
- The PCD data is allocated by starting at the low end of this area while the stack is allocated by starting at the high end of the area. the memory between these two components is free.
- In this model the stack and PCD data components do not have individual size restrictions.
- 1,4
- 1,2
- 1,3
- 1,2,3,4
The code and static data components in the program are allocated memory area that exactly matches their size.
The PCD data and stack share a single large area of memory but grow in opposite directions when memory is allocated to new data.
The PCD data is allocated by starting at the low end of this area while the stack is allocated by starting at the high end of the area. The memory between these two components is free.
In this model the stack and PCD data components do not have individual size restrictions.
12. PCD data can be allocated deallocated by
- MMU
- run time libraries of the programming language ie.library routines
- Kernel
- All of the above
A Program creates or destroys PCD data by calling appropriate routines of the run time library of the programming language in which it is coded.