31. Which of the following is not a synchronization mechanism in C++ multi-threading? A. Semaphore B. Mutex C. Spinlock D. Barrier Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
32. What does the term "thread-safe" mean in the context of multi-threading? A. The code is guaranteed to be error-free B. The code can be safely executed by multiple threads concurrently C. The code can only be executed by a certain thread D. None of the above Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B No explanation is given for this question Let's Discuss on Board
33. What is the primary purpose of a mutex in C++ multi-threading? A. To manage thread priorities B. To synchronize the execution of threads C. To provide mutual exclusion D. To execute a task asynchronously Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
34. Which of the following is true about a condition variable in C++ multi-threading? A. It allows multiple threads to share the same memory location B. It provides mutual exclusion C. It provides atomic access to shared variables D. It allows one thread to notify other threads about a condition Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
35. What is a deadlock in the context of multi-threading? A. A situation where threads execute out of order B. A situation where threads wait indefinitely for a signal C. A situation where two or more threads are waiting indefinitely for each other to release resources D. A situation where a thread blocks other threads from executing Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
36. Which C++11 feature introduced support for multi-threading? A. std::mutex B. std::atomic C. std::condition_variable D. std::thread Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
37. What is the difference between std::mutex and std::recursive_mutex in C++ multi-threading? A. std::mutex can be locked multiple times by the same thread, while std::recursive_mutex cannot B. std::recursive_mutex can be locked multiple times by the same thread, while std::mutex cannot C. std::mutex cannot be locked multiple times by the same thread, while std::recursive_mutex can D. They both provide the same functionality Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B No explanation is given for this question Let's Discuss on Board
38. Which of the following is not a potential issue in multi-threading? A. Deadlock B. Race condition C. Starvation D. Deterministic execution Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
39. What is the purpose of the 'std::this_thread::sleep_for' function in C++ multi-threading? A. To block the execution of a thread B. To synchronize the execution of threads C. To terminate the current thread D. To make the current thread sleep for a specified duration Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
40. What is the primary difference between a std::mutex and a std::spinlock in C++ multi-threading? A. std::spinlock is a blocking synchronization primitive, while std::mutex is a non-blocking synchronization primitive B. They both provide the same functionality C. std::mutex is a blocking synchronization primitive, while std::spinlock is a non-blocking synchronization primitive D. std::spinlock is more efficient than std::mutex Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board