NPTEL Operating System Fundamentals Week 4 Assignment Answers 2024

admin
By admin

NPTEL Operating System Fundamentals Week 4 Assignment Answers 2024

1. What is the purpose of a context switch in an operating system?

(A) Allocate memory to a new process
(B) Deallocate the memory from a process
(C) Save and restore the state of a process to allow multitasking
(D) Terminate a process
(E) Initialize a new process in the ready queue

Answer :- For Answer Click Here

2. Which of the following system call is used to replace the current process image with a new process image.

(A) fork()
(B) execl()
(C) exit()
(D) wait()
(E) sleep()

Answer :- For Answer Click Here

3. What is the outcome of the following program?

#include <unistd.h> 
#include <stdio.h> 
#include <stdlib.h> 
int main() 
{ 
if (execlp("ls", "ls", "-l", NULL) == -1) 
{ 
    perror("execlp"); 
    exit(EXIT_FAILURE); 
}
 printf("This line should not be reachedn");
 return 0; 
}

(A) The outcome is exactly same as the outcome of ls -l command
(B) The outcome is exactly same as the outcome of ls command
(C) The outcome is exactly same as the outcome of ls -a command
(D) The outcome is exactly same as the outcome of ls -h command
(E) The outcome is exactly same as the outcome of ls -t command

Answer :- 

4. How many processes will be created by the following program?

#include <unistd.h> 
#include <stdio.h> 
#include <stdlib.h> 
int main() 
{ 
int n;
for(i=1;i<=n; i=i*2)
{
   fork();
}
 return 0; 
}

(A) n
(B) n2
(C) log2n
(D) nlog2n
(E) √n

Answer :- 

5. Choose the invalid option.

(A) The OS executes exit() system call when the process completes its execution successfully
(B) The OS executes exit() system call when the user explicitly requests the termination of the process
(C) The OS executes exit() system call when the parent process decides to terminate a child process
(D) The OS executes exit() system call when the process decided to enter into waiting state
(E) The OS executes exit() system call when the process encounters an unrecoverable error or exception

Answer :- For Answer Click Here

6. Choose the invalid option. The wait() system call

(A) makes the parent process wait until all of its child processes have terminated
(B) returns the process identity of the terminated child process
(C) allows the parent process to retrieve the exit status of the terminated child process
(D) is used by a child process to wait for its parent process to terminate
(E) The wait() system call is used to prevent the creation of zombie processes

Answer :- 

7. Choose the incorrect option. The pipe() system call

(A) is used to create a unidirectional communication channel between processes
(B) returns two file descriptors, one for reading and one for writing
(C) can be used for inter-process communication between unrelated processes
(D) allows data to flow from the read end to the write end of the pipe
(E) is typically used for communication between a parent process and its child process

Answer :- For Answer Click Here

8. Which of the following is not directely supported by thread?

(A) degree of multiprogramming
(B) system throughput
(C) multiprocessor arctitecture
(D) easy resource sharing
(E) lower context context switching

Answer :- 

9. A multiprocessor system

(A) supports parallel execution of instructions through multithreading
(B) allows multiple processes to execute asynchronously
(C) is suitable for executing strictly sequential processing tasks efficiently
(D) allows multiple processes run independently
(E) allows interprocess communication among independent processes

Answer :- 

10. Which of the following system calls is not related to the shared memory interprocess communication?

(A) shmget()
(B) shmat()
(C) shmdt()
(D) shmctl()
(E) shmext()

Answer :- For Answer Click Here
Share This Article
Leave a comment