Monday, April 8, 2013
2:38 PM

Quiz on pthread basics

Pthreads Basics Quiz

Pthreads Basics Quiz

A quiz on basics of pthreads
  1. 1. Which header file needs to be used for pthread programming ?

  2. pthreads.h
    pthread.h
    p_thread.h
    posix.h

  3. Pthreads are not useful in uniprocessor systems

  4. False
    True
    Depends on the compiler
    Depends on the processor

  5. What are the flags that are passed while compiling a pthread program using gcc

  6. -pthread
    -lpthread
    -gccpthread
    -thread

  7. Among the arguments passed to pthread API pthread_create the final argument, is.

  8. Attributes of the thread
    Name of the thread
    Data being passed to the thread
    Thread id

  9. The data type used for storing the thread id is

  10. pthread
    pthread_t
    p_thread_t
    pthread_id

  11. Which of the following APIs can be used for synchronization between threads

  12. pthread_exit
    pthread_cancel
    pthread_self
    pthread_join

  13. To create a detachable thread which of the following structures needs to be modified

  14. pthread_attr_t
    pthread_t
    pthread_attribute
    attribute_t

  15. pthread_self returns

  16. The thread id
    The thread attribute
    Thread data
    Thread running time

  17. Two threads can be compared using the API

  18. compare_pthreads
    pthread_equal
    pthread_compare
    equal_pthread

  19. pthread_create(&threads_id, NULL, Hello_world, NULL); creates a thread

  20. Called Hello_world with default attributes
    Called Hello_world with all attributes set to NULL
    Called Hello with default attributes
    Called Hello with all attributes set to NULL

Answers the quiz are available at : Answers to pthreads basic quiz

0 comments:

Post a Comment