First and Follow MCQ Quiz in বাংলা - Objective Question with Answer for First and Follow - বিনামূল্যে ডাউনলোড করুন [PDF]

Last updated on Mar 17, 2025

পাওয়া First and Follow उत्तरे आणि तपशीलवार उपायांसह एकाधिक निवड प्रश्न (MCQ क्विझ). এই বিনামূল্যে ডাউনলোড করুন First and Follow MCQ কুইজ পিডিএফ এবং আপনার আসন্ন পরীক্ষার জন্য প্রস্তুত করুন যেমন ব্যাঙ্কিং, এসএসসি, রেলওয়ে, ইউপিএসসি, রাজ্য পিএসসি।

Latest First and Follow MCQ Objective Questions

Top First and Follow MCQ Objective Questions

First and Follow Question 1:

Consider the following grammar.

E->TE’

E’->+TE’|ε

T->FT’

T’->*FT’|ε

F->(E)|id

How many terminals are in the follow set of T’?

  1. 2
  2. 3
  3. 4
  4. 5

Answer (Detailed Solution Below)

Option 2 : 3

First and Follow Question 1 Detailed Solution

Follow(T’)=Follow(T)={+,),$}

3 terminals in follow of T’

First and Follow Question 2:

consider the grammar

S->ABA

A->Bc|da|∈

B->eA

Which of the following is true related to given grammar?

  1. First(S) ∩ Follow(S)= ∅
  2. First(A) ∩ Follow(A)= ∅
  3. First(B) ∩ Follow(B)= ∅

  1. Only (i)
  2. (i) and (ii)
  3. (ii) and (iii)
  4. Only (iii)

Answer (Detailed Solution Below)

Option 1 : Only (i)

First and Follow Question 2 Detailed Solution

Answer: Option 1

Explanation:

 

First

Follow

S

  e,d,∈

$

A

  e,d,∈

  e,c,d,$

B

e

  e,c,d,$

 

Hence Option 1 is correct.

First and Follow Question 3:

Consider the following grammar :

S →  XY

X→  x | ɛ

Y →  y | ɛ

Which of the following is Follow(X) ?

  1. {$}
  2. {y, $}
  3. {y, $, ɛ}
  4. {$, ɛ}

Answer (Detailed Solution Below)

Option 2 : {y, $}

First and Follow Question 3 Detailed Solution

Follow(X) = Follow(S) ⋃ First(Y) without ɛ

= {$} ⋃ {y}

= {$, y}

First and Follow Question 4:

Consider the Grammar:

T → Qx

Q → RS

R → y|ε 

S → z|ε 

Here x, y, z are terminals and T, Q, R, S are non terminals. What will be the follow set of the non terminal R?

  1. {x, y}
  2. {y, z}
  3. {z, x}
  4. {ε}

Answer (Detailed Solution Below)

Option 3 : {z, x}

First and Follow Question 4 Detailed Solution

The correct answer is {z, x}

Explanation:

To find the Follow set of the non-terminal R in the given grammar, we will analyze the production rules.

Grammar:
1. T → Qx
2. Q → RS
3. R → y | ϵ
4. S → z | ϵ

Step 1: Identify the rules involving R

From the production Q  RS :

  • R appears before S , and we need to determine what can follow R .


Step 2: Determine Follow set of R

1. Check the Follow of Q :

  • From T  Qx , the Follow of Q includes x .
  • Thus, Follow(Q) = {x} .


2. From Q  RS :

  • The symbols that can follow R are the symbols in the Follow set of S .


Step 3: Determine Follow of S

1. Check the productions for S :

  • From S  z | ϵ :
  • If S produces ϵ , we also consider what follows S in Q .


2. Follow of S :

  • From Q  RS :
    • The symbols that can follow S include the Follow of Q , which is x (from T ).
  • Thus, Follow(S) = {x} .


Step 4: Combine results for R

Since S can produce ϵ :

  • The Follow set of R will include everything in Follow(S) plus anything that follows Q .
  • Therefore, the Follow set of R includes:
    • The Follow of S : x
    • The Follow of Q : Since R is at the end of Q , we include whatever follows Q .

Final Step: Conclusion

Combining all the above information, the Follow set of R is: Follow(R) = {z, x}

However, since R produces y (and indirectly through Q ), and because R is followed by S which can produce ϵ , we include z in Follow of R .

Thus, the correct answer is: 3) {z, x}

First and Follow Question 5:

Consider the following grammar G:

S → tABCD

A → qt |t

B → r | ε

C → q | ε

D → p


What is the FOLLOW(A)?

  1. {r, q, p, t }
  2. {r, q, p }
  3. {ε, r, q, p }
  4. {$, r, q, p }

Answer (Detailed Solution Below)

Option 2 : {r, q, p }

First and Follow Question 5 Detailed Solution

Concept:

Follow(X) is the set of terminals that can appear immediately to the right of non-terminal X in some sentential form. Rules for finding the follow (X) are given here as:

1) Follow (S) = {$}, where S is the start symbol.

2) If A → bBC is the production, where b, B and C are grammar symbols, then Follow (B) is first (C).

3) If A → bB is production then follow (B) is follow (A).

4) If A → bBC is production and first(c) contains ε, then follow (B) contains {first (C) - ε} U follow (A).

Explanation:

FIRST(B) = {r, ε}

FIRST(C) = {q, ε}

FIRST(D) = {p}

FIRST(A) = FIRST (BCD) = {r, q, p}

First and Follow Question 6:

Consider the following grammar G:

S → tABCD

