Answer:
The answers to these questions are given below in the explanation section.
Explanation:
The following are 3 properties and 3 methods of the object computer.
Solution
Properties:
- computer name;
- computer model;
- computer color;
- computer manufacturer
Methods:
- Turn on/off
- Do Wordprocessing
- Connect Keyboard/Mouse
- Charging
- Play sound
The following are 3 properties and 3 methods of the object computer.
Properties:
- Car Model;
- Car Manufacturer;
- Car Color
Methods:
- Car Run (Speed)
- Change Gear
- Open/Close Door
- Turn on/off
Before the use of technology such as computers, information was documented through papers separated in folders. This was a very long and complicated process as people would have to find information by hand, sorting through countless documents. Now, it is much easier and neater to keep information. It can be as easy as digitally searching for someone's name and the computer will sort through countless documents, finding the one you need almost instantly. It is also much less wasteful and safe, as before computers, the use of paper was the only way to permanently keep information, also making documents vulnerable to being lost or stolen.
Use the following rules:
- The sum of currents that enter and exit a node (junction) is always zero. So if you have 3 wires that connect, through one flows 2A, the other 3A, then the third must deliver 5A (taking the direction into account!)
- The sum of voltages across different components should always add up. So if you have a battery of 10V with two unknown resistors, and over one of the resistors is 4V, you know the other one has the remaining 6V.
- With resistors, V=I*R must hold.
With these basic rules you should get a long way!
Answer:
This is the complete correct program:
#include <stdio.h>
#include<sys/types.h>
#include<unistd.h>
int value = 128;
int main()
{
pid_t pid;
pid=fork();
if (pid==0) /* child process */
{
value +=8;
return 0; }
else if (pid > 0) {/* parent process */
wait (NULL);
printf ("PARENT: value =%d\n" ,value); /* LINEA */
return 0;
}
}
The output of the LINE A is:
PARENT: value = 128
Explanation:
The fork() function used in the program creates a new process and this process is the child process. The child process is same as the original process having its own address space or memory.
In the child process the value of pid is 0. So the if condition checks if pid==0. Then the child process adds 8 to the value of its variable according to the following statement
value +=8;
Now the original process has value = 128. In else if part the parents process has the value of pid greater than zero and this portion of the program is of the parent process :
else if (pid > 0)
{ wait (NULL);
printf ("PARENT: value =%d\n" ,value);
return 0; }
So the value 128 is printed at the end in the output.
wait(NULL) is used to wait for the child process to terminate so the parent process waits untill child process completes.
So the conclusion is that even if the value of the variable pid is changed in the child process but it will not affect the value in the variable of the parent process.