Exams › GATE › Technical › GATE 2022 Computer Science and Information Technology (CS)
21 questions with worked solutions.
Answer: (ab*b)*ab* + (ba*a)*ba*
This regular expression captures the sequences generated by the finite automaton by allowing for repetitions of 'ab*b' and 'ba*a', followed by additional 'ab*' or 'ba*' patterns, thus accurately representing the transitions and states of the automaton.
Q2. Which one of the following statements is TRUE?
Answer: LR(1) parsing is sufficient for deterministic context-free languages.
LR(1) parsing is designed to handle deterministic context-free languages by using a lookahead symbol to make parsing decisions, ensuring that it can resolve ambiguities and conflicts that may arise in the parsing process.
Q3. In a relational data model, which one of the following statements is TRUE?
Answer: A relation with only two attributes is always in BCNF.
A relation with only two attributes can only have a maximum of one functional dependency, which means it satisfies the conditions for Boyce-Codd Normal Form (BCNF) by default, as there are no non-trivial functional dependencies that violate the BCNF rules.
Answer: The best algorithm for the problem takes θ(n) time in the worst case.
Reversing a singly linked list requires visiting each node exactly once to change the pointers, which results in a linear time complexity of θ(n). This is efficient and feasible within O(1) space, as it only requires a few additional pointers for the reversal process.
Answer: n / m
The expected number of keys in a slot is calculated by dividing the total number of keys (n) by the number of slots (m). Since the hashing functions distribute keys uniformly across the slots, this results in an average of n/m keys per slot.
Answer: DMA based I/O transfer
DMA (Direct Memory Access) allows peripherals to transfer data directly to main memory without involving the CPU, which maximizes throughput by freeing up the processor to perform other tasks while the data transfer occurs.
Answer: R1 = 1100 and R2 = 1010
In option B, 1100 (-4) + 1010 (-6) = -10, outside the 4-bit range [-8,7]; the binary sum 10110 truncates to 0110 (+6), a sign flip from two negatives, which is overflow. The other options stay within range, so B (R1=1100, R2=1010) is the overflow case.
Answer: S1 = 1; S2 = 0; S3 = 0
The correct initialization S1 = 1, S2 = 0, S3 = 0 allows T1 to execute first, producing 'C' and signaling T2. T2 can then execute and print 'B', signaling T3, which can subsequently print 'A'. This cycle continues, producing the desired sequence BCABCABCA...
Answer: 10, 10, 14
The program modifies the value of 'x' through the pointer 'p', setting it to 10. It then updates 'z[1]' by adding 3 to 'z[0]', which is 10, resulting in 'z[1]' becoming 14. Therefore, the final output is '10, 10, 14'.
Q10. Which of the following statements is/are TRUE?
Answer: If a language L and its complement ̅L are both recursively enumerable, then L must be recursive.
This statement is true because if both a language and its complement are recursively enumerable, it implies that there exists a Turing machine that can enumerate the strings in both the language and its complement, allowing us to decide membership in the language, thus making it recursive.
Answer: Π_eId (Π_eId,bId (Own) / Π_bId (Brand))
This expression correctly identifies eIds that own all brands by performing a division operation, which effectively filters out eIds that do not have ownership of every brand listed in the Brand relation.
Q12. Which of the following statements is/are TRUE with respect to deadlocks?
Answer: Circular wait is a necessary condition for the formation of deadlock.
Circular wait is indeed a necessary condition for deadlock because it describes a situation where a set of processes are each waiting for a resource held by another process in the set, creating a cycle that prevents any of them from proceeding.
Answer: A³ divided by 6
The number of 3-cycles in an undirected graph can be found by calculating the trace of the cube of the adjacency matrix, A³, which counts each cycle three times (once for each vertex in the cycle). Therefore, to get the correct count of unique 3-cycles, we divide the trace of A³ by 6, accounting for the overcounting.
Answer: T1 → T4 → T3 → T2
The conflict edges from S are T1->T3, T1->T4, T3->T2, T3->T4, T4->T2, whose only topological order is T1->T3->T4->T2. Therefore the conflict-equivalent serial schedule is T1->T3->T4->T2, not T3->T1->T4->T2.
Answer: P is 10:2¹⁰ decoder; Q is 5:2⁵ decoder; T is 2:1 multiplexer
The correct option describes P as a decoder that converts a 10-bit input to one of 1024 outputs, which is necessary for addressing the 1024-word memory segment S. Q is a decoder that converts a 5-bit input to one of 32 outputs, suitable for addressing the 32-word register file R. T functions as a multiplexer that selects between the outputs of P and Q based on the mode bit M, allowing the system to load the appropriate word into register X.
Answer: 1 2 3 10 11 12 19 20 21
The program initializes a 3D array and uses nested loops to print the elements. The outer loop iterates over the first dimension, while the inner loop accesses the second dimension with a fixed index of 'j' (which is always 0), resulting in the first slice of the array being printed for each iteration.
Answer: Neither L1 nor L2 is context-free.
The correct option states that neither L1 nor L2 is context-free, which is true because L1 requires matching strings that cannot be generated by a context-free grammar, and L2 requires a dependency between the number of 'a's and 'c's that also cannot be captured by context-free grammars.
Answer: Suppose S ⊂ V such that S ≠ ∅ and S ≠ V. Consider the edge with the minimum weight such that one of its vertices is in S and the other in V S. Such an edge will always be part of any minimum spanning tree of G.
This statement is true due to the cut property of minimum spanning trees, which asserts that for any cut in the graph, the minimum weight edge crossing the cut must be included in any minimum spanning tree to ensure minimal total weight.
Answer: (A) The chromatic number of the graph is 3.
The chromatic number of the Petersen graph is indeed 3 because it requires three colors to color the vertices such that no two adjacent vertices share the same color, which is a characteristic of this specific graph.
Answer: f(2ⁿ − 1) = 2ⁿ − 1
The statement is true because when substituting n with 2ⁿ - 1 into the recurrence relation, it can be shown through induction that f(2ⁿ - 1) consistently evaluates to 2ⁿ - 1, confirming the pattern established by the recurrence.
Answer: The diagonal entries of A² are the degrees of the vertices of the graph.
The diagonal entries of A² represent the sum of the products of corresponding entries in the rows and columns of the adjacency matrix, which counts the number of edges connected to each vertex, thus giving the degree of each vertex.