MCQ Practice

What is the output of this program? #include #include #include void *fun_t(void *arg); void *fun_t(void *arg) { pthread_exit("Bye"); } int main() { pthread_t pt; sem_t st; void *res_t; if(pthread_create(&pt,NULL,fun_t,NULL) == -1) perror("pthread_create"); if(sem_init(&st,0,0) != 0) perror("sem_init"); if(sem_wait(&st) != 0) perror("sem_wait"); printf("Examplen"); if(pthread_join(pt,&res_t) == -1) perror("pthread_join"); if(sem_destroy(&st) != 0) perror("sem_destroy"); return 0; }

A

this program will print the string "Example"

B

this program will give segmentation fault

C

this process will remain block

D

none of the mentioned

Correct Answer: C