Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Search results for fork
123
votes
9
answers
1
GATE CSE 2005 | Question: 72
Consider the following code fragment: if (fork() == 0) { a = a + 5; printf("%d, %p n", a, &a); } else { a = a - 5; printf ("%d, %p n", a,& a); } Let $u,v$ be the values printed by the parent process and $x,y$ be the values printed by the child ... $u + 10 = x \text{ and } v = y$ $u + 10 = x \text{ and } v != y$
Consider the following code fragment: if (fork() == 0) { a = a + 5; printf("%d, %p n", a, &a); } else { a = a - 5; printf ("%d, %p n", a,& a); }Let $u,v$ be the values pr...
Nishant T-rex
37.4k
views
Nishant T-rex
asked
Sep 14, 2014
Operating System
gatecse-2005
operating-system
fork-system-call
normal
+
–
12
votes
4
answers
2
GATE CSE 2023 | Question: 13
Which one or more of the following options guarantee that a computer system will transition from user mode to kernel mode? Function Call malloc Call Page Fault System Call
Which one or more of the following options guarantee that a computer system will transition from user mode to kernel mode?Function Callmalloc CallPage FaultSystem Call
admin
11.5k
views
admin
asked
Feb 15, 2023
Operating System
gatecse-2023
operating-system
fork-system-call
multiple-selects
1-mark
+
–
29
votes
3
answers
3
GATE CSE 2008 | Question: 66
A process executes the following code for(i=0; i<n; i++) fork(); The total number of child processes created is $n$ $2^n-1$ $2^n$ $2^{n+1} - 1$
A process executes the following codefor(i=0; i<n; i++) fork();The total number of child processes created is$n$$2^n-1$$2^n$$2^{n+1} - 1$
Kathleen
17.2k
views
Kathleen
asked
Sep 12, 2014
Operating System
gatecse-2008
operating-system
fork-system-call
normal
+
–
34
votes
4
answers
4
GATE CSE 2012 | Question: 8
A process executes the code fork(); fork(); fork(); The total number of child processes created is $3$ $4$ $7$ $8$
A process executes the codefork(); fork(); fork();The total number of child processes created is$3$$4$$7$$8$
gatecse
13.0k
views
gatecse
asked
Aug 5, 2014
Operating System
gatecse-2012
operating-system
easy
fork-system-call
+
–
1
votes
2
answers
5
#OS-FORK Output
Q23. The following C program is executed on a Unix/Linux system: main() { int i=0; while (i<20) if (i%2==0) fork(); i++; return 0; } Calculate how many number of processes will be created after executing the above program. Options: 1.1023 2.Infinite 3.1024 4.2048
Q23. The following C program is executed on a Unix/Linux system: main(){ int i=0; while (i<20) if (i%2==0) fork(); ...
BitMask
400
views
BitMask
asked
Mar 3
Operating System
operating-system
fork-system-call
gate-preparation
programming-in-c
usermod
+
–
24
votes
8
answers
6
GATE CSE 2019 | Question: 17
The following C program is executed on a Unix/Linux system : #include<unistd.h> int main() { int i; for(i=0; i<10; i++) if(i%2 == 0) fork(); return 0; } The total number of child processes created is ________________ .
The following C program is executed on a Unix/Linux system :#include<unistd.h int main() { int i; for(i=0; i<10; i++) if(i%2 == 0) fork(); return 0; }The total number of ...
Arjun
17.4k
views
Arjun
asked
Feb 7, 2019
Operating System
gatecse-2019
numerical-answers
operating-system
fork-system-call
1-mark
+
–
1
votes
1
answer
7
fork() system call
Consider the following pieces of codes for fork( ) system call. Solve and explain how many child processes are created upon execution of this program? Snippet 1: void main( ) { fork( ); fork( ); exit( ); } Snippet 2: int main( ) { int i; for (i = 0; i < 4; i++) fork(); return 0; } Learning Outcomes. Understand the working of fork ( ) system call.
Consider the following pieces of codes for fork( ) system call. Solve and explain how many child processes are created upon execution of this program? Snippet 1:void main...
Sparkboy
116
views
Sparkboy
asked
Apr 4
Operating System
operating-system
fork-system-call
+
–
15
votes
5
answers
8
ISRO2017-51
Wha is the output of the following program? main() { int a = 10; if(fork()) == 0)) a++; printf("%d\n",a); } 10 and 11 10 11 11 and 11
Wha is the output of the following program?main() { int a = 10; if(fork()) == 0)) a++; printf("%d\n",a); }10 and 11101111 and 11
sh!va
8.8k
views
sh!va
asked
May 7, 2017
Operating System
isro2017
operating-system
fork-system-call
+
–
5
votes
2
answers
9
GO Classes Test Series 2024 | Mock GATE | Test 12 | Question: 41
Assume the following code is compiled and run on a modern Linux machine. Assuming $\textsf{fork()}$ never fails, how many times will the message $\textsf{ Hello }$ will be displayed? #include <stdio.h> #include <unistd.h> int ... else { printf("Hello"); } printf("Hello"); return 0; } $2$ $3$ $4$ $6$
Assume the following code is compiled and run on a modern Linux machine.Assuming $\textsf{fork()}$ never fails, how many times will the message $\textsf{“Hello”}$ wil...
GO Classes
851
views
GO Classes
asked
Jan 21
Operating System
goclasses2024-mockgate-12
goclasses
operating-system
fork-system-call
2-marks
+
–
0
votes
3
answers
10
#CPCB
How many helloWorld lines are printed by the program: #include <stdio.h> #include <stdlib.h> void myFunc() { if (fork() == 0) { fork(); printf(“helloWorld\n”); exit(0); } return ; } int main(){ printf(“helloWorld\n”); myFunc(); printf(“helloWorld\n”); return 1; }
How many helloWorld lines are printed by the program:#include <stdio.h>#include <stdlib.h void myFunc(){ if (fork() == 0){ fork(); printf(“helloWorld\n”); exit(0); } ...
amit166
564
views
amit166
asked
Jun 30, 2023
Operating System
fork-system-call
+
–
2
votes
3
answers
11
System Call FORK()
Int main () { fork(); printf("a"); fork(); printf("b"); return 0; } How many distinct outputs are possible of above code? And also give outputs
Int main (){fork();printf("a");fork();printf("b");return 0;}How many distinct outputs are possible of above code? And also give outputs
Philosophical_Virus
898
views
Philosophical_Virus
asked
Dec 10, 2023
Operating System
operating-system
fork-system-call
+
–
3
votes
1
answer
12
fork
Consider the following code segment : int main (void) { for (int i=2; i<=5; i++) { fork( ); } printf (“GOCLASSES”); How many times “GOCLASSES” is printed by the above code?
Consider the following code segment :int main (void) { for (int i=2; i<=5; i++) { fork( ); }printf (“GOCLASSES”);How many times “GOCLASSES” is printed by the ab...
24aaaa23
787
views
24aaaa23
asked
Oct 1, 2023
Operating System
operating-system
fork-system-call
+
–
3
votes
3
answers
13
GO Classes 2023 | IIITH Mock Test 1 | Question: 27
When a process creates a new process using the $\textsf{fork()}$ operation, which of the following are shared between the parent process and the child process? Stack Heap Shared memory segments Page table
When a process creates a new process using the $\textsf{fork()}$ operation, which of the following are shared between the parent process and the child process?StackHeapSh...
GO Classes
840
views
GO Classes
asked
Mar 26, 2023
Operating System
goclasses2023-iiith-mock-1
goclasses
operating-system
fork-system-call
1-mark
+
–
0
votes
0
answers
14
fork
Consider the following pseudo code that uses fork–join constructs – S1 ; fork(L1); // fork(L) : Creates new process and execution starts from L. S2 ; S4 ;join( ) : Combines all processes able to execute join. fork(L2); L1 : S3 ; L2 join( ); S5 ; Draw correct precedence graph for the above code fragment?
Consider the following pseudo code that uses fork–join constructs –S1 ;fork(L1); // fork(L) : Creates new process and execution starts from L.S2 ;S4 ;join( ) : C...
24aaaa23
408
views
24aaaa23
asked
Oct 1, 2023
Operating System
operating-system
fork-system-call
+
–
1
votes
2
answers
15
OS handout
For following code how many times the '*' will printed? main() { int i,n ; for(i = 1 ; i<=n ; ++i) { fork(); printf("*"); } }
For following code how many times the '*' will printed?main(){ int i,n ; for(i = 1 ; i<=n ; ++i) { fork(); printf("*"); }}
Aniket1710
821
views
Aniket1710
asked
Jul 20, 2023
Operating System
fork-system-call
+
–
0
votes
2
answers
16
Unacademy practice question from OS
#include <stdio.h> void main() { int i = 3; while(i>0) { i--; if(fork()||fork()) { printf("Hi"); } } } How many times “Hi” will be printed ?? #include <stdio.h> void main() { int i = 2; while(i>0) { i--; if(fork()||fork()) { printf("Hi"); } } } How many times “Hi” will be printed ??
#include <stdio.h>void main(){ int i = 3; while(i>0) { i ; if(fork()||fork()) { printf("Hi"); } }}How many times “Hi�...
vivek1211
885
views
vivek1211
asked
Jul 5, 2023
Operating System
operating-system
fork-system-call
+
–
2
votes
1
answer
17
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
766
views
GO Classes
asked
Mar 26, 2023
Operating System
goclasses2023-iiith-mock-1
goclasses
operating-system
fork-system-call
1-mark
+
–
1
votes
3
answers
18
Unacademy AIMT question on Fork()
Given the following piece of code : Main() { Int child = fork(); Int c = 5; if (child == 5) { C + = 5; } Else { Child = fork(); C + = 5; } } What are the different values of the variable c? First of all checking child == ... a pseudocode as some of the syntaxes are wrong. Also I am getting the answer as 10,10,10. Given answer is 20,10,15. Can someone please check?
Given the following piece of code :Main(){Int child = fork();Int c = 5;if (child == 5){C + = 5;}Else{Child = fork();C + = 5;}}What are the different values of the variabl...
Sunnidhya Roy
1.1k
views
Sunnidhya Roy
asked
Dec 14, 2022
Operating System
operating-system
fork-system-call
programming-in-c
+
–
3
votes
2
answers
19
#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
20
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
786
views
Erwin Smith
asked
Apr 11, 2023
Operating System
fork-system-call
operating-system
programming-in-c
+
–
Page:
1
2
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register