| Snaprecruit.com

| Snaprecruit.com

Interview question based on skill :

Take as many assements as you can to improve your validate your skill rating

Total Questions: 5

1. Which one of the following string will print first by this program? #include #include void *fun_t(void *arg); void *fun_t(void *arg) { printf("Sanfoundry\n"); pthread_exit("Bye"); } int main() { pthread_t pt; void *res_t; if(pthread_create(&pt,NULL,fun_t,NULL) != 0) perror("pthread_create"); printf("Linux\n"); if(pthread_join(pt,&res_t) != 0) perror("pthread_join"); return 0; }

Correct Answer is : Sanfoundry

2. What is the output of this program? #include #include void *fun_t(void *arg); void *fun_t(void *arg) { int ret; ret = pthread_exit("Bye"); printf("%d\n",ret); } int main() { pthread_t pt; void *res_t; if(pthread_create(&pt,NULL,fun_t,NULL) != 0) perror("pthread_create"); if(pthread_join(pt,&res_t) != 0) perror("pthread_join"); return 0; }

Correct Answer is : none of the mentioned

3. What is the output of this program? #include #include void *fun_t(void *arg); void *fun_t(void *arg) { printf("Sanfoundry\n"); pthread_exit("Bye"); } int main() { pthread_t pt; void *res_t; if(pthread_create(&pt,NULL,fun_t,NULL) != 0) perror("pthread_create"); return 0; }

Correct Answer is : this program will print nothing

4. What is the output of this program? #include #include void *fun_t(void *arg); void *fun_t(void *arg) { printf("%d\n",a); pthread_exit("Bye"); } int main() { int a; pthread_t pt; void *res_t; a = 10; if(pthread_create(&pt,NULL,fun_t,NULL) != 0) perror("pthread_create"); if(pthread_join(pt,&res_t) != 0) perror("pthread_join"); return 0; }

Correct Answer is : none of the mentioned

5. What is the output of this program? #include #include int a; void *fun_t(void *arg); void *fun_t(void *arg) { printf("%d\n",a); pthread_exit("Bye"); } int main() { pthread_t pt; void *res_t; a = 10; if(pthread_create(&pt,NULL,fun_t,NULL) != 0) perror("pthread_create"); if(pthread_join(pt,&res_t) != 0) perror("pthread_join"); return 0; }

Correct Answer is : 10