Vidyalelo
Computer Science · Q769

Linux

Engineering and GATE · Computer Science · question 769

Q769

What is the output of this program? #include #include int main() int *ptr1; while(1) ptr1 = malloc(1024*1024); if(ptr1 == 0) break; sleep(1); printf("Example "); free(ptr1); return 0;

A.
it will print "Example" until the process has been stopped by any signal
Answer
B.
it will print nothing
C.
segmentation fault
D.
none of the mentioned

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board