GATE 2026 (Session 1) Computer Science and Information Technology (CS) Questions with Solutions

GATE 2026 (Session 1)

65 questions

MCQ 28 · MSQ 24 · NAT 131-mark 30 · 2-mark 35

Questions 61–65 of 65

Q61Function2 marksNAT
Consider the recursive functions represented by the following code segment:
int bar(int n) {
  if (n == 1) return 0;
  else return 1 + bar(n/2);
 }
 int foo(int n) {
  if (n == 1) return 1;
  else return 1 + foo(bar(n));
 } 
The smallest positive integer n for which foo(n)\text{foo(n)} returns 55 is ________. (answer in integer)
Note: Ignore syntax errors (if any) in the function.

Q62Binary Search Tree2 marksNAT
The following sequence corresponds to the preorder traversal of a binary search tree TT :

50,25,13,40,30,47,75,60,70,80,7750,25,13,40,30,47,75,60,70,80,77

The position of the element 6060 in the postorder traversal of TT is ________ . (answer in integer)
Note: The position begins with 11.

Q63System Call2 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)

Q64CPU Scheduling2 marksNAT
Consider a CPU that has to execute two types of processes. The first type, Actuators (A), requires a CPU burst of 66 seconds. The second type, Controllers (C), requires a CPU burst of 88 seconds. A new process of type A arrives at time t=10t=10, 20,30,4020, 30, 40, and 5050 (in seconds). Similarly, a new process of type C arrives at time t=t= 11,22,33,4411, 22, 33, 44, and 5555 (in seconds). The CPU scheduling policy is First Come First Serve (FCFS). The first process of type A starts running at t=10t=10 seconds. The average waiting time (in seconds) for the 1010 processes is ________. (rounded off to one decimal place)

Q65Relational Schema2 marksNAT
Consider a relational database schema with a relation R(A,B,C,D)R(A, B, C, D). If {A,B}\{A, B\} and {A,C}\{A, C\} are the only two candidate keys of the relation RR, then the number of superkeys of relation RR is ________. (answer in integer)