Grammar

Question 1

Which of the following conversions is not possible (algorithmically)?

A
Regular grammar to context free grammar
B
Non-deterministic FSA to deterministic FSA
C
Non-deterministic PDA to deterministic PDA
D
Non-deterministic Turing machine to deterministic Turing machine
Question 1 Explanation: 
NPDA to DPDA conversion is not possible. They have different powers.
Question 2

In the following grammar

         X ::= X ⊕ Y/Y
         Y ::= Z * Y/Z
         Z ::= id  

Which of the following is true?

A
‘⊕’ is left associative while ‘*’ is right associative
B
Both ‘⊕’ and ‘*’ is left associative
C
‘⊕’ is right associative while ‘*’ is left associative
D
None of the above
Question 2 Explanation: 

⊕ is left associative.
* is right associative.
Question 3

A grammar that is both left and right recursive for a non-terminal, is

A
Ambiguous
B
Unambiguous
C
Information is not sufficient to decide whether it is ambiguous or unambiguous
D
None of the above
Question 3 Explanation: 
If a grammar is both left and right recursion, then grammar may or may not be ambiguous.
Question 4

Given the following expression grammar:

    E → E * F | F + E | F
    F → F - F | id  

which of the following is true?

A
* has higher precedence than +
B
- has higher precedence than *
C
+ and – have same precedence
D
+ has higher precedence than *
Question 4 Explanation: 
The operator which is in low level that can have high preference.
Order of precedence is *, +, -.
Here * and + have equal preference, '-' can have higher precedence than + and *.
There are 4 questions to complete.

Access quiz wise question and answers by becoming as a solutions adda PRO SUBSCRIBER with Ad-Free content

Register Now

If you have registered and made your payment please contact solutionsadda.in@gmail.com to get access