1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Vinil7 [7]
3 years ago
10

#include #include int main( ) { int value = 10; int pid; value += 5; pid = fork( ); if (pid > 0 ) { value += 20; } printf(val

ue); return 0; } Select all the values that may be printed on the screen when the above program is executed?
Computers and Technology
1 answer:
ss7ja [257]3 years ago
8 0

Explanation:

To understand how this program is working let us print the variable value at different stages of the program so that we can understand how it is working.

Intitally, value=10 when it was declared.

Then we added 5 and it become value=15

then we used fork() function which creates a parent(orignal) and child(duplicate)

When fork() succeeds it returns the child pid to parent and returns 0 to the child. As you can see (pid > 0) condition is always true therefore the parent pid value becomes 35 ( 15+20) and the child pid value becomes 0.

#include <stdio.h>

#include <unistd.h>

int main( ) {

   int value = 10;

     printf("%d\n",value);

   int pid;

   value += 5;

     printf("%d\n",value);

   pid = fork( );

     printf("%d\n",pid);

   if (pid > 0 )

   {

       value += 20;

   }

   printf("%d\n",value);

   return 0;

}

Output:

10 (initial value)

15 (modified value)

5343 (pid when fork is used)

35 (final modified value)

0 (child value)

15 (the parent value when fork was used)

You might be interested in
What is the energy conversion of solar water heaters?
Gelneren [198K]
A liquid-to-liquid heat exchanger uses a heat-transfer fluid that circulates through the solar collector, absorbs heat, and then flows through a heat exchanger to transfer its heat to water in a storage tank. Heat-transfer fluids, such as antifreeze, protect the solar collector from freezing in cold weather.
7 0
3 years ago
Which command on the Insert tab of the PowerPoint Online application is used to add a Venn diagram or process chart to a present
Setler [38]

The command to add a Venn Diagram or a process chart on PowerPoint Online is to select the Insert tab, then select the SmartArt button, and there is the process charts listed under Process. But the Venn Diagram is listed under List.

7 0
2 years ago
Read 2 more answers
Finish the statement below to correctly describe the Defense Enrollment Eligibility Reporting System (DEERS). DEERS is a central
WITCHER [35]

Answer:  A- the antlers and horns are structural adaptations. The fighting is a behavioral adaptation.

Antlers and horns are physical adaptations that some mammals have acquired over time. However, fighting is not a physical feature but a behavioral adaptation used to beat other males during mating season.

Explanation:

5 0
3 years ago
A leading global vendor of computer software, hardware for computer, mobile and gaming systems, and
V125BC [204]

Answer:

Microsoft

Explanation:

5 0
2 years ago
A strategy to solve a logic problem is to break it into steps. Using the drop-down menu, complete these sentences about solving
PSYCHO15rus [73]
I think the answer is 3!!
3 0
3 years ago
Read 2 more answers
Other questions:
  • Does toontown rewritten carry spyware or malware
    9·1 answer
  • Given two double variables, best value and second best value, write some code that swaps their values. declare any additional va
    13·1 answer
  • What is the relationship between a method and a function
    11·2 answers
  • Which communication technology should you use if you need to connect three offices which are all within 3 miles of each other at
    6·1 answer
  • True or False
    11·1 answer
  • What key value does Accenture’s myConcerto bring to clients looking for automated solutions?
    6·1 answer
  • 3. Why is human resource plan made​
    11·1 answer
  • Var words = ["apple", "bug","car", "dream", "ear", "food"]
    6·2 answers
  • What is meant by Information Retrieval?
    8·1 answer
  • Which era marked a switch from agricultural practices to industrial practices?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!