Context Free Language and Push Down Automata Flashcards

1
Q

P is Regular and Q is Context Free.
P ^ Q is Regular?

A

No. P ^ Q is not regular

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

P is Regular and Q is Context Free.
P - Q is Regular?

A

No. P - Q is not regular

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

P is Regular and Q is Context Free.
P Compliment is Regular?

A

Yes. Complement of any regular language is regular.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

P is Regular and Q is Context Free.
Q Compliment is Regular?

A

NO. Context Free Languages are not closed under Compliment.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

P is Regular and Q is Context Free.
Q - P is Context Free?

A

Yes. Context Free Languages are closed under Intersection with Regular language.
Here Q - P can be written as ‘Q’ intersection ‘P compliment’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

CFL and REG both are closed under UNION
(T or F)?

A

TRUE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

CFL and REG both are closed under INTERSECTION
(T or F)?

A

FALSE. Only REG are closed under Intersection and not CFL.
i.e. REG intersection REG = REG
but CFL intersection CFL is NOT ALWAYS equal to CFL.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

CFL and REG both are closed under COMPLEMENT
(T or F)?

A

FALSE. Only REG are closed under COMPLEMENT and not CFL.
i.e. Complement of REG = REG
but Complement of CFL is NOT ALWAYS equal to CFL.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

CFL and REG both are closed under CONCATENATION
(T or F)?

A

TRUE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

L = {pow(a, p) | p is a prime number}
is this CFL?

A

NO. This is CSL(Context sensitive language). There exists a LBA that can be implemented to solve such question.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is Type - 0 Grammar?

A

Recursively Enumerable.
Automata = Turing Machine.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is Type - 1 Grammar?

A

Context Sensitive
Automata = Linear-bounded non-deterministic machine.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is Type - 2 Grammar?

A

Context Free
Automata = Non-deterministic push down automata

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is Type - 3 Grammar?

A

Regular
Automata = Finite state automata

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the set order of Grammar?
i.e. A < B < C < D

A

REG < CFL < CSL < RE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Recursively Enumerable (RE) is closed in all operations:
UNION
INTERSECTION
COMPLEMENT
CONCATENATION ( . )
KLEENE CLOSURE
POSITIVE KLEENE CLOSURE (+)

A

FALSE
RE is closed under all the given operations EXCEPT COMPLEMENT.
RE is not closed under Complement.

17
Q

Recursive (REC) is closed in all operations:
UNION
INTERSECTION
COMPLEMENT
CONCATENATION ( . )
KLEENE CLOSURE
POSITIVE KLEENE CLOSURE (+)

A

TRUE

18
Q

DCFL Union Regular is DCFL.
T or F

A

TRUE

19
Q

DCFL is closed under which operations?

A

COMPLEMENT
INVERSE HOMOMORPHISM
INTERSECTION with REG

REG = Regular Language, DCFL = Deterministic Context Free Language

20
Q

REG is closed under which operations?

A

UNION
INTERSECTION
COMPLEMENT
CONCATENATION ( . )
KLEENE CLOSURE
POSITIVE KLEENE CLOSURE (+)

REG = Regular Language

21
Q

RE is not closed under which operations?

A

COMPLEMENT.

RE = Recursively Enumerable Language

22
Q

CFL is not closed under which operations?

A

INTERSECTION,
COMPLEMENT.

CFL = Context Free Language

23
Q

REC is closed under which operation?

A

UNION
INTERSECTION
COMPLEMENT
CONCATENATION ( . )
KLEENE CLOSURE
POSITIVE KLEENE CLOSURE (+)

REC = Recursive Language

24
Q

CSL is closed under which operation?

A

UNION
INTERSECTION
COMPLEMENT
CONCATENATION ( . )
KLEENE CLOSURE
POSITIVE KLEENE CLOSURE (+)

CLS = Context Sensitive Language

25
Q

L = {ww | w ∈ {a,b}⋆}
L is CFL.
T or F ?

A

FALSE
L is Not CFL. But it’s Complement is CFL.

26
Q

The language accepted by Pushdown Automation in which the stack is limited to 10 items is best described as…

A

Regular.
With finite stack… we can make Finite Automata of a language. We need infinite stack to go from Regular -> CFL

27
Q

If a language satisfies the pumping Lemma for CFL then Language is CFL.
T or F ?

A

False.
By pumping lemma we can never say that a language is regular or cfg .it can only be used to prove that a certain langusge is not reg or not cfg.

28
Q

A context-free grammar is ambiguous if…

A

1) it produces more than one parse tree for some sentence.
or
2) It produces more that one leftmost derivation for some sentence
or
3) It produces more than one rightmost derivation for some sentence.

29
Q

A context free language is called ambiguous if…

A

there is no unambiguous grammar to define that language and it is also called inherently ambiguous Context Free Languages.

30
Q

Deterministic CFL are always unambiguous.
T or F ?

A

TRUE

31
Q

There exist an algorithm to convert ambiguous CFG to unambiguous CFG.
T or F?

A

FALSE.
There is no algorithm to convert ambiguous CFG to unambiguous CFG.

32
Q

If a context free grammar G is ambiguous, language generated by grammar L(G) will always be ambiguous.
T or F?

A

FALSE
If a context free grammar G is ambiguous, language generated by grammar L(G) may or may not be ambiguous

33
Q

There exist context-free languages such that all the context-free grammars generating them are ambiguous.
T or F?

A

TRUE
is correct because for ambiguous CFL’s, all CFG corresponding to it are ambiguous.

34
Q

An unambiguous context free grammar always has a unique parse tree for each string of the language generated by it.
T or F?

A

TRUE
is also correct as unambiguous CFG has a unique parse tree for each string of the language generated by it.

35
Q

A finite set of string from one alphabet is always a regular language.
T or F?

A

TRUE
is also true as finite set of string is always regular.

36
Q

Both deterministic and non-deterministic pushdown automata always accept the same set of languages.
T or F

A

FALSE
is false as some languages are accepted by Non- deterministic PDA but not by deterministic PDA.

37
Q

Every nondeterministic PDA can be converted to an equivalent deterministic PDA.
T or F ?

A