Skip to main content

System Programming MCQs with Answers

Practice important System Programming MCQs with answers and explanations.

Chapter: 64
Q1341:
The return value INVALID_HANDLE_VALUE is used when
A. functions succeed
B. system loads
C. memory is allocated
D. an invalid file handle is encountered
Correct Answer: D
Chapter: 64
Q1342:
Why might you want to use distinct heaps for different data structures?
A. For saving disk
B. For organizing data
C. For better performance
D. For networking
Correct Answer: C
Chapter: 64
Q1343:
Which one of the following is NOT a C standard heap function?
A. malloc()
B. free()
C. append()
D. realloc()
Correct Answer: C
Chapter: 64
Q1344:
calloc() function in C is used to
A. Allocate memory without initializing
B. Free memory
C. Allocate memory with initialization
D. Reclaim memory
Correct Answer: C
Chapter: 64
Q1345:
realloc() in C is used to
A. Reallocate memory block
B. Reallocate file
C. Reassign pointer
D. Reduce memory usage
Correct Answer: A
Chapter: 64
Q1346:
Heap handle is required to
A. allocate memory from the heap
B. create processes
C. manage threads
D. free stack memory
Correct Answer: A
Chapter: 64
Q1347:
The heap in Windows is accessed using ________.
A. a function name
B. a handle
C. a structure
D. a class
Correct Answer: B
Chapter: 64
Q1348:
Every process in Windows has a ________ heap by default.
A. static
B. single
C. default
D. primary
Correct Answer: C
Chapter: 64
Q1349:
When managing different data structures, ________ heaps may be beneficial.
A. no
B. two
C. multiple
D. same
Correct Answer: C
Chapter: 64
Q1350:
The function ________ dynamically allocates memory with initialization.
A. malloc()
B. free()
C. calloc()
D. realloc()
Correct Answer: C
Chapter: 64
Q1351:
To resize a previously allocated memory block, use ________.
A. malloc()
B. realloc()
C. free()
D. new()
Correct Answer: B
Chapter: 64
Q1352:
In heap memory management, a heap is considered a ________ object.
A. variable
B. system
C. windows
D. user-defined
Correct Answer: C
Chapter: 64
Q1353:
To allocate memory from a heap in Windows, you must first get a ________.
A. pointer
B. buffer
C. handle
D. thread
Correct Answer: C
Chapter: 65
Q1354:
Which API is used to create a new heap in Windows?
A. HeapAlloc()
B. HeapInit()
C. HeapCreate()
D. CreateHeap()
Correct Answer: C
Chapter: 65
Q1355:
HeapCreate() allocates memory in which manner?
A. On demand
B. Initially
C. Only when accessed
D. When freed
Correct Answer: B
Chapter: 65
Q1356:
What is the purpose of dwInitialSize in HeapCreate()?
A. Set page size
B. Set heap handle
C. Set initial heap size
D. None of these
Correct Answer: C
Chapter: 65
Q1357:
If dwMaximumSize is zero, the heap can grow up to
A. 1 GB
B. Physical memory
C. Available virtual memory
D. Heap limit
Correct Answer: C
Chapter: 65
Q1358:
What data type is used for dwInitialSize and dwMaximumSize?
A. DWORD
B. HANDLE
C. SIZE_T
D. ULONG
Correct Answer: C
Chapter: 65
Q1359:
What does SIZE_T ensure?
A. Error-free operation
B. Portability between 32/64-bit platforms
C. Execution speed
D. Compilation accuracy
Correct Answer: B
Chapter: 65
Q1360:
The heap size is adjusted to
A. Heap handle size
B. Exact bytes
C. Nearest multiple of page size
D. Random value
Correct Answer: C

Test Your Knowledge

Take a timed quiz on System Programming

🚀 Start Quiz Now