Consider the following C program.
#include <stdio.h>
int main() {
int i;
for (i=0;i<3;++i) {
fork();fork();
}
}
How many processes are created when running this program
(including the initial one)?
Explain

Answers were Sorted based on User's Feedback



Consider the following C program. #include <stdio.h> int main() { int i; for (i=0;i<3;+..

Answer / chetan raikwar

According to me, Total 6 processes.
1- execution of main() along with included library<stdio.h>.
2- declaration of 'i' as type 'int'.
3- for (i=0;i<3;++i)
4- fork();
5- fork(); (since two separate function will be executed separately whether it's a loop or not.
5- Termination of main function. }

Is This Answer Correct ?    0 Yes 0 No

Consider the following C program. #include <stdio.h> int main() { int i; for (i=0;i<3;+..

Answer / arati

3

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More C Interview Questions

What is the purpose of & in scanf?

0 Answers  


main() { int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); }

5 Answers   Vector, Vector Solutions,


a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list

0 Answers  


how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?

0 Answers   TCS,


Explain what is the stack?

0 Answers  






please explain every phase in the "SDLC" in the dotnet.

0 Answers  


Explain what is the benefit of using #define to declare a constant?

0 Answers  


What are volatile variables?

1 Answers   Mind Tree,


what is diffrence between string and character array?

1 Answers  


What is ponter?

0 Answers   TCS,


What is difference between structure and union in c?

0 Answers  


Is linux written in c?

0 Answers  


Categories