System Call: GATE CS Previous Year Questions

System Call · Operating System

16 questions · asked in 11 of 27 years (2000–2026)

MCQ 11 · MSQ 2 · NAT 31-mark 12 · 2-mark 4

2000Questions per year2026

Questions 1–5 of 16

Q1GATE 2026 (Session 1)2 marksNAT
Consider the following program snippet. Assume that the program compiles and runs successfully. Further, assume that the fork() system call is always successful in creating a process.
int main () {
  int i;
  for (i = 0; i < 3; i++) {
  	if (fork() == 0) {
  		continue;
  	}
  	break;
  }
  printf("Hello!");
  return 0;
 } 
The total number of times that the printf statement gets executed is ________. (answer in integer)

Q2GATE 2024 (Session 1)2 marksNAT
Consider the following code snippet using the fork() and wait() system calls. Assume that the code compiles and runs correctly, and that the system calls run successfully without any errors.

int x = 3;
while(x > 0) {
fork();
printf("hello");
wait(NULL);
x--;
}
The total number of times the printf statement is executed is ___

Q3GATE 20231 markMSQ
Which one or more of the following options guarantee that a computer system will transition from user mode to kernel mode?

One or more options are correct.

Q4GATE 2021 (Session 1)1 markMSQ
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?

One or more options are correct.

Q5GATE 20191 markNAT
The following C program is executed on a Unix / Linux system:
#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 __________ .

Keep practising

Topics in Operating System

All CS topics ›