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

Hai friends im a i year student. i want to develop my knowledge in the field of TSR in c. How I'm Improve ?

2 Answers  


What is volatile variable in c with example?

0 Answers  


the maximum width of a c variable name can be a) 6 characters b) 8 characters c) 10 characters d) 20 characters

2 Answers  


Can 'this' pointer by used in the constructor?

0 Answers  


How can I implement sets or arrays of bits?

0 Answers  


how to execute a program using if else condition and the output should enter number and the number is odd only...

0 Answers  


Design a program which assigns values to the array temperature. The program should then display the array with appropriate column and row headings.

0 Answers  


any "C" function by default returns an a) int value b) float value c) char value d) a & b

0 Answers  


what will be the output for the following program? main() { char ch = 'k'; char c; printf("%c",c); }

3 Answers  


What is c language used for?

0 Answers  


What are pointers? Why are they used?

0 Answers  


Write a program in C to convert date displayed in gregorian to julian date

0 Answers   HCL, Wipro,


Categories