21. Sysfs is initialised in . . . . . . . . file via sysfs_init function.
22. What is the output of this program?
#include<stdio.h>
int main()
{
int fd_socket;
fd_socket = socket(AF_UNIX,SOCK_STREAM,0);
printf("%d\n",fd_socket);
return 0;
}
#include<stdio.h>
int main()
{
int fd_socket;
fd_socket = socket(AF_UNIX,SOCK_STREAM,0);
printf("%d\n",fd_socket);
return 0;
}
23. The directories in the /sys directory represents
24. Which signal is sent by the command "kill -9 " ?
25. What is sysfs?
26. GDB can be used
27. Which command is used to perform backup in unix?
28. For the system having one processor, the processor identifying number in the file /proc/cpuinfo is
29. What is the output of this program?
#include<stdio.h>
#include<pthread.h>
#include<semaphore.h>
sem_t st;
void *fun_t(void *arg);
void *fun_t(void *arg)
{
pthread_exit("Bye");
}
int main()
{
pthread_t pt;
void *res_t;
if(pthread_create(&pt,NULL,fun_t,NULL) == -1)
perror("pthread_create");
if(sem_init(st,1,2) != 0)
perror("sem_init");
if(pthread_join(pt,&res_t) == -1)
perror("pthread_join");
if(sem_destroy(&st) != 0)
perror("sem_destroy");
return 0;
}
#include<stdio.h>
#include<pthread.h>
#include<semaphore.h>
sem_t st;
void *fun_t(void *arg);
void *fun_t(void *arg)
{
pthread_exit("Bye");
}
int main()
{
pthread_t pt;
void *res_t;
if(pthread_create(&pt,NULL,fun_t,NULL) == -1)
perror("pthread_create");
if(sem_init(st,1,2) != 0)
perror("sem_init");
if(pthread_join(pt,&res_t) == -1)
perror("pthread_join");
if(sem_destroy(&st) != 0)
perror("sem_destroy");
return 0;
}
30. This program will print . . . . . . . . as output.
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
int main()
{
pid_t child;
child = fork();
switch(child){
case -1 :
perror("fork");
exit(1);
case 0 :
sleep(10);
printf("%d\n",getppid());
break;
default :
break;
}
return 0;
}
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
int main()
{
pid_t child;
child = fork();
switch(child){
case -1 :
perror("fork");
exit(1);
case 0 :
sleep(10);
printf("%d\n",getppid());
break;
default :
break;
}
return 0;
}
Read More Section(Linux)
Each Section contains maximum 100 MCQs question on Linux. To get more questions visit other sections.