Exams › GATE › Engineering Mathematics
Statement for Linked Answer Questions 52 and 53:
For the grammar below, a partial LL(1) parsing table is also presented along with the grammar. Entries that need to be filled are indicated as E1, E2, and E3. ε is the empty string, indicates end of input, and | separates alternate right hand sides of productions.
S → a A b B | b A a B | ε
A → S
B → S
The FIRST and FOLLOW sets for the non-terminals A and B are
- (A) FIRST(A) = {a, b, ε} = FIRST(B)
FOLLOW(A) = {a, b}
FOLLOW(B) = {a, b, }
- (B) FIRST(A) = {a, b, }
FOLLOW(A) = {a, b}
FOLLOW(B) =
- (C) FIRST(A) = {a, b, ε} = FIRST(B)
FOLLOW(A) = {a, b}
FOLLOW(B) = ∅
- (D) FIRST(A) = {a, b} = FIRST(B)
FOLLOW(A) = {a, b}
FOLLOW(B) = {a, b}
Correct answer: (A) FIRST(A) = {a, b, ε} = FIRST(B)
FOLLOW(A) = {a, b}
FOLLOW(B) = {a, b, }
Solution
The correct option is right because both A and B derive from S, which can produce ε, a and b, leading to the same FIRST set of {a, b, ε}. Additionally, the FOLLOW sets correctly reflect the symbols that can appear immediately after A and B in the derivations, including the end of input symbol for B.
Related GATE Engineering Mathematics questions
- What are the eigenvalues of the matrix [2, 1, 1; 1, 4, 1; 1, 1, 2]?
- A circle with center at (x,y) = (0.5, 0) and radius = 0.5 intersects with another circle with center at (x,y) = (1,1) and radius = 1 at two points. One of the points of intersection (x,y) is:
- Suppose λ is an eigenvalue of matrix A and x is the corresponding eigenvector. Let x also be an eigenvector of the matrix B = A − 2I, where I is the identity matrix. Then, the eigenvalue of B corresponding to the eigenvector x is equal to
- Let A = [[1, 1], [1, 3], [−2, −3]] and b = [b1, b2, b3]. For Ax = b to be solvable, which one of the following options is the correct condition on b1, b2, and b3:
- If the quadrantal bearing of a line is N 30° W, then the whole circle bearing of the line is
- The matrix [2, -4; 4, -2] has
⚔️ Practice GATE Engineering Mathematics free + battle 1v1 →