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

Compare array data type to pointer data type

0 Answers  


what is a non volatile key word in c language?

1 Answers  


Write a Program to print this triangle: * ** * **** * ****** * ******** * ********** use two nested loops.

12 Answers   MIT, TCS,


Explain what is operator promotion?

0 Answers  


what type of questions arrive in interview over c programming?

0 Answers  


for(;;) printf("C language") What is out put of above??

2 Answers   Practical Viva Questions,


in a town the percentage of men is 52 the percentage of total literacy is 48 if total percentage of literate men is 35 of the total population write a program to find the total no of the literate men and women if the population of the town is 80000

3 Answers  


Q.11 Generate the following pattern using code in any language(c/c++/java) for n no. of rows 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1

2 Answers  


What is array of pointers to string?

0 Answers  


What is the difference between printf and scanf in c?

0 Answers  


Write the following function in C. stripos — Find position of first occurrence of a case- insensitive string int stripos ( char* haystack, char* needle, int offset ) Returns the numeric position of the first occurrence of needle in the haystack string. Note that the needle may be a string of one or more characters. If needle is not found, stripos() will return -1. The function should not make use of any C library function calls.

4 Answers   OpenFeel,


Diff between for loop and while loop?

2 Answers   TCS,


Categories