Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Search results for fork
3
votes
2
answers
21
#OS Fork () tell the O/P?
A process executes the following segment of code : for(i = 1; i <= n; i++) fork (); fork (); The number of new processes created is
A process executes the following segment of code :for(i = 1; i <= n; i++) fork (); fork ();The number of new processes created is
iarnav
1.9k
views
iarnav
asked
Oct 18, 2018
Operating System
fork-system-call
operating-system
+
–
0
votes
1
answer
22
Fork() system call doubt
void main() { int n = 1; if(fork()==0) { n = n<<1; printf(“%d, “, n); n = n <<1; } if(fork()==0) n=n+700; printf(“%d, “,n); } Which of the following output is not possible? 2,4,1,701,704 1,2,4,704,701 2,704,4,701,1 1,704,2,4,701
void main() { int n = 1; if(fork()==0) { n = n<<1; printf(“%d, “, n); n = n <<1; } if(fork()==0) n=n+700; printf(“%d, “,n); }Which of the following output is not ...
Erwin Smith
757
views
Erwin Smith
asked
Apr 11, 2023
Operating System
fork-system-call
operating-system
programming-in-c
+
–
1
votes
1
answer
23
GO Classes 2023 | IIITH Mock Test 1 | Question: 28
Given the following piece of code: main(int argc, char ** argv) { int child = fork(); int c = 5; if(child == 0) { c += 5; } else { child = fork(); c += 10; if(child) c += 5; } } How many different copies of the variable $\textsf{c}$ are there? $2$ $3$ $4$ $1$
Given the following piece of code:main(int argc, char argv) { int child = fork(); int c = 5; if(child == 0) { c += 5; } else { child = fork(); c += 10; if(child) c += 5...
GO Classes
619
views
GO Classes
asked
Mar 26, 2023
Operating System
goclasses2023-iiith-mock-1
goclasses
operating-system
fork-system-call
1-mark
+
–
0
votes
1
answer
24
Fork() | OS
int doWork(){ fork(); fork(); printf("Hello world!\n"); } int main() { doWork(); printf("Hello world!\n"); exit(0); }
int doWork(){ fork(); fork(); printf("Hello world!\n");}int main() { doWork(); printf("Hello world!\n"); exit(0);}
abhinowKatore
1.4k
views
abhinowKatore
asked
Jan 13, 2023
Operating System
fork-system-call
operating-system
+
–
4
votes
2
answers
25
GO Classes Test Series 2023 | Operating Systems | Test 4 | Question: 8
Given the following piece of code main(int argc, char ** argv) { forkthem(5) } void forkthem(int n) { if(n > 0) { fork(); forkthem(n-1); } } How many processes are created if the above piece of code is run? (Hint: It may be easier to solve this problem by induction/recursion.)
Given the following piece of codemain(int argc, char argv) { forkthem(5) } void forkthem(int n) { if(n 0) { fork(); forkthem(n-1); } }How many processes are created if...
GO Classes
384
views
GO Classes
asked
Oct 9, 2022
Operating System
goclasses2024-os-4-weekly-quiz
numerical-answers
goclasses
operating-system
fork-system-call
2-marks
+
–
1
votes
0
answers
26
Fork System Call and Threads | OS | MSQ
MSQ Consider the following statements, which one of the following is/are TRUE In fork() system call, child process inherits all the open file descriptors of parent process In fork() system call, child process copies the code of the ... system call, child process shares the code of the parent process User level threads shares the code segment of the process
MSQ Consider the following statements, which one of the following is/are TRUEIn fork() system call, child process inherits all the open file descriptors of parent process...
Souvik33
759
views
Souvik33
asked
Nov 28, 2022
Operating System
operating-system
fork-system-call
unix
process-and-threads
threads
multiple-selects
+
–
2
votes
1
answer
27
gateforum
h4kr
311
views
h4kr
asked
Nov 8, 2022
Operating System
gateforum-test-series
operating-system
fork-system-call
+
–
0
votes
2
answers
28
Operating System
On Solving manually I too getting 14 as answer. but on running more than 14 * are printed.
On Solving manually I too getting 14 as answer. but on running more than 14 * are printed.
Overflow04
813
views
Overflow04
asked
Aug 29, 2022
Operating System
operating-system
ace-test-series
fork-system-call
+
–
1
votes
2
answers
29
Geeksforgeeks mock - 2022
Consider the following C program: #include <stdio.h> #include <stdlib.h> #include <unistd.h> int main (void) { pid_t pid; int x = 2; pid = fork ( ); if (pid = = 0); x = 8; fork( ); printf("%d", x); return 0; } Fork ( ) is a system call creates new ... the program is executed on the unix OS?[MSQ] (a) 8 2 2 8 (b) 8 8 2 2 (c) 2 8 8 2 (d) 2 2 8 8
Consider the following C program:#include <stdio.h #include <stdlib.h #include <unistd.h int main (void) { pid_t pid; int x = 2; pid = fork ( ); if (pid = = 0); ...
o
1.3k
views
o
asked
Dec 19, 2021
Operating System
operating-system
multiple-selects
fork-system-call
+
–
0
votes
1
answer
30
made easy test series
When a process create a child, which of the following is/are correct possibility/situation? A) Parent process can execute parallely with children. B) Parent process can wait until some or all of its children have terminated. C)Child process can only be the duplicate of parent process. D) Child process can only loaded with program other than parent program.
When a process create a child, which of the following is/are correct possibility/situation?A) Parent process can execute parallely with children.B) Parent process can wai...
viral8702
904
views
viral8702
asked
Oct 12, 2022
Operating System
made-easy-test-series
fork-system-call
+
–
13
votes
4
answers
31
fork() using Tree structure
How many times ‘4’ will be printed ? int main() { if (fork() && (!fork())) { if (fork() || fork()) { fork(); } } printf("4 "); return 0; } How to approach these kind of questions using Tree structure ??
How many times ‘4’ will be printed ? int main() { if (fork() && (!fork())) { if (fork() || fork()) { fork(); } } printf("4 ");...
Brij gopal Dixit
8.7k
views
Brij gopal Dixit
asked
Jun 13, 2019
Operating System
fork-system-call
+
–
41
votes
6
answers
32
GATE IT 2004 | Question: 64
A process executes the following segment of code : for(i = 1; i <= n; i++) fork (); The number of new processes created is $n$ $((n(n + 1))/2)$ $2^n - 1$ $3^n - 1$
A process executes the following segment of code :for(i = 1; i <= n; i++) fork ();The number of new processes created is$n$$((n(n + 1))/2)$$2^n - 1$$3^n - 1$
Ishrat Jahan
11.8k
views
Ishrat Jahan
asked
Nov 2, 2014
Operating System
gateit-2004
operating-system
fork-system-call
easy
+
–
0
votes
1
answer
33
justify the answer
how many child process will be created for the following code.how many hello and welcome will be printed #include <stdio.h> void main() { fork(); fork(); printf("Hello \n"); fork(); printf("welcome\n"); }
how many child process will be created for the following code.how many hello and welcome will be printed#include <stdio.h void main() { fork(); fork(); printf("H...
emlin
3.6k
views
emlin
asked
Jun 26, 2022
Operating System
fork-system-call
+
–
2
votes
2
answers
34
Virtual Gate Test Series: Operating System - Fork-Join Concurrency Structure
Consider the code fragment: count = 3; S1; Fork L1; L1: S3; S2; goto L3; S4; Fork L2; L2: S6; goto L3; S5; L3: join count S7 Which one of the following represents correct precedence graph of the above code fragment? the answer is given but I’m getting where am I wrong?
Consider the code fragment: count = 3;S1;Fork L1; L1: S3; S2; goto L3;S4;Fork L2; L2: S6; goto L3;S5; L3: join countS7...
aditi19
3.8k
views
aditi19
asked
Jun 12, 2019
Operating System
operating-system
precedence-graph
fork-system-call
concurrency
virtual-gate-test-series
+
–
1
votes
1
answer
35
Galvin Edition 9 Exercise 3 Question 1 (Page No. 149)
#include <sys/types.h> #include <stdio.h> #include <unistd.h> int value = 5; int main() { pid t pid; pid = fork(); if (pid == 0) { /* child process */ value += 15; return 0; } else if (pid > 0) { /* ... ;PARENT: value = %d",value); /* LINE A */ return 0; } } Explain what the output will be at LINE A in this program.
#include <sys/types.h #include <stdio.h #include <unistd.h int value = 5; int main() { pid t pid; pid = fork(); if (pid == 0) { /* child process */ value += 15; return 0;...
akash.dinkar12
935
views
akash.dinkar12
asked
Mar 19, 2019
Operating System
galvin
operating-system
process
programming
fork-system-call
+
–
1
votes
2
answers
36
Ace Test series: Operating System - Fork
What is the number of child process created ? Answer given was 63, BUT i am getting 9 !
What is the number of child process created ?Answer given was 63, BUT i am getting 9 !
♥_Less
1.7k
views
♥_Less
asked
Jan 12, 2018
Operating System
operating-system
fork-system-call
ace-test-series
programming
programming-in-c
+
–
0
votes
1
answer
37
UPPCL AE 2018:36
Consider the following program. #include<stdio.h> #include<stdlib.h> #include<unistd.h> int main(void) { pid_t pid; int varl = 100; pid = fork(); if(pid == 0) /* Child process */ varl = 200; fork(); printf( %d , varl); return 0; } Assuming all invocations of fork are ... $200 \; 200 \; 200 \; 200$ $100 \; 100 \; 100 \; 100$ $100 \; 200 \; 200 \; 200$
Consider the following program.#include<stdio.h #include<stdlib.h #include<unistd.h int main(void) { pid_t pid; int varl = 100; pid = fork(); if(pid == 0) /* Ch...
admin
376
views
admin
asked
Jan 5, 2019
Operating System
uppcl2018
operating-system
system-call
fork-system-call
+
–
5
votes
8
answers
38
Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 39 (Page No. 177)
Consider the following piece of C code: void main( ) { fork( ); fork( ); exit( ); } How many child processes are created upon execution of this program?
Consider the following piece of C code: void main( ) { fork( ); fork( ); exit( ); }How many child processes are created upon execution of this program?
admin
3.4k
views
admin
asked
Oct 25, 2019
Operating System
tanenbaum
operating-system
process-and-threads
fork-system-call
descriptive
+
–
9
votes
4
answers
39
Fork (ACE)
main() { if(fork()>=0) { printf("*"); if(fork()==0) { printf("*"); } else{ //do nothing } printf("*"); } How many number of times “*” will be printed?
main() { if(fork()>=0) { printf("*"); if(fork()==0) { printf("*"); } else{ //do nothing } printf("*"); }How many number of times “*” will be printed?
srestha
3.3k
views
srestha
asked
Feb 27, 2019
Operating System
fork-system-call
operating-system
+
–
1
votes
1
answer
40
GATE Suitability Test | Test 1 | Question: 2
The set of values printed (in any order) by the following code will be #include<stdio.h> #include<unistd.h> int main() { static int count; if(fork()) { count++; } if(fork() && !count++) count++; printf(“%d \t”, count); } 0 1 1 2 0 0 1 2 0 1 2 2 2 2 2 2
The set of values printed (in any order) by the following code will be#include<stdio.h #include<unistd.h int main() { static int count; if(fork()) { count++; } if(fork() ...
Arjun
305
views
Arjun
asked
Jun 10, 2018
Operating System
gate-suitability-test-1
fork-system-call
+
–
Page:
« prev
1
2
3
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register