Exams › GATE › Technical › Computer Science and Information Technology Set-2
21 questions with worked solutions.
Answer: 28 bits and 0 bits
Block size 16 bytes needs 4 offset bits; a fully associative cache has zero index bits since any block maps anywhere. Tag = 32 - 4 - 0 = 28 bits. So 28 bits tag and 0 bits index, which is the last option, not '24 and 0'.
Q2. Which one of the following kinds of derivation is used by LR parsers?
Answer: Rightmost in reverse
LR parsers utilize a rightmost in reverse derivation because they construct the parse tree from the leaves up to the root, effectively processing the input from the end to the beginning, which aligns with the rightmost derivation approach.
Q3. In 16-bit 2’s complement representation, the decimal number −28 is:
Answer: 1111 1111 1110 0100
The correct option represents the 2's complement of the positive value 28, which is calculated by first converting 28 to binary (0000 0000 0001 1100), then inverting the bits and adding 1, resulting in 1111 1111 1110 0100 for -28 in 16-bit representation.
Answer: Both I and II
Both statements are true because they represent different ways to count the number of pairs (x, X) where x is an element of the subset X of U. The first statement counts all possible subsets and their elements, while the second uses combinatorial counting to arrive at the same total.
Q5. Which one of the following is NOT a valid identity?
Answer: (x + y) ⊕ z = x ⊕ (y + z)
Option B is incorrect because it misapplies the properties of the XOR operation (⊕) and addition (+). Unlike addition, XOR does not distribute over addition, making this identity invalid.
Q6. If L is a regular language over Σ = {a, b}, which one of the following languages is NOT regular?
Answer: {ww^R | w ∈ L}
The language {ww^R | w ∈ L} is not regular because it requires matching a string with its reverse, which cannot be done by a finite automaton, as it lacks the memory to store an arbitrary length of 'w' for comparison.
Answer: I and II are equivalent statements.
A square matrix is invertible if and only if its determinant is non-zero, meaning that both statements are true simultaneously or false simultaneously. Therefore, I and II are equivalent statements.
Answer: R1 only
R1 (a = g^-1 b g) is conjugacy, which is reflexive, symmetric, and transitive in any group, so it is an equivalence relation. R2 (a = b^-1) fails reflexivity since a = a^-1 requires a^2 = e, not true for all a. Only R1, index 1, not 'R1 and R2'.
Answer: Both I and II
Both statements are true because the strict two-phase locking protocol ensures that transactions are executed in a way that maintains conflict serializability and recoverability. Additionally, the timestamp-ordering concurrency control with Thomas' Write Rule allows for the generation of view serializable schedules that may not adhere to conflict serializability due to its handling of write operations.
Answer: (n - 1)! / 2
In a complete graph with n vertices, each Hamiltonian cycle can be represented by fixing one vertex and arranging the remaining (n-1) vertices in a cycle. Since each cycle can be traversed in two directions (clockwise and counterclockwise), we divide by 2, resulting in (n - 1)! / 2 distinct Hamiltonian cycles.
Answer: Non-leaf nodes have pointers to data records
Non-leaf nodes in a B+ tree do not contain pointers to actual data records; instead, they only store keys and pointers to child nodes, which helps in navigating the tree structure. This characteristic distinguishes B+ trees from other tree structures, ensuring efficient searching and maintaining balance.
Q12. Which of the following protocol pairs can be used to send and retrieve e-mails (in that order)?
Answer: SMTP, POP3
SMTP (Simple Mail Transfer Protocol) is used to send emails from a client to a server, while POP3 (Post Office Protocol version 3) is used to retrieve emails from the server to the client, making this pair suitable for the specified order of operations.
Answer: It will not print anything and will not terminate
For any positive n the recursion reaches convert(0), which takes the else branch and calls convert(0/2)=convert(0) endlessly, never returning, so no printf in the else branch ever executes. The function prints nothing and does not terminate (index 3), not the stored index 2.
Answer: Only N and P belong to the same subnet
With mask 255.255.255.252 (/30) the network is the address with its last two bits cleared. .2 gives network .0, while .5 and .6 both give network .4. So M is alone in subnet .0 and N and P share subnet .4: only N and P belong to the same subnet (index 2).
Answer: X sends an ARP request packet with broadcast MAC address in its local subnet
The correct option is effective because ARP (Address Resolution Protocol) uses a broadcast MAC address to reach all devices on the local subnet, allowing machine X to request the MAC address of machine Y, which will respond with its MAC address.
Answer: S3 and S4
S3, the set of all languages over the alphabet {0,1}, is uncountable because it includes all possible subsets of strings formed from that alphabet, which corresponds to the power set of the natural numbers. S4, the set of all non-regular languages, is also uncountable since it contains infinitely many languages that cannot be described by finite automata, further contributing to the uncountability.
Answer: X1 = L, X2 = T, X3 = L1, X4 = L
The correct option is right because it accurately reflects the relationships defined in the grammar: the type of the declaration (D) is derived from the type of the type (T) and the list (L), ensuring that the type of the entire declaration matches the type of its components.
Answer: Both I and II
Both statements are true because the uniqueness of the minimum spanning tree is guaranteed by the absence of equal edge weights in the first case, and by the presence of a unique minimum-weight edge crossing every cut in the second case. These conditions ensure that there is only one way to construct the minimum spanning tree.
Answer: Xₚ + X_q < Min {Yₖ | 1 ≤ k ≤ n, k ≠ p, k ≠ q}
This condition ensures that the total resources held by processes p and q are less than the minimum resources that any other process can request, effectively preventing those processes from obtaining the resources they need to proceed, thus blocking their execution.
Answer: I, II and III
In a max-heap the smallest element is at a leaf (I true) and the second largest must be a child of the root (II true). Building a max-heap from any array (including a BST's nodes) is Theta(n) (III true). Building a BST from a max-heap in Theta(n) would sort in linear time, which is impossible (IV false). So I, II and III, index 0, not the stored option.
Answer: 1
The query first retrieves tuples from the Cartesian product of P and R where P.Y matches R.Y and R.V equals V2, resulting in one matching tuple. Then, it excludes tuples from the Cartesian product of Q and R where Q.Y matches R.Y and Q.T is greater than 2, which yields no tuples to exclude. Thus, the final result contains only one tuple.