void sig_handler(){ printf(\"Beep\ \"); alarm(1); } int main(){ if(signal(SIGALR
ID: 3822594 • Letter: V
Question
void sig_handler(){
printf("Beep ");
alarm(1);
}
int main(){
if(signal(SIGALRM, sig_handler) == SIG_ERR){
printf("Failed to bind handler ");
}
printf("Going into an infinite loop ");
alarm(1);
while(1);
return 0;
}
______________________________________
Suppose the above program is run for 4.5 seconds after it prints "Going in an infinite loop". Note: There might be other processes contesting for the CPU.
(A):The number "Beep" would always be strictly greater than 4 (B): The number "Beep" would always be exactly equal to 4 (C): The number "Beep" would always be greater than or equal to 4 (D): The number "Beep" would always be strictly less than 4 (E): The number "Beep" would always be less than or equal to 4
Explanation / Answer
Answer: After the compiling the program it prints "Going to infinite loop" after that i started the timer till 4.5 sec. The program prints more than 4 beeps nearly 6-7 beep messages were printed.
Option A : The number "Beep" would always be strictly greater than 4
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.