21. What is the purpose of the 'std::future' class in C++ multi-threading? A. To represent the result of an asynchronous operation B. To execute a task asynchronously C. To synchronize the execution of threads D. To manage thread priorities Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board
22. What is the difference between std::async and std::thread in C++ multi-threading? A. std::async returns a std::future object representing the result of the asynchronous operation, while std::thread does not return anything B. std::thread allows you to specify the execution policy, while std::async does not C. std::async creates a new thread and executes a function asynchronously, while std::thread simply creates a new thread D. std::thread provides more control over thread creation and management compared to std::async 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
23. What is the purpose of the 'std::promise' class in C++ multi-threading? A. To signal waiting threads B. To manage thread priorities C. To acquire and release a mutex automatically D. To store a value or an exception that will be made available asynchronously 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
24. What is the difference between std::condition_variable and std::condition_variable_any in C++ multi-threading? A. std::condition_variable is more efficient than std::condition_variable_any B. std::condition_variable_any can work with any mutex type, while std::condition_variable can only work with std::mutex C. std::condition_variable can only work with std::mutex, while std::condition_variable_any can work with any mutex type D. std::condition_variable_any is more efficient than std::condition_variable 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
25. What is the purpose of the 'std::thread::hardware_concurrency()' function in C++ multi-threading? A. To return the number of threads created by the program B. To return the number of cores in the system C. To return the number of hardware concurrency units supported by the implementation D. To return the number of threads currently running 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
26. What is the purpose of the 'std::recursive_mutex' class in C++ multi-threading? A. To provide mutual exclusion B. To allow a thread to lock the same mutex multiple times without causing a deadlock C. To manage thread priorities 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
27. What is the purpose of the 'std::atomic_flag' class in C++ multi-threading? A. To manage thread priorities B. To synchronize the execution of threads C. To provide atomic access to a boolean flag D. To provide mutual exclusion 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
28. What is the purpose of the 'std::latch' class in C++ multi-threading? A. To signal waiting threads B. To provide mutual exclusion C. To manage thread priorities D. To synchronize the execution of threads until a specified count is reached 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
29. What is the purpose of the 'std::barrier' class in C++ multi-threading? A. To synchronize the execution of threads at a specified point B. To execute a task asynchronously C. To signal waiting threads D. To manage thread priorities Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board
30. What is the purpose of the 'std::semaphore' class in C++ multi-threading? A. To manage thread priorities B. To synchronize the execution of threads C. To provide mutual exclusion D. To control access to a shared resource by multiple threads 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