Operating Systems
CSE · Quiz · Fall 26
Section m · Batch 66
Read the questions as text
Read off the PDF by AI, so it may have mistakes. The PDF is the original.
Daffodil International University
Faculty of Science & Information Technology
Department of Computer Science & Engineering
CT-02, Fall 2026
Course Code: CSE323, Section: O, Course Title: Operating System
Time: 30 Mints Marks: 15
Answer ALL Questions
[The figures in the right margin indicate the full marks and corresponding course outcomes. All portions of each question must be answered sequentially.]
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
int main() {
pid_t pid = fork();
if (pid == 0) {
printf("Child: PID = %d\n", getpid());
sleep(3);
printf("Child: Execution completed\n");
}
else {
printf("Parent: PID = %d\n", getpid());
sleep(1);
printf("Parent: Execution completed\n");
}
return 0;
}
1. Explain how fork() creates a new process with a diagram. Identify the parent and child processes in this program and state the return value of fork() in each process. [4]
2. Explain whether a zombie or an orphan process can occur during the execution of this program. Justify your answer using the execution sequence. [4]
3. Modify only one line of the program to ensure that the parent waits for the child to finish before terminating. Write the modified line and explain its effect. [3]
4. Suppose the child process must send the message "Task completed" to the parent process instead of relying on printf(). Identify a suitable IPC mechanism and explain with a diagram how it can accomplish this communication. [4]