Quiz on pthread basics

Pthreads Basics Quiz body {margin: 10px;} Pthreads Basics QuizA quiz on basics of pthreads 1. Which header file needs to be used for pthread programming ?
pthreads.h
pthread.h
p_thread.h
posix.h

Pthreads are not useful in uniprocessor systems
False
True
Depends on the compiler
Depends on the processor

What are the flags that are passed while compiling a pthread program using gcc
-pthread
-lpthread
-gccpthread
-thread

Among the arguments passed to pthread API pthread_create the final argument, is.
Attributes of the thread
Name of the thread
Data being passed to the thread
Thread id

The data type used for storing the thread id is
pthread
pthread_t
p_thread_t
pthread_id

Which of the following APIs can be used for synchronization between threads
pthread_exit
pthread_cancel
pthread_self
pthread_join

To create a detachable thread which of the following structures needs to be modified
pthread_attr_t
pthread_t
pthread_attribute
attribute_t

pthread_self returns
The thread id
The thread attribute
Thread data
Thread running time

Two threads can be compared using the API
compare_pthreads
pthread_equal
pthread_compare
equal_pthread

pthread_create(&threads_id, NULL, Hello_world, NULL); creates a thread
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


Tags: , , ,
Copyright 2017. All rights reserved.

Posted April 8, 2013 by Tux Think in category "Linux