Question: The following is a partial listing of a C program to handle Interrupts. If the program runs without errors, indicate the numbers of all the

The following is a partial listing of a C program to handle Interrupts. If the program runs without errors, indicate the numbers of all the sentences where a Ctrl-C command can terminate the process by preventing that sentence to execute. Namely, if Ctrl-C is pressed just before sentence X is executed, will that sentence run? If not, X should be part of your answer.
static void handler(int sig){
return;
}
int main(int argc, char *argv[])
{
sigset_t bSet;
sigset_t dSet;
float x =2.0;
01sigemptyset(&bSet);
02sigaddset(&bSet, SIGINT);
03x +=x;
04 if (sigprocmask(SIG_BLOCK, &bSet, &dSet)==-1){ exit (1); }
05x *=x;
06if (signal(SIGINT, handler)== SIG_ERR){ exit (1); }
07x *=x*x;
08x +=x*x;
09if (sigprocmask(SIG_SETMASK, &dSet, NULL)==-1){ exit (2);}
10 printf(x=%2.f
, x);
}
Correct answer:
01
Correct answer:
02
Correct answer:
03
Answer,
04
Answer,
05
Answer,
06
Answer,
07
Answer,
08
Answer,
09
Incorrect answer:
10
1,2,3 are correct answers, 10 is wrong

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!