optum Interview Question for SDE-2s
- -1of 1 vote
Answers#include <stdio.h>
- siva.sai.2020 August 28, 2015 in India for NA
#include <unistd.h>
#include <stdlib.h>
int main(void) {
int i =0;
while(1)
{
i++;
printf("\n %d ", i);
pid_t pid;
pid = fork();
if(pid < 0)
{
wait(3600);
}
else if(!pid)
{
sleep(1);
exit(0);
}
else
{
sleep(10);
}
}
// your code goes here
return 0;
}
Is there any problem with this code ?. I ran this code, and saw same i value printing, but do not understand why it is printing twice| Report Duplicate | Flag | PURGE
optum SDE-2
Email me when people comment.
Email me when people comment.
Loading...
An error occurred in subscribing you.
Country: India
Email me when people comment.
Email me when people comment.
Loading...
An error occurred in subscribing you.
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.