Pages

Anwers to the pthreads basics quiz

Here are the answer to the quiz on pthread basics

1. Which header file needs to be used for pthread programming ?
Ans: pthread.h

2.Pthreads are not useful in uniprocessor systems
Ans: false

3. What are the flags that are passed while compiling a pthread program using gcc ?
Ans: -lpthread

4. Among the arguments passed to pthread API pthread_create the final argument, is.
Ans: Data being passed to the thread

5. The data type used for storing the thread id is
Ans: pthread_t

6. Which of the following APIs can be used for synchronization between threads
Ans: pthread_join

7. To create a detachable thread which of the following structures needs to be modified
Ans: pthread_attr_t

8. pthread_self returns
Ans: The thread id

9.Two threads can be compared using the API
Ans: pthread_equal

10.pthread_create(&threads_id, NULL, Hello_world, NULL); creates a thread
Ans:Called Hello_world with default attributes

No comments:

Post a Comment