33.
What is the output of this program?
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
 
int main()
{
    pid_t child;
    int status;
    child = fork();        
        switch(child){
            case -1 :
                perror("fork");
                exit(1);
            case 0 :
                exit(2);
                break;
            default :       
                wait(&status);
                printf("%d\n",WEXITSTATUS(status));
                break;
        }
        return 0;
}

34.
What is the output of this program?
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
 
int main()
{
    pid_t child;
    int status;
    child = fork();
    switch(child){
        case -1 ;
            perror("fork");
            exit(1);
        case 0 :
            printf("%d\n",getppid());
            break;
        default :
            printf("%d\n",getpid());
            wait(&status);
            break;
     }
     return 0;
}

35.
After running this program, as you press 'e', what will be the output of the program?
#!/bin/bash
echo "press 'e' to print Example"
read var
if $var=e
then
echo "Example"
else
echo "You did not press e"
fi
exit 0

Read More Section(Linux)

Each Section contains maximum 100 MCQs question on Linux. To get more questions visit other sections.