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]
4 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]4 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
Original documents or objects used during Internet research are known as
S_A_V [24]
Tbh i think its primary
8 0
3 years ago
Read 2 more answers
What is the purpose of reading in typography
IgorLugansk [536]

Answer:

The main purpose of typography is to make life easier for your readership by making it easier to read what you've written: It makes it possible to to quickly scan your text. It entices your readers to engage with your text. When done well, it enhances the message it presents

4 0
3 years ago
Hallo! Was ist die Hauptstadt von Northdakote wirklich schätzen, wenn jemand gefragt
timama [110]

Hallo!

I'm thinking you're speaking German so I'm gonna translate


Die Hauptstadt von North Dakota ist Bismark. Hoffe das hilft! Ich wünsche ihnen einen wunderbaren Tag!



~CoCo

5 0
3 years ago
Read 2 more answers
According to Google data, among consumers who conduct a local search on their smartphone, how many then visit a store within a d
sertanlavr [38]

Answer:

According to the google data, 50% consumers visited a store when they conduct a local search on their smartphones within a day.

And consumers more than 60% range uses location data in the advertisements. They uses store location and phone number through the advisement on smartphones and laptop.  

More than 34% of consumers search on the laptops and computer are visited to a store within a day.

8 0
3 years ago
When is founded by java
Rina8888 [55]
Java was originally developed by James Gosling at Sun Microsystems (which has since been acquired by Oracle) and released in 1995 as a core component of Sun Microsystems' Java platform
1995 the answer
4 0
3 years ago
Read 2 more answers
Other questions:
  • If you have long column labels with columns so wide that they affect the readability of a worksheet, you should first
    15·2 answers
  • If you “bury” a story on Digg, what have you done
    10·1 answer
  • To generate a report with exact results based on specific criteria it is best to base the report on a(n) ____________________ cr
    6·1 answer
  • Write a program that prompt the user to enter the coordinate of two points (x1, y1) and (x2,y2), and displays the slope of the l
    10·1 answer
  • Brake fluid is made up of a chemical that:
    13·2 answers
  • when files on storage are scattered throughout different disks or different parts of a disk, what is it called
    10·1 answer
  • JAVA
    10·1 answer
  • Identify a possible IOT (internet of Things) device in a smart kitchen and write a use case for interacting with the software of
    12·1 answer
  • What data type would you use for a decimal number?* ​
    9·1 answer
  • Besides entering a URL to go directly to a website, what else can you enter in a browser address bar to explore the internet?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!