A → qt |t

B → r | ε

C → q | ε

D → p


What is the FOLLOW(A)?

  1. {r, q, p, t }
  2. {r, q, p }
  3. {ε, r, q, p }
  4. {$, r, q, p }
  5. {p, q}

Answer (Detailed Solution Below)

Option 2 : {r, q, p }

First and Follow Question 6 Detailed Solution

Concept:

Follow(X) is the set of terminals that can appear immediately to the right of non-terminal X in some sentential form. Rules for finding the follow (X) are given here as:

1) Follow (S) = {$}, where S is the start symbol.

2) If A → bBC is the production, where b, B and C are grammar symbols, then Follow (B) is first (C).

3) If A → bB is production then follow (B) is follow (A).

4) If A → bBC is production and first(c) contains ε, then follow (B) contains {first (C) - ε} U follow (A).

Explanation:

FIRST(B) = {r, ε}

FIRST(C) = {q, ε}

FIRST(D) = {p}

FIRST(A) = FIRST (BCD) = {r, q, p}

First and Follow Question 7:

Which of the following is present in FIRST(X) ∩ FIRST(B) of the below given?

X → A

A → Bb | Cd

B → aB | Cd | ϵ

C → Cc | ϵ

  1. ​{a, c, d, ϵ}
  2. {a, c, d, $}
  3. {a, c, d}
  4. ​{a, c, ϵ}
  5. {c, d}

Answer (Detailed Solution Below)

Option 3 : {a, c, d}

First and Follow Question 7 Detailed Solution

Concepts:

First of X = First of A 

A → Bb | Cd

First of B = {a, c, d, ϵ}

First of C = {c, ϵ}

If ϵ is put in A → Bb | Cd

Therefore, First of A = {b, d, a, c}

First of X = First of A = {b, d, a, c}

 

FIRST

X

{a, b, c, d}

A

{a, b, c, d}

B

{a, c, d, ϵ}

C

{c, ϵ}


FIRST(X) ∩ FIRST(B) = {a, b, c, d} ∩ {a, c, d, ϵ} = {a, c, d}

First and Follow Question 8:

Consider the following grammar:

E → TE'

E' →+ TE' |ϵ 

T → FT' ; T' → ∗FT' | ϵ 

F → (E) | (id)

What will be the result of FIRST (T')?

  1. {+ , ϵ}
  2. {+ , id}
  3. {∗ , id}
  4. {∗ , ϵ}

Answer (Detailed Solution Below)

Option 4 : {∗ , ϵ}

First and Follow Question 8 Detailed Solution

The correct answer is option 4.

Concept:

First Function:
First(α) is a set of terminal symbols that begin in strings derived from α.
Rules For Calculating First Function:
Rule-01:

For a production rule X → ∈,
First(X) = { ∈ }
Rule-02:
For any terminal symbol ‘a’,
First(a) = { a }
Rule-03:
For a production rule X → Y1Y2Y3,
Calculating First(X)

  • If ∈ ∉ First(Y1), then First(X) = First(Y1)
  • If ∈ ∈ First(Y1), then First(X) = { First(Y1) – ∈ } ∪ First(Y2Y3)

Calculating First(Y2Y3)

  • If ∈ ∉ First(Y2), then First(Y2Y3) = First(Y2)
  • If ∈ ∈ First(Y2), then First(Y2Y3) = { First(Y2) – ∈ } ∪ First(Y3)

Similarly, we can make expansion for any production rule X → Y1Y2Y3…..Yn.

Example
A → abc / def / ghi
First(A) = { a , d , g }

Solution:

Consider the following grammar:

E → TE'

E' →+ TE' |ϵ 

T → FT' 

T' → ∗FT' | ϵ 

F → (E) | (id)

Non-terminal First set
E (
E' +, ϵ
(
T'  *, ϵ 
F (

Hence the correct answer is {∗ , ϵ}.

First and Follow Question 9:

Consider the grammar given below

→ TE’

E' → +TE' | ϵ

→ FT'

T' → *FT' | ϵ

→ (E) | id

Which of the following terminal symbol will be present in FOLLOW(F)?

  1. +
  2. *
  3. )
  4. $

Answer (Detailed Solution Below)

Option :

First and Follow Question 9 Detailed Solution

→ FT'

FOLLOW(F) = FIRST(T’) 

FIRST(T’) = {*, ϵ}

put ϵ in T → FT'

→ F

Therefore FOLLOW(F) = FOLLOW(T) 

FOLLOW(T)  = FIRST(E') = { +,  ϵ }    / E → TE’

put ϵ in E → TE’

→ T

FOLLOW(T)  = FOLLOW(E) 

Therefore FOLLOW(E)  = { ), $ }

NOTE:
E is start symbol

ϵ is not a follow symbol

First and Follow Question 10:

Consider the grammar

S → AbBaCc | ε

A → aAb | ba

B → bBC | cb

C → cCa |ac

Find the First ( ) of S

  1. {a, b, c, ε}
  2. {a, b, ε}
  3. { ε }
  4. {a, ε}

Answer (Detailed Solution Below)

Option 2 : {a, b, ε}

First and Follow Question 10 Detailed Solution

First( ) of S = { First ( ) of A , First( ) of  ε }

First( ) of A = { First( ) of aAb, First( ) of ba } = { a , b }

First( ) of ε = ε itself is First( ) of ε

Hence First of S = {a, b, ε}

Option 2 is the correct answer

Get Free Access Now
Hot Links: teen patti gold apk download teen patti gold new version teen patti master gold apk