⟩ What is the default maximum number of processes that can exist in Linux? a) 32768 b) 1024 c) 4096 d) unlimited
a) 32768
a) 32768
What will print as the SIGINT signal hits the running process of this program? #include<stdio.h> #include<stdlib.h> #include<signal.h> void response (int); void response (int sig_no) { printf("%s",sys_siglist[sig_no]); } int main() { signal(SIGINT,response); while(1){ printf("googlen"); sleep(1); } return 0; } a) Interrupt b) Stop c) Terminate d) none of the mentioned
What happens as the SIGINT signal hits the running process of this program? #include<stdio.h> #include<signal.h> #include<stdlib.h> int main() { pid_t child; signal(SIGINT,SIG_IGN); child=fork(); switch(child){ case -1 perror("fork"); exit(1); case 0 while(1){ printf("Child Processn"); sleep(1); } break; default while(1){ printf("Parent Processn"); pause(); } break; } return 0; } a) child process terminates b) parent process terminates c) both child and parent process ignores the signal d) none of the mentioned
What will happen if we press "Ctrl+c" key two times after running this program? #include<stdio.h> #include<signal.h> void response(int); void response(int sig_no) { printf("Linuxn"); signal(SIGINT,SIG_DFL); } int main() { signal(SIGINT,response); while(1){ printf("googlen"); sleep(1); } return 0; } a) process will terminate in the first time b) process will terminate in the second time c) process will never terminate d) none of the mentioned
What will happen as we press the "Ctrl+c" key after running this program? #include<stdio.h> #include<signal.h> void response (int); void response (int sig_no) { printf("Linuxn"); } int main() { signal(SIGINT,response); while(1){ printf("googlen"); sleep(1); } return 0; } a) the string "Linux" will print b) the process will be terminated after printing the string "Linux" c) the process will terminate d) none of the mentioned
Another signal that cannot be caught is a) SIGPIPE b) SIGHUP c) SIGSTOP d) SIGUSR1
When real interval timer expires which signal is generated? a) SIGINT b) SIGCHLD c) SIGKILL d) SIGALRM
Signals are handled using which system call? a) kill b) signal c) both d) none
Default action of SIGSEGV is a) Terminate b) Core dump c) Stop d) Cont
The kill system call is used to a) Send shutdown messages to all by superuser b) Send a signal to a process c) Kill processes d) Stop the processes
What is the output of the below code? void sig_handler ( int signum) { printf("Handled the signaln"); } int main() { int pid; signal (SIGKILL, sig_handler); pid = fork(); if (pid==0) { kill(getppid(), SIGKILL); exit(0); } else { sleep(20); } return 0; } a) Error child cannot send a SIGKILL signal to parent. b) Parent goes to the signal handler, prints handled the signal and goes back to sleep c) Parent goes to the signal handler, prints handled the signal and exits d) Parent exits without going to the signal handler