GATE 2021 (Session 1)
65 questions
MCQ 34 · MSQ 13 · NAT 181-mark 30 · 2-mark 35
Questions 41–45 of 65
Consider the following context-free grammar where the set of terminals is .
The following is a partially-filled LL(1) parsing table.
Which one of the following choices represents the correct combination for the numbered cells in the parsing table ("blank" denotes that the corresponding cell is empty)?
The following is a partially-filled LL(1) parsing table.
Which one of the following choices represents the correct combination for the numbered cells in the parsing table ("blank" denotes that the corresponding cell is empty)?
Answer: (A)
Cells (1) and (2) are [S, c] and [S, f]. The rule goes under every symbol in FIRST of . can start with c or can be , and then f comes next, so . So cells (1) and (2) both hold .
Cells (3) and (4) are [T, c] and [T, ]. The rule goes under every symbol in FOLLOW(T). Find it from the rules that have T on the right side:
- : T is followed by R, so c is in FOLLOW(T). R can be , so FOLLOW(R) is also in FOLLOW(T). R is followed by f in , so .
- : T is at the end, so FOLLOW(S) is in FOLLOW(T).
- : S is at the end, so FOLLOW(T) is in FOLLOW(S). S is the start symbol, so is in FOLLOW(S). Together with the previous point, is in FOLLOW(T).
So . The f cell already has , and the c and cells get it too.
So (1) , (2) , (3) , (4) .
Answer: (A)
Cells (3) and (4) are [T, c] and [T, ]. The rule goes under every symbol in FOLLOW(T). Find it from the rules that have T on the right side:
- : T is followed by R, so c is in FOLLOW(T). R can be , so FOLLOW(R) is also in FOLLOW(T). R is followed by f in , so .
- : T is at the end, so FOLLOW(S) is in FOLLOW(T).
- : S is at the end, so FOLLOW(T) is in FOLLOW(S). S is the start symbol, so is in FOLLOW(S). Together with the previous point, is in FOLLOW(T).
So . The f cell already has , and the c and cells get it too.
So (1) , (2) , (3) , (4) .
Answer: (A)
Let and denote read and write operations respectively on a data item by a transaction . Consider the following two schedules.
Which one of the following options is correct?
Which one of the following options is correct?
Answer: (B)
S1: before gives T1 T2; before gives T2 T1. Cycle not conflict serializable.
S2: before gives T2 T1; before gives T2 T1. No cycle conflict serializable (T2, T1).
Answer: S1 is not conflict serializable, and S2 is conflict serializable
S2: before gives T2 T1; before gives T2 T1. No cycle conflict serializable (T2, T1).
Answer: S1 is not conflict serializable, and S2 is conflict serializable
Consider the relation with the following functional dependencies.
Consider the decomposition of the relation R into the constituent relations according to the following two decomposition schemes.
Which one of the following options is correct?
Consider the decomposition of the relation R into the constituent relations according to the following two decomposition schemes.
Which one of the following options is correct?
Answer: (A)
D1: Join the relations one at a time. At each step the common attributes must form a key of one side.
- Join (P, Q, S, T) with (P, T, X) on PT: we have , so PT X holds. True
- Join the result with (Q, Y) on Q: holds. True
- Join the result with (Y, Z, W) on Y: holds. True
So D1 is lossless.
D2: The relation (T, X) has no attribute in common with the other relations. Joining it gives a cross product so D2 is lossy.
Answer: D1 is lossless, but D2 is lossy
- Join (P, Q, S, T) with (P, T, X) on PT: we have , so PT X holds. True
- Join the result with (Q, Y) on Q: holds. True
- Join the result with (Y, Z, W) on Y: holds. True
So D1 is lossless.
D2: The relation (T, X) has no attribute in common with the other relations. Joining it gives a cross product so D2 is lossy.
Answer: D1 is lossless, but D2 is lossy
Let G be a group of order 6, and H be a subgroup of G such that 1 < |H| < 6. Which one of the following options is correct?
Answer: (B)
Let us check each statement.
- G can be the non-abelian group of order 6. This group is not cyclic.
- By Lagrange's theorem, |H| divides 6. Since |H| is strictly between 1 and 6, |H| = 2 or 3. Both are primes, and every group of prime order is cyclic.
Answer: G may not be cyclic, but H is always cyclic
- G can be the non-abelian group of order 6. This group is not cyclic.
- By Lagrange's theorem, |H| divides 6. Since |H| is strictly between 1 and 6, |H| = 2 or 3. Both are primes, and every group of prime order is cyclic.
Answer: G may not be cyclic, but H is always cyclic
Consider the two statements.
S1: There exist random variables and such that
S2: For all random variables and ,
Which one of the following choices is correct?
S1: There exist random variables and such that
S2: For all random variables and ,
Which one of the following choices is correct?
Answer: (D)
Let us check each statement.
- S1: the left side is . By the Cauchy-Schwarz inequality, always holds, so S1 is FALSE.
- S2: the right side is always , but covariance can be negative (for example Y = X). So S2 is FALSE.
Answer: Both S1 and S2 are false
- S1: the left side is . By the Cauchy-Schwarz inequality, always holds, so S1 is FALSE.
- S2: the right side is always , but covariance can be negative (for example Y = X). So S2 is FALSE.
Answer: Both S1 and S2 are false