System Programming MCQs with Answers
Practice important System Programming MCQs with answers and explanations.
Chapter: 155
Q3441:
Interlocked functions help synchronize access to a variable shared by ________.
A. Multiple threads
B. Single thread
C. Single process
D. Single function
Correct Answer:
A
Chapter: 155
Q3442:
Interlocked functions perform operations on variables in an ________ manner.
A. Atomic
B. Sequential
C. Parallel
D. Simultaneous
Correct Answer:
A
Chapter: 155
Q3443:
Threads of different processes can use interlocked functions if the variable is in ________.
A. Shared memory
B. Local memory
C. Register
D. Cache
Correct Answer:
A
Chapter: 155
Q3444:
Which function combines the steps involved in incrementing a variable atomically?
A. InterlockedIncrement
B. InterlockedExchange
C. InterlockedExchangeAdd
D. InterlockedDecrement
Correct Answer:
A
Chapter: 155
Q3445:
Which function atomically decrements a variable?
A. InterlockedDecrement
B. InterlockedExchange
C. Add
D. InterlockedIncrement
Correct Answer:
B
Chapter: 155
Q3446:
Interlocked functions are sometimes called ________ because they use atomic machine instructions.
A. Compiler intrinsic statements
B. Kernel calls
C. User functions
D. System calls
Correct Answer:
A
Chapter: 155
Q3447:
InterlockedExchange function stores one variable into ________.
A. Another variable
B. A register
C. Memory cache
D. A constant
Correct Answer:
A
Chapter: 155
Q3448:
What does InterlockedExchange return?
A. Previous value of *Target
B. New value
C. Value plus one
D. Incremented value
Correct Answer:
A
Chapter: 155
Q3449:
The InterlockedExchangeAdd function adds the increment to the ________.
A. *Addend
B. *Target
C. *Value
D. *Variable
Correct Answer:
A
Chapter: 155
Q3450:
InterlockedExchangeAdd returns the ________ value of *Addend.
A. New
B. Old
C. Incremented
D. Decremented
Correct Answer:
B
Chapter: 155
Q3451:
In InterlockedExchangeAdd(LONG volatile *Addend, LONG Increment), Increment is ________ to *Addend.
A. Added
B. Subtracted
C. Multiplied
D. Divided
Correct Answer:
A
Chapter: 155
Q3452:
Interlocked functions ensure that operations on shared variables are ________ to prevent race conditions.
A. Atomic
B. Delayed
C. Concurrent
D. Queued
Correct Answer:
A
Chapter: 155
Q3453:
Which of the following is NOT an interlocked function?
A. InterlockedMultiply
B. InterlockedIncrement
C. InterlockedExchange
D. InterlockedDecrement
Correct Answer:
A
Chapter: 155
Q3454:
Atomic machine instructions used in interlocked functions are implemented at the ________ level.
A. Hardware
B. Software
C. Application
D. Network
Correct Answer:
A
Chapter: 155
Q3455:
To prevent race conditions, operations on shared variables must be ________.
A. Atomic
B. Concurrent
C. Parallel
D. Independent
Correct Answer:
A
Chapter: 156
Q3456:
When multiple threads run concurrently, they compete for ________.
A. CPU time
B. Resources
C. Network bandwidth
D. Input devices
Correct Answer:
B
Chapter: 156
Q3457:
Memory allocated dynamically in multithreading is allocated from the ________.
A. Stack
B. Heap
C. Register
D. Cache
Correct Answer:
B
Chapter: 156
Q3458:
Threads use ________ and free() functions to allocate and free memory dynamically.
A. malloc() and free()
B. new() and delete()
C. HeapAlloc() and HeapFree()
D. HeapCreate() and HeapDestroy()
Correct Answer:
A
Chapter: 156
Q3459:
To manage memory allocation safely in multithreading, a thread can create a handle to its own heap using ________.
A. malloc()
B. HeapCreate()
C. HeapAlloc()
D. HeapFree()
Correct Answer:
B
Chapter: 156
Q3460:
Instead of malloc() and free(), memory management in threads can be performed using ________.
A. HeapCreate() and HeapDestroy()
B. HeapAlloc() and HeapFree()
C. new() and delete()
D. delete() and free()
Correct Answer:
B