Multithreading MCQ Questions - C Programming

This section focuses on the "Multithreading" in C programming. These Multiple Choice Questions (MCQ) should be practiced to improve the C programming skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.

1. Thread are often called as ?

A. heavyweight processes
B. lightweight processes
C. both a and b
D. None of the above

View Answer


2. Threads operate faster than processes.

A. TRUE
B. FALSE
C. Can be true or false
D. Can not say

View Answer


3. In C programming, multithreading can be implemented using the ____________ library

A. cthreads
B. cppthreads
C. pthreads
D. pnthreads

View Answer


4. In general, there are _________ types of multitasking.

A. 1
B. 2
C. 3
D. 4

View Answer


5. A multithreaded program contains _________ parts that can run concurrently.

A. two
B. three
C. two or more
D. three or more

View Answer


6. __________ is used to explicitly exit a thread.

A. exit
B. pthread_exit
C. exit_pthread
D. Both B and C

View Answer


7. What is the purpose of the pthread_create() function?

A. To create a new thread
B. To terminate a thread
C. To synchronize threads
D. To allocate memory for a thread

View Answer


8. mutex is a synchronization primitive used to prevent multiple threads from accessing a shared resource simultaneously.

A. TRUE
B. FALSE
C. Can be true or false
D. Can not say

View Answer


9. __________ that can be called from multiple threads simultaneously without causing a race condition.

A. thread function
B. safe function
C. both a and b
D. thread-safe function

View Answer


10. _______________ is a synchronization primitive used to prevent multiple threads from accessing a shared resource simultaneously.

A. mutex
B. semaphore
C. deadlock
D. race

View Answer






Discussion



* You must be logged in to add comment.