GATE 2024 (Session 2) Computer Science and Information Technology (CS) Questions with Solutions

GATE 2024 (Session 2)

65 questions

MCQ 32 · MSQ 18 · NAT 151-mark 30 · 2-mark 35

Questions 36–40 of 65

Q36Array and Pointer2 marksMCQ−0.67 if wrong
What is the output of the following C program?

#include <stdio.h>
int main() {
double a[2]={20.0, 25.0}, *p, *q;
p = a;
q = p + 1;
printf("%d,%d", (int)(q - p), (int)(*q - *p));
return 0;}

Q37CPU Scheduling2 marksMCQ−0.67 if wrong
Consider a single processor system with four processes A, B, C, and D, represented as given below, where for each process the first value is its arrival time, and the second value is its CPU burst time.

A (0, 10), B (2, 6), C (4, 3), and D (6, 7).

Which one of the following options gives the average waiting times when preemptive Shortest Remaining Time First (SRTF) and Non-Preemptive Shortest Job First (NP-SJF) CPU scheduling algorithms are applied to the processes?

Q38Network Layer Protocol2 marksMCQ−0.67 if wrong
Which one of the following CIDR prefixes exactly represents the range of IP addresses 10.12.2.0 to 10.12.3.255?

Q39Binary Search Tree2 marksMCQ−0.67 if wrong
You are given a set VV of distinct integers. A binary search tree TT is created by inserting all elements of VV one by one, starting with an empty tree. The tree TT follows the convention that, at each node, all values stored in the left subtree of the node are smaller than the value stored at the node. You are not aware of the sequence in which these values were inserted into TT, and you do not have access to TT.
Which one of the following statements is TRUE?

Q40Context Free Grammar2 marksMCQ−0.67 if wrong
Consider the following context-free grammar where the start symbol is SS and the set of terminals is {a,b,c,d}\{a, b, c, d\}.

S→AaAb∣BbBaA→cS∣ϵB→dS∣ϵ\begin{aligned} & S \rightarrow A a A b \mid B b B a \\ & A \rightarrow c S \mid \epsilon \\ & B \rightarrow d S \mid \epsilon \end{aligned}

The following is a partially-filled LL(1) parsing table.

abcd$SS→AaAbS→BbBa(1)(2)AA→ϵ(3)A→cSB(4)B→ϵB→dS\begin{array}{|c|c|c|c|c|c|} \hline & a & b & c & d & \$ \\ \hline S & S \rightarrow A a A b & S \rightarrow B b B a & (1) & (2) & \\ \hline A & A \rightarrow \epsilon & (3) & A \rightarrow c S & & \\ \hline B & (4) & B \rightarrow \epsilon & & B \rightarrow d S & \\ \hline \end{array}

Which one of the following options represents the CORRECT combination for the numbered cells in the parsing table?
Note: In the options, "blank" denotes that the corresponding cell is empty.