1 Which of the following are encompassed within primary memory management
a. The allocation of main memory to programs
b. The garbage collection to achieve compaction
c. Managing the process control block
d. Protection to user data when a user exceeds his allocated data area allocation.
e. Transfer of data between devices using buffers.
2 Who performs the garbage collection?
a. The user
b. The memory management system
c. The processor, which switches to the garbage collection mode after
termination of every program.
3 Once a program is compiled, it can be loaded for execution
a. Only from the compiler generated starting address
b. Any where in the main memory
c. User needs to specify where the compiled code is to be loaded
d. It is loaded starting from address 0 in the main memory.
4 After an allocation of space using the first-fit policy the number of holes in memory
a. Increases by one
b. Decreases by one
c. Does not change
5 Against the following statements indicate the policy which best describes the policy
a. Most holes appear nearer to the beginning of the scan
b. Holes are nearly distributed uniformly through the memory
c. It requires the maximum time to allocate the suitable hole.
d. It leaves the largest holes in size.
6 The buddy system of memory allocation policy is a dynamic partitioning policy.
7 Indicate which amongst the following statements are true for virtual memory.
a. It allows for multiple users to use the system
b. It enhances scope for multi-programming
c. It extends the address space
d. It reduces external fragmentation as well as internal fragmentation.
8 Paging was prompted by what form of reasoning:
a. Because on compilation the program code is paginated.
b. Because program display a strong locality of reference.
c. Because we print programs on pages
9 The typical page size may be
a. Usually between 10 and100 bytes
b. Usually of 512 to 2k bytes
c. More than 100 KB bytes but less than 1 MB
d. Minimally 1 MB
10 Which of the following are the likely causes of thrashing?
a. Because there are too many users connected to the system
b. Because the page size was very small
c. Because we followed a first in first out policy
d. Because we followed a least recently used policy for page replacement.
11 It is very usual on part of programmers to use sizeof operators in place of arguments of dynamic memory allocation functions like calloc, malloc etc. What is the advantage of using sizeof operator instead of just mentioning the bytes as pure number?
Ans Sizeof operator has a great advantage that the programmer need not know in advance the memory requirement for each and every data type. Also, the memory for data types can vary in different implementations which makes the problem worse. For example, char data which usually requires 1 byte of memory may require 2 bytes in some machines. Using sizeof operator eliminates the need to know in advance the exact memory requirement of every datatype.
12 Consider that a programmer has currently used either malloc or calloc to allocate a region of memory. Now is there a way to alter the previously allocated memory somewhere down the program without losing any data?
Ans. Yes, realloc can be used to re allocate memory to a region allocated by either malloc or calloc. If the reallocated size is greater than the originally allocated size, then no data will be lost.
13 Can you tell a prominent difference between calloc and malloc ?
Ans Though functionally calloc and malloc are very similar, calloc will initialize the allocated memory to zero while malloc will not clear the memory.