System Programming MCQs with Answers
Practice important System Programming MCQs with answers and explanations.
Chapter: 66
Q1401:
The lpMem in HeapReAlloc() refers to _______.
A. newly allocated memory
B. block from another heap
C. heap size limit
D. previously allocated block
Correct Answer:
D
Chapter: 66
Q1402:
The block size in HeapReAlloc() must be less than or equal to _______.
A. 0x7FFF
B. 0xFFFFF
C. 0x7FFF8
D. 1MB
Correct Answer:
C
Chapter: 66
Q1403:
The HEAP_ZERO_MEMORY flag in HeapReAlloc() initializes only _______.
A. entire memory
B. old memory
C. new memory
D. unused memory
Correct Answer:
C
Chapter: 66
Q1404:
If HEAP_GENERATE_EXCEPTIONS is already set in HeapCreate(), what happens when it's set again in HeapAlloc()?
A. It takes priority
B. It causes crash
C. It is ignored
D. It duplicates behavior
Correct Answer:
C
Chapter: 66
Q1405:
HEAP_NO_SERIALIZE in HeapAlloc() should be used when _______.
A. security is priority
B. thread safety is required
C. thread safety is not required
D. data must be encrypted
Correct Answer:
C
Chapter: 66
Q1406:
hHeap in HeapAlloc() refers to _______.
A. size of memory
B. return value of malloc
C. the heap handle from which memory is allocated
D. heap ID
Correct Answer:
C
Chapter: 66
Q1407:
HeapAlloc() function syntax requires which three parameters?
A. hHeap, dwBytes, lpMem
B. hHeap, dwFlags, dwBytes
C. hHeap, flags, size
D. hHeap, exception, pointer
Correct Answer:
B
Chapter: 66
Q1408:
HEAP_REALLOC_IN_PLACE_ONLY restricts memory block to be _______.
A. of maximum size
B. shared between threads
C. located next to previous block
D. moved to system cache
Correct Answer:
C
Chapter: 66
Q1409:
dwFlags in HeapReAlloc() may contain which combination of flags?
A. HEAP_CREATE_ENABLE_EXECUTE only
B. HEAP_REALLOC_IN_PLACE_ONLY only
C. HEAP_ZERO_MEMORY and HEAP_NO_SERIALIZE
D. All of the above
Correct Answer:
C
Chapter: 66
Q1410:
The value 0x7FFF8 is approximately equal to _______.
A. 1 MB
B. 0.5 MB
C. 64 KB
D. 128 KB
Correct Answer:
B
Chapter: 66
Q1411:
________ specifies that allocated memory will be initialized to zero.
A. HEAP_CREATE_ENABLE_EXECUTE
B. HEAP_REALLOC_IN_PLACE_ONLY
C. HEAP_ZERO_MEMORY
D. HEAP_NO_SERIALIZE
Correct Answer:
C
Chapter: 66
Q1412:
If allocation fails and exceptions are disabled, HeapAlloc() returns _______.
A. a zero pointer
B. an exception
C. a warning
D. NULL
Correct Answer:
D
Chapter: 66
Q1413:
The failure of HeapFree() can be diagnosed using _______.
A. GetHeapInfo()
B. GetLastError()
C. HeapStatus()
D. HeapGetInfo()
Correct Answer:
B
Chapter: 66
Q1414:
HeapReAlloc() allows resizing memory blocks using _______.
A. lpMem and dwBytes
B. dwFlags and hHeap
C. lpMem and HeapSize
D. dwBytes and HeapSize
Correct Answer:
A
Chapter: 67
Q1415:
Which API is used to determine the size of an allocated block in the heap?
A. HeapAlloc()
B. HeapSize()
C. HeapReAlloc()
D. HeapCompact()
Correct Answer:
B
Chapter: 67
Q1416:
The only valid flag for HeapSize() is _______.
A. HEAP_ZERO_MEMORY
B. HEAP_REALLOC_IN_PLACE_ONLY
C. HEAP_NO_SERIALIZE
D. HEAP_GENERATE_EXCEPTION
Correct Answer:
C
Chapter: 67
Q1417:
Serialization is required when threads
A. are independent
B. use separate heaps
C. use common resources
D. are single-threaded
Correct Answer:
C
Chapter: 67
Q1418:
If threads are autonomous, serialization is
A. essential
B. optional
C. not required
D. forced
Correct Answer:
C
Chapter: 67
Q1419:
The flag _______ provides an estimated 16% performance improvement.
A. HEAP_GENERATE_EXCEPTION
B. HEAP_REALLOC_IN_PLACE_ONLY
C. HEAP_ZERO_MEMORY
D. HEAP_NO_SERIALIZE
Correct Answer:
D
Chapter: 67
Q1420:
HEAP_NO_SERIALIZE should be used only when
A. the program is multi-threaded
B. memory is insufficient
C. conflicts exist
D. program is single-threaded or has isolated heaps
Correct Answer:
D