Exams › GATE › Technical › MAIN PAPER - CS
24 questions with worked solutions.
Answer: (∀x ∃y (fsa(x) ∧ pda(y) ∧ equivalent(x, y)))
This statement correctly asserts that for every finite state automaton x, there exists a pushdown automaton y such that x and y are equivalent, fulfilling the requirement that each finite state automaton has a corresponding equivalent pushdown automaton.
Answer: arm starting and stopping inertia
The seek latency is affected by the physical limitations of the disk's read/write arm, which experiences inertia when starting and stopping. This means that the time taken to move the arm is not directly proportional to the distance it needs to travel, as it takes additional time to overcome inertia.
Answer: III only
The auto-increment addressing mode allows the address to be automatically incremented after each access, which means the increment size is determined by the data type being accessed, making statement III correct.
Answer: I, II and III only
The RFE instruction is designed to safely return from an exception, which necessitates it being a trap and privileged instruction to ensure proper control over the execution environment. Additionally, preventing exceptions during its execution is crucial to maintain system stability and integrity.
Answer: IV only
In a multi-level cache hierarchy, for inclusion to hold, the L2 cache must be at least as large as the L1 cache to ensure that all data stored in L1 can also be contained in L2. This size relationship is crucial for maintaining the inclusion property.
Answer: during effective address calculation
The data TLB is accessed during effective address calculation because it is responsible for translating virtual addresses to physical addresses, which is a critical step that occurs while the effective address is being determined.
Answer: h(n) = O(f(n)); g(n) = Ω(f(n))
h(n)=n^(log n)=2^((log n)^2), which is sub-exponential, so h(n)=O(f(n)) with f(n)=2^n. Also n! grows faster than 2^n, so g(n)=Omega(f(n)). Thus the correct statement is 'h(n)=O(f(n)); g(n)=Omega(f(n))'. Stored option 0 fails because g(n)=n! is not O(h(n)).
Answer: Θ(log n)
In a sorted array, we can efficiently find the target integer using binary search, which reduces the search space by half with each comparison, resulting in a time complexity of Θ(log n) to determine if the integer appears more than n/2 times.
Answer: There are two vertex-disjoint paths between every pair of vertices
The statement about having two vertex-disjoint paths between every pair of vertices is not necessarily true because while G has two edge-disjoint spanning trees, this does not guarantee that there are vertex-disjoint paths, as the paths may share vertices.
Answer: T(n) ≤ T(n/5) + T(4n/5) + n
The correct option reflects the recursive nature of the Quicksort algorithm, where the list is divided into two parts: one containing at least one-fifth of the elements and the other containing the remaining elements. This ensures that the total number of comparisons includes the work done on both sub-lists, plus the linear time needed for partitioning.
Answer: Q solves the subset-sum problem in polynomial time when the input is encoded in binary
The algorithm Q runs in O(nW) time, which is polynomial in terms of the input size when W is encoded in unary. However, when W is encoded in binary, the size of W can grow exponentially relative to its value, making the algorithm's time complexity exponential in practice, thus not polynomial.
Answer: Θ(n)
The correct option is Θ(n) because reconstructing a binary search tree from its postorder traversal involves processing each of the n elements exactly once to determine their positions in the tree, leading to a linear time complexity.
Answer: Θ(n)
Inserting n elements not necessarily one-by-one means placing all 2n elements and running build-heap (heapify), which is Theta(n). So the total time is Theta(n).
Q14. Which of the following statements is false?
Answer: Every subset of a recursively enumerable set is recursive
This statement is false because while every recursively enumerable set can be recognized by a Turing machine, not all subsets of such sets are guaranteed to be recursive; some may be non-decidable.
Answer: (C) E – R, F – P, G – Q, H – S
Option C is correct because it accurately matches each concept with its corresponding language or grammar: E (checking identifiers) aligns with R (palindromes), F (parameter matching) corresponds to P (function parameters), G (parentheses in expressions) relates to Q (grammar for expressions), and H (palindromes) matches with S (grammar for palindromes).
Answer: (A) I and IV only
Option I represents a regular set because it can be described by a regular expression, allowing any number of 'a's followed by an even number of 'b's. Option IV is also regular as it can be expressed using a finite automaton that accepts any string from {a,b} followed by a 'c' and then any string from {a,b}, demonstrating closure properties of regular languages.
Answer: I, II and V only
Option I is correct because a language without global variables and nesting can still use static allocation for recursion. Option II is accurate as multi-level access links are necessary for managing activation records only when nesting is present. Option V is true since returning functions typically requires a dynamic allocation scheme to manage their lifetimes.
Q18. In the slow start phase of the TCP congestion control algorithm, the size of the congestion window
Answer: increases exponentially
During the slow start phase of TCP congestion control, the congestion window size doubles with each round-trip time, leading to an exponential increase in the amount of data that can be sent, which helps to quickly utilize available bandwidth.
Answer: 2046
The subnet mask 255.255.248.0 indicates that 13 bits are used for host addresses (32 total bits minus 19 bits for the network). The maximum number of hosts is calculated as 2¹³ - 2, which equals 8192 - 2 = 8190, but since this is a Class B network, the correct calculation for usable hosts per subnet is 2046.
Answer: connect() system call returns successfully
The connect() system call can return successfully because the client can establish a connection to the server's listening socket, even if the server has not yet called accept(). The connection is established in a half-open state, allowing the client to proceed.
Answer: ?1 is ((c = getchar()) != ' ') ?2 is putchar(c);
The correct option uses the assignment within the condition to read a character and check if it is not a newline. This allows the function to recursively call itself until the newline is encountered, and then it prints each character in reverse order as the recursion unwinds.
Answer: 2,1,4,3,6,5,7
The function swaps the values of each pair of nodes in the linked list. Starting with the first two nodes, it swaps their values, then moves to the next pair, continuing this process until it reaches the end of the list. As a result, the original list 1,2,3,4,5,6,7 is transformed into 2,1,4,3,6,5,7.
Answer: Only I, III and IV
Options I, III, and IV are equivalent because they all yield the same result by focusing on the common key attributes P and Q from both relations R and S. Option I directly joins R and S and projects P, while III uses intersection to find common keys, and IV effectively retrieves the same keys by eliminating non-matching entries. Option II, however, does not guarantee the same result as it joins the projections of R and S separately, which may lead to different outcomes.
Answer: 256 and 4
A secondary index on a key is dense: 16384 entries, each key(6)+pointer(10)=16 bytes, so blocking factor = 1024/16 = 64. First level = ceil(16384/64)=256 blocks; second level = ceil(256/64)=4 blocks. The answer is 256 and 4.