System Calls GATE CS PYQ Quiz

Last Updated :
Discuss
Comments

Question 1

A process executes the code

fork();
fork();
fork();

The total number of child processes created is

  • 3

  • 4

  • 7

  • 8

Question 2

A process executes the following code

for (i = 0; i < n; i++) fork();

The total number of child processes created is

  • n

  • 2n - 1

  • 2n

  • 2(n+1) - 1

Question 3

The time taken to switch between user and kernel modes of execution be t1 while the time taken to switch between two processes be t2. Which of the following is TRUE?

  • t1 > t2

  • t1 = t2

  • t1 < t2

  • nothing can be said about the relation between t1 and t2

Question 4

Which of the following standard C library functions will always invoke a system call when executed from a single-threaded process in a UNIX/Linux operating system?

  • exit

  • malloc

  • sleep

  • strlen

Question 5

A CPU generally handles an interrupt by executing an interrupt service routine

  • As soon as an interrupt is raised

  • By checking the interrupt register at the end of fetch cycle.

  • By checking the interrupt register after finishing the execution of the current instruction.

  • By checking the interrupt register at fixed time intervals.

Question 6

A computer handles several interrupt sources of which the following are relevant for this question.


. Interrupt from CPU temperature sensor (raises interrupt if
CPU temperature is too high)
. Interrupt from Mouse(raises interrupt if the mouse is moved
or a button is pressed)
. Interrupt from Keyboard(raises interrupt when a key is
pressed or released)
. Interrupt from Hard Disk(raises interrupt when a disk
read is completed)

Which one of these will be handled at the HIGHEST priority?

  • Interrupt from Hard Disk

  • Interrupt from Mouse

  • Interrupt from Keyboard

  • Interrupt from CPU temperature sensor

Question 7

Which one of the following is true for a CPU having a single interrupt request line and a single interrupt grant line?

  • Neither vectored interrupt nor multiple interrupting devices are possible.

  • Vectored interrupts are not possible but multiple interrupting devices are possible.

  • Vectored interrupts and multiple interrupting devices are both possible.

  • Vectored interrupt is possible but multiple in­terrupting devices are not possible.

Question 8

Consider the following code fragment:

  if (fork() == 0)
{ a = a + 5; printf(“%d,%d\\n”, a, &a); }
else { a = a –5; printf(“%d, %d\\n”, a, &a); }

Let u, v be the values printed by the parent process, and x, y be the values printed by the child process. Which one of the following is TRUE?

  • u = x + 10 and v = y

  • u = x + 10 and v != y

  • u + 10 = x and v = y

  • u + 10 = x and v != y

Question 9

Consider the following statements with respect to user-level threads and kernel supported threads

 
i. context switch is faster with kernel-supported threads
ii. for user-level threads, a system call can block the
entire process
iii. Kernel supported threads can be scheduled independently
iv. User level threads are transparent to the kernel

Which of the above statements are true?

  • (ii), (iii) and (iv) only

  • (ii) and (iii) only

  • (i) and (iii) only

  • (i) and (ii) only

Question 10

The following C program is executed on a Unix / Linux system:

C
#include <unistd.h>
  int main() {
    int i;
    for (i = 0; i < 10; i++)
      if (i % 2 == 0) fork();
    return 0;
  }

The total number of child process created is __________ .

Note -

This was Numerical Type question.

  • 31

  • 63

  • 5

  • 6

There are 12 questions to complete.

Take a part in the ongoing discussion