wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

MID2 assignment

Total questions: 25

Worksheet time: 13mins

Name
Class
Date
1.

Which of the following grammar is ambiguous

a)


S>aSaS->aSa S>bSbS->bSb S>aS->a S>bS->b

b)

S>aSbbSaSSεS->aSb|bSa|SS|ε

c)

XX+XXXXaX→X+X|X*X|X|a

d)

Both B and C

2.

CFG can be recognized by a

a)

PDA

b)

FA

c)

TM

d)

A and C

3.

A given grammar is called ambiguous if

a)

two or more productions have the same non-terminal on the left hand side

b)

a derivation tree has more than one associated sentence

c)

there is a sentence with more than one derivation tree corresponding to it

d)

brackets are not present in the grammar

4.

How to eliminate ambiguity

a)

precedence rules

b)

using semantics

c)

associativity rules

d)

All the above

5.

How to reduce CFG

a)

By eliminating epsilon transitions

b)

By eliminating unit productions

c)

By removing useless symbols

d)

All the above

6.

S -> AB/a A -> BC/b B -> aB/C C -> aC/B .

Which one is useless symbol

a)

A

b)

B

c)

C

d)

A,B and C

7.

S -> aSb/aAb/ab/a A -> ε. New productions after removing epsilon

a)

S -> aSb/aAb/ab/a

b)

S -> aSb/aAb/ab/a,S->aba

c)

S -> aSb/aAb/ab/a, S->abb

d)

S -> aSb/aAb/ab/a,S->aab

8.

Which of the following is a unit production

a)

A->b

b)

A->B

c)

B->b

d)

C->a

9.

Which of the following are normal forms?

a)

Chomsky normal form

b)

Grieback normal form

c)

Both A and B

d)

None

10.

Rules for CNF:

a)

Non-terminal->Non-terminal.Non-terminal

Non-terminal->terminal

b)

Non-terminal->terminal.Non-terminal

Non-terminal->terminal

c)

Non-terminal->Non-terminal.terminal

Non-terminal->terminal

d)

Non-terminal->terminal,terminal

Non-terminal->terminal

11.

Rules for GNF:

a)

Non-terminal-> any no. of non-terminals

Non-terminal->terminal

b)

Non-terminal-> one non terminal

Non-terminal->terminal

c)

Non-terminal-> one Non terminal.(any no. of terminals)

Non-terminal->terminal

d)

Non-terminal-> one terminal.(any no. of non-terminals)

Non-terminal->terminal

12.

Which of the productions are in CNF

a)

A->CD

b)

A->a

c)

A->BC

d)

All the above

13.

Which of the following productions are in GNF?

a)

A->a

b)

A->ab

c)

A->aB

d)

A and C

14.

Which of the following is false?

a)

The CFLs are not closed under klen closure

b)

The CFLs are closed under concatenation

c)

The CFLs are closed under klen closure

d)

The CFLs are not closed under complement

15.

How to represent PDA?

a)

using 5 tuple

b)

using 6 tuple

c)

using 7 tuple

d)

using 8 tuple

16.

What is PDA?

a)

NFA+stack

b)

DFA+stack

c)

NFA+tape

d)

None

17.

How to represent transition function in PDA

a)

using a pair

b)

using triplet

c)

both

d)

None

18.

The language accepted by PDA?

a)

Regular Language

b)

Context free language

c)

Both

d)

None

19.

The size of stack in PDA

a)

5

b)

infinte

c)

10

d)

None

20.

Г indicates in PDA

a)

set of states

b)

set of input symbols

c)

set of stack symbols

d)

None

21.

In how many ways acceptance is possible in PDA?

a)

1

b)

2

c)

3

d)

4

22.

Which of the following is correct.

a)

PDA can accept the strings using Acceptance by final state

b)

PDA can accept the strings using Acceptance by empty stack

c)

Both

d)

None

23.

Finite automata is superset of PDA

a)

True

b)

False

24.

PDA can accept all the languages accepted by FA.

a)

True

b)

False

25.

δ(q,a,X). What is X in this triplet>

a)

input

b)

Top of the stack

c)

state

d)

None