Which of the following grammars is (are) ambiguous?

(A) s → ss | asb | bsa | λ

(B) s → asbs | bsas | λ

(C) s → aAB

A → bBb

B →  A | λ where λ denotes empty string

Choose the correct answer from the options given below:

This question was previously asked in
UGC NET Computer Science (Paper 2) 2020 Official Paper
View all UGC NET Papers >
  1. (A) and (C) only
  2. (B)only 
  3. (B) and (C) only
  4. (A) (B) and (C)

Answer (Detailed Solution Below)

Option 4 : (A) (B) and (C)
Free
UGC NET Paper 1: Held on 21st August 2024 Shift 1
10.8 K Users
50 Questions 100 Marks 60 Mins

Detailed Solution

Download Solution PDF

The correct answer is option 4.

Key Points

A is ambiguous because λ can be generated using leftmost derivation having two different parse trees with an empty string.

F1 Shraddha Raju 03.04.2021 D26

B is ambiguous grammar with string abab.

F1 Shraddha Raju 03.04.2021 D27

C is an ambiguous grammar with string abbbb.

F1 Shraddha Raju 03.04.2021 D28

∴ Hence the correct answer is (A) (B) and (C).

Latest UGC NET Updates

Last updated on Jun 11, 2025

-> The UGC NET Exam Schedule 2025 for June has been released on its official website.

-> Check UPSC Prelims Result 2025, UPSC IFS Result 2025, UPSC Prelims Cutoff 2025, UPSC Prelims Result 2025 Name Wise & Rollno. Wise

-> The UGC NET Application Correction Window 2025 is available from 14th May to 15th May 2025.

-> The UGC NET 2025 online application form submission closed on 12th May 2025.

-> The June 2025 Exam will be conducted from 21st June to 30th June 2025

-> The UGC-NET exam takes place for 85 subjects, to determine the eligibility for 'Junior Research Fellowship’ and ‘Assistant Professor’ posts, as well as for PhD. admissions.

-> The exam is conducted bi-annually - in June and December cycles.

-> The exam comprises two papers - Paper I and Paper II. Paper I consists of 50 questions and Paper II consists of 100 questions. 

-> The candidates who are preparing for the exam can check the UGC NET Previous Year Papers and UGC NET Test Series to boost their preparations.

More Context Free Languages and Pushdown Automata Questions

Get Free Access Now
Hot Links: teen patti joy vip teen patti gold download apk teen patti circle teen patti master 2023 teen patti master list