GATE 2023 Computer Science and Information Technology (CS) Questions with Solutions

GATE 2023

65 questions

MCQ 34 · MSQ 15 · NAT 161-mark 30 · 2-mark 35

Questions 46–50 of 65

Q46Heap Tree2 marksMCQ−0.67 if wrong
Let A be a priority queue for maintaining a set of elements. Suppose A is implemented using a max-heap data structure. The operation Extract-Max(A) extracts and deletes the maximum element from A. The operation Insert(A,key) inserts a new element key in A. The properties of a max-heap are preserved at the end of each of these operations.
When A contains n elements, which one of the following statements about the worst case running time of these two operations is TRUE?

Q47Binary Tree2 marksMCQ−0.67 if wrong
Consider the C function foo and the binary tree shown.

typedef struct node {
   int val;
   struct node *left, *right;
} node;

int foo(node *p) {
   int retval;
   if (p == NULL)
       return 0;
else {
     retval = p->val + foo(p->left) + foo(p->right);
     printf("%d ", retval);
     return retval;
     }
}


10 5 11 3 8 13
When foo is called with a pointer to the root node of the given binary tree, what will it print?

Q48Combination2 marksMCQ−0.67 if wrong
Let U = {1, 2,...,n}, where n is a large positive integer greater than 1000. Let k be a positive integer less than n. Let A, B be subsets of U with |A| = |B| = k and A∩B=ϕA\cap B=\phi. We say that a permutation of U separates A from B if one of the following is true.

- All members of A appear in the permutation before any of the members of B.
- All members of B appear in the permutation before any of the members of A.

How many permutations of U separate A from B?

Q49Functions2 marksMSQ
Let f:A→Bf:A\rightarrow B be an onto (or surjective) function, where AA and BB are nonempty sets. Define an equivalence relation ∼\sim on the set AA as
a1∼a2 if f(a1)=f(a2),a_1\sim a_2 \text{ if } f(a_1)=f(a_2),
where a1,a2∈Aa_1, a_2 \in A . Let ε={[x]:x∈A}\varepsilon =\{[x]:x \in A\} be the set of all the equivalence classes under ∼\sim. Define a new mapping F:ε→BF: \varepsilon \rightarrow B as
F([x])=f(x),F([x]) = f(x), for all the equivalence classes [x][x] in ε\varepsilon
Which of the following statements is/are TRUE?

One or more options are correct.

Q50Transport Layer Protocol2 marksMSQ
Suppose you are asked to design a new reliable byte-stream transport protocol like TCP. This protocol, named myTCP, runs over a 100 Mbps network with Round Trip Time of 150 milliseconds and the maximum segment lifetime of 2 minutes.
Which of the following is/are valid lengths of the Sequence Number field in the myTCP header?

One or more options are correct.