Select the correct option to test your answer:
More Computer Science Engineering Questions
Which one of the following statement is not true about this program? #include<stdio.h> #include<pthread.h> void *fun_t(void *arg); void *fun_t(void *arg) { printf("%d\n",getpid()); pthread_exit("Bye"); } 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"); printf("%d\n",getpid()); return 0; }
What is the output of the program? #! /usr/bin/awk -f BEGIN { a[1,1]=0 a[1,2]=1 a[2,1]=2 a[2,2]=3 for(i=1;i<3;i++) { for(j=1;j<3;j++) { print a[i,j] } } }
What is the problem with this server program? #include<stdio.h> #include<stdlib.h> #include<netinet/in.h> #include<sys/types.h> #include<sys/socket.h> int main() { int fd_server, fd_client, len; struct sockaddr_in add_server; fd_server = socket(AF_INET,SOCK_STREAM,0); if (fd_server == -1) { perror("fd_sock"); exit(1); } add_server.sin_family = AF_INET; add_server.sin_port = htons(4001); add_server.sin_addr.s_addr = inet_addr("122.23.1.1"); len = sizeof(add_server); if( bind(fd_server,(struct sockaddr*)&add_server,len) != 0) perror("bind"); if(listen(fd_server,5) != 0) perror("listen"); fd_client = accept(fd_server,(struct sockaddr*)&add_server,&len); if(fd_client == -1) perror("accept"); return 0; }
The command chmod 4777 a.out
This program will print #include<stdio.h> #include<signal.h> #include<unistd.h> void response (int); void response (int sig_no) { printf("%s is working\n",sys_siglist[sig_no]); } int main() { alarm(5); sleep(50); printf("Example\n"); signal(SIGALRM,response); return 0; }