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
Can someone reply me
Georgia [21]
Yes how can i help you?
4 0
2 years ago
Select the characteristics that describe the evolution of computers that predate the personal computer (select all correct answe
emmasim [6.3K]

Answer:

Options (a), (b) and (d)

Explanation:

  • Option (a) is true that the computers have become smaller and smaller with advancement of the technology. The earlier version of computers used vacuum tubes and are very big in size.
  • As the years passed and due to the advancement of the transistors the computers have become smaller in size.
  • Option (b) is true. With the advancement in the research in circuits used in the computer like Integrated Circuits the computers have become faster.
  • The response time of the operating system has reduced drastically.
  • Option (c) is wrong option. The computers have become cheaper. The transistors are cheaper compared to the vacuum tubes which are used in the earlier computers.
  • The price of the same computer (memory and time efficiency) has become less in the coming years than in the previous years with the advancement in the research of transistors.
  • Option (d) is true. Now-a-days computers support more and more number of applications. Computers has more number of applications in various and diversified fields.
  • With the advancements in the computers, the computers are finding more applications in different fields like medicine, law, transport industries etc.
5 0
3 years ago
What is the purpose of the ISOWEEKNUM function? determines how many workdays are in a certain week determines how many workdays
ivanzaharov [21]

Answer:

It's D

Explanation:

5 0
2 years ago
Read 2 more answers
You are shooting water balloons with a slingshot. One water balloon goes twice as far as another. Which of the following is the
bija089 [108]

Answer:

More potential energy was stored and released as kinetic energy in the balloon that went farther.

Explanation:

I'm taking the test ; )

8 0
2 years ago
Assume you want to write a code to calculate the addition of two numbers digit by digit. Provide the running time for your algor
Sergio039 [100]

Answer:

Explanation:

Using Python programming language

Explanation:

1. I defined a function add and passed in two parameters (a,b).

2. In the block of the function, I added the two numbers and printed the result.

3. I decided to use a function so that the program is re-usable and can accept various inputs.

Find the code below. (# are used for comments)

#Addition of numbers

def add(a,b):

   print(a+b)

#Test Cases

add(2,4.5)      #Result=6.5

add(10,290)     #Result=300

add(2.567,4.58) #Result=7.147

5 0
2 years ago
Other questions:
  • How do forensic pathologist determine time of death
    13·1 answer
  • How many rows and columns does ms-excel 2007 have???
    10·1 answer
  • The individual accountable for ensuring the day-to-day operation of the InfoSec program, accomplishing the objectives identified
    7·1 answer
  • Define a function compute gas volume that returns the volume of a gas given parameters pressure, temperature, and moles. Use the
    7·2 answers
  • What is the behavior of an element with static positioning in regard to the page layout?
    12·1 answer
  • Write a program that first reads in the name of an input file and then reads the input file using the file.readlines() method. T
    7·1 answer
  • A person who creates a computer virus is a (1)system analyst (2) techician(3) programmer​
    11·2 answers
  • You are writing a program to help compare two sports teams. A sample member of the list scores is [2. 5] where your team scored
    5·2 answers
  • Jeroo Bob has just awoken from a long night's sleep and is hungry for some winsum flowers. He walks out of
    7·1 answer
  • Several small stores rent space within a larger shopping centre. The owners of the shopping centre have provided a physical netw
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!