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.
Answer:
inFile.open("progdata.dat");
Explanation:
This command opens the file which is passed to it as an argument. We are quite used to the C++'s cin and cout functions contained in iostream library for reading and writing data, however, when working will real-life stuff, we find ourselves working with huge data saved as separate files and require our programs to read them, manipulate them and possibly write back to the files... The first operation usually carried out before a file can be read or written to is open
Answer:
Software requirement specification
Explanation:
requirement specification is the first step before proceeding with any project.
we should validate our output at all phases with software requirement specification
Answer:
1. Open a cloud installer (the source), which is usually Play Store, Aptoide, or UpToDown, in the case of Android phones.
2. Request the package from the server, which will be transmitted via an internet connection. Usually called "downloading".
3. Allow the package provider (mobile store) to install the app on the system, this being the "install" part, where it's put together.
4. Run the app by, usually, pressing the icon in the app drawer.
Flexibility and open-mindedness
being quick to adapt to technology changes
having a positive attitude
taking initiative to solve problems