System Programming MCQs with Answers
Practice important System Programming MCQs with answers and explanations.
Chapter: 65
Q1381:
The flag HEAP_GENERATE_EXCEPTIONS raises exceptions during
A. heap creation
B. memory deallocation
C. allocation failure
D. function call
Correct Answer:
C
Chapter: 65
Q1382:
The function HeapCreate returns NULL on
A. failure
B. success
C. destroy
D. invalid parameters
Correct Answer:
A
Chapter: 65
Q1383:
flOptions in HeapCreate can include
A. HEAP_READ_ONLY
B. HEAP_CREATE_ZERO_INIT
C. HEAP_NO_SERIALIZE
D. HEAP_SHARED
Correct Answer:
B
Chapter: 65
Q1384:
In Windows, the heap size adjusts to the nearest ________.
A. block size
B. thread size
C. page size
D. process size
Correct Answer:
C
Chapter: 65
Q1385:
flOptions in HeapCreate() allows enabling ________ and exception flags.
A. API access
B. flags
C. execution
D. heap management
Correct Answer:
C
Chapter: 65
Q1386:
dwMaximumSize determines the ________ size of the heap.
A. current
B. page
C. maximum
D. heap handle
Correct Answer:
C
Chapter: 65
Q1387:
HeapDestroy() requires a valid ________.
A. process handle
B. pointer
C. name
D. heap handle
Correct Answer:
D
Chapter: 66
Q1388:
What is the purpose of HeapAlloc() in heap memory management?
A. To create a new heap
B. To reallocate memory
C. To allocate a memory block from the heap
D. To free a heap
Correct Answer:
B
Chapter: 66
Q1389:
Which flag ensures memory allocated by HeapAlloc is initialized to zero?
A. HEAP_NO_SERIALIZE
B. HEAP_REALLOC_IN_PLACE_ONLY
C. HEAP_ZERO_MEMORY
D. HEAP_GENERATE_EXCEPTIONS
Correct Answer:
C
Chapter: 66
Q1390:
The return value of HeapAlloc() is of type _______.
A. int
B. void
C. LPVOID
D. HANDLE
Correct Answer:
C
Chapter: 66
Q1391:
In HeapAlloc(), the parameter dwBytes specifies _______.
A. the size of heap handle
B. the size of heap page
C. the size of the block to allocate
D. the return type of function
Correct Answer:
C
Chapter: 66
Q1392:
Which flag may raise STATUS_NO_MEMORY or STATUS_ACCESS_VIOLATION during memory allocation?
A. HEAP_ZERO_MEMORY
B. HEAP_NO_SERIALIZE
C. HEAP_REALLOC_IN_PLACE_ONLY
D. HEAP_GENERATE_EXCEPTIONS
Correct Answer:
D
Chapter: 66
Q1393:
GetLastError() cannot be used with which API on failure?
A. HeapDestroy()
B. HeapAlloc()
C. HeapFree()
D. HeapReAlloc()
Correct Answer:
B
Chapter: 66
Q1394:
Which function is used to deallocate a memory block in heap?
A. HeapAlloc()
B. HeapReAlloc()
C. HeapFree()
D. HeapDestroy()
Correct Answer:
C
Chapter: 66
Q1395:
The lpMem parameter in HeapFree() should be a pointer returned by _______.
A. malloc()
B. realloc()
C. HeapAlloc() or HeapReAlloc()
D. HeapDestroy()
Correct Answer:
C
Chapter: 66
Q1396:
Which flag in HeapAlloc() improves performance when serialization isn't required?
A. HEAP_NO_SERIALIZE
B. HEAP_ZERO_MEMORY
C. HEAP_REALLOC_IN_PLACE_ONLY
D. HEAP_CREATE_ENABLE_EXECUTE
Correct Answer:
A
Chapter: 66
Q1397:
The HeapFree() function returns FALSE on _______.
A. success
B. allocation
C. error
D. failure
Correct Answer:
D
Chapter: 66
Q1398:
The GetLastError() function can be used after failure of which heap API?
A. HeapAlloc()
B. HeapFree()
C. HeapCreate()
D. HeapReAlloc()
Correct Answer:
B
Chapter: 66
Q1399:
The HeapReAlloc() function is used to _______.
A. allocate new memory block
B. allocate multiple heaps
C. reallocate memory block
D. increase virtual memory
Correct Answer:
C
Chapter: 66
Q1400:
In HeapReAlloc(), the HEAP_REALLOC_IN_PLACE_ONLY flag ensures _______.
A. memory will be freed
B. memory lies contiguously
C. memory is shared
D. memory is uninitialized
Correct Answer:
B