wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Pushdown Automata Quiz

Total questions: 85

Worksheet time: 45mins

Name
Class
Date
1.

What is a pushdown automata?

a)

A pushdown automata is a type of finite automaton that can use a queue to store and retrieve information during its operation.

b)

A pushdown automata is a type of finite automaton that can only recognize regular languages.

c)

A pushdown automata is a type of finite automaton that can only recognize context-free languages.

d)

A pushdown automata is a type of finite automaton that can use a stack to store and retrieve information during its operation.

2.

What is the main difference between pushdown automata and finite automata?

a)

Pushdown automata have a tape, while finite automata do not.

b)

Pushdown automata have a queue, while finite automata do not.

c)

Pushdown automata have a memory, while finite automata do not.

d)

Pushdown automata have a stack, while finite automata do not.

3.

What is a deterministic pushdown automata?

a)

A deterministic pushdown automata is an automaton that extends the capabilities of a non-deterministic finite automaton (NFA) by adding a stack.

b)

A deterministic pushdown automata is an automaton that extends the capabilities of a Turing machine by adding a stack.

c)

A deterministic pushdown automata is an automaton that extends the capabilities of a deterministic finite automaton (DFA) by adding a stack.

d)

A deterministic pushdown automata is an automaton that extends the capabilities of a pushdown automata by adding a queue.

4.

What is a non-deterministic pushdown automata?

a)

A non-deterministic pushdown automata is a theoretical model of computation that can only accept regular languages.

b)

A non-deterministic pushdown automata is a theoretical model of computation that does not use a stack.

c)

A non-deterministic pushdown automata is a theoretical model of computation that extends the capabilities of a pushdown automaton by allowing multiple possible transitions for a given input symbol and stack symbol combination.

d)

A non-deterministic pushdown automata is a theoretical model of computation that only allows one possible transition for a given input symbol and stack symbol combination.

5.

What are the components of a pushdown automata?

a)

Input alphabet, Stack alphabet, Set of states, Transition function, Initial state, Rejecting states

b)

Input alphabet, Stack alphabet, Set of states, Transition function, Final state, Accepting states

c)

Input alphabet, Stack alphabet, Set of states, Transition function, Start state, Accepting states

d)

Input alphabet, Stack alphabet, Set of states, Transition function, Initial state, Accepting states

6.

What is the purpose of a stack in a pushdown automata?

a)

To store the input symbols.

b)

To determine the final state of the automata.

c)

To perform arithmetic calculations.

d)

To keep track of the history of the computation.

7.

Can a pushdown automata accept an infinite language?

a)

Only if it has a finite number of states

b)

Yes

c)

Sometimes

d)

No

8.

What is the language accepted by a pushdown automata called?

a)

regular language

b)

Turing language

c)

finite language

d)

context-free language

9.

What is the difference between a pushdown automata and a Turing machine?

a)

A pushdown automata can only recognize context-free languages, while a Turing machine can recognize any recursively enumerable language.

b)

A pushdown automata has a finite number of states, while a Turing machine has an infinite number of states.

c)

A pushdown automata can only perform a limited number of operations, while a Turing machine can perform an infinite number of operations.

d)

A pushdown automata has a limited memory capacity compared to a Turing machine.

10.

What are the limitations of pushdown automata?

a)

Inability to recognize certain context-free languages.

b)

Inability to recognize deterministic context-free languages.

c)

Inability to recognize non-context-free languages.

d)

Inability to recognize regular languages.

11.

What is the role of transitions in a pushdown automata?

4 lines
12.

What is the significance of the initial state in a pushdown automata?

a)

The initial state determines the number of transitions in the pushdown automata.

b)

The initial state has no significance in a pushdown automata.

c)

The initial state determines the starting point and initial configuration of the pushdown automata.

d)

The initial state determines the final configuration of the pushdown automata.

13.

What is the significance of the final state in a pushdown automata?

a)

The final state in a pushdown automata represents the initial state.

b)

The final state in a pushdown automata has no significance.

c)

The final state in a pushdown automata represents the number of transitions made.

d)

The final state in a pushdown automata represents the acceptance or rejection of the input string.

14.

What is the pumping lemma for context-free languages?

a)

The pumping lemma for context-free languages is a property that states that for any context-free language L, there exists a constant p (the pumping length) such that any string s in L with length greater than or equal to p can be divided into three parts, s = uvw, satisfying the conditions mentioned above.

b)

The pumping lemma for context-free languages is a property that states that for any context-free language L, there exists a constant p (the pumping length) such that any string s in L with length greater than or equal to p can be divided into five parts, s = uvwxy, satisfying the conditions mentioned above.

c)

The pumping lemma for context-free languages is a property that states that for any context-free language L, there exists a constant p (the pumping length) such that any string s in L with length greater than or equal to p can be divided into four parts, s = uvwx, satisfying the conditions mentioned above.

d)

The pumping lemma for context-free languages is a property that states that for any context-free language L, there exists a constant p (the pumping length) such that any string s in L with length greater than or equal to p can be divided into six parts, s = uvwxyz, satisfying the conditions mentioned above.

15.

What is the difference between a deterministic pushdown automata and a non-deterministic pushdown automata?

a)

The main difference between a deterministic pushdown automata and a non-deterministic pushdown automata is that the DPDA can only accept regular languages, while the NPDA can accept context-free languages.

b)

The main difference between a deterministic pushdown automata and a non-deterministic pushdown automata is that the DPDA has at most one transition defined for each input symbol, while the NPDA can have multiple transitions defined for each input symbol.

c)

The main difference between a deterministic pushdown automata and a non-deterministic pushdown automata is that the DPDA can have multiple transitions defined for each input symbol, while the NPDA has at most one transition defined for each input symbol.

d)

The main difference between a deterministic pushdown automata and a non-deterministic pushdown automata is that the DPDA can only have a single stack, while the NPDA can have multiple stacks.

16.

Relate the following statement:

Statement: All sufficiently long words in a regular language can have a middle section of words repeated a number of times to produce a new word which also lies within the same language.

a)

Turing Machine

b)

Pumping Lemma

c)

Arden’s theorem

d)

None of the mentioned

17.

While applying Pumping lemma over a language, we consider a string w that belong to L and fragment it into _________ parts.

a)

2

b)

5

c)

3

d)

6

18.

If we select a string w such that w∈L, and w=xyz. Which of the following portions cannot be an empty string?

a)

x

b)

y

c)

z

d)

all of the mentioned

19.

There exists a language L. We define a string w such that w∈L and w=xyz and |w| >=n for some constant integer n.What can be the maximum length of the substring xy i.e. |xy|<=?

a)

n

b)

|y|

c)

|x|

d)

none of the mentioned

20.

Answer in accordance to the third and last statement in pumping lemma:

For all _______ xyiz ∈L

a)

i>0

b)

i<0

c)

i<=0

d)

i>=0

21.

If L1′ and L2′ are regular languages, then L1.L2 will be

a)

regular

b)

non regular

c)

may be regular

d)

none of the mentioned

22.

If L1 and L2′ are regular languages, L1 ∩ (L2′ U L1′)’ will be

a)

regular

b)

non regular

c)

may be regular

d)

none of the mentioned

23.

If A and B are regular languages, !(A’ U B’) is:

a)

regular

b)

non regular

c)

may be regular

d)

none of the mentioned

24.

Suppose a language L1 has 2 states and L2 has 2 states. After using the cross product construction method, we have a machine M that accepts L1 ∩ L2. The total number of states in M:

a)

6

b)

4

c)

2

d)

8

25.

Which among the following is the closure property of a regular language?

a)

Emptiness

b)

Universality

c)

Membership

d)

None of the mentioned

26.

Inorder to simplify a context free grammar, we can skip the following operation:

a)

Removal of null production

b)

Removal of useless symbols

c)

Removal of unit productions

d)

None of the mentioned

27.

In context to the process of removing useless symbols, which of the following is correct?

a)

We remove the Nullable variables

b)

We eliminate the unit productions

c)

We eliminate products which yield no terminals

d)

All of the mentioned

28.

Given grammar G:

S->aS|A|C

A->a

B->aa

C->aCb

Find the set of variables that can produce strings only with the set of terminals.

a)

{C}

b)

{A,B}

c)

{A,B,S}

d)

None of the mentioned

29.

Suppose A->xBz and B->y, then the simplified grammar would be:

a)

a) A->xyz

b)

b) A->xBz|xyz

c)

c) A->xBz|B|y

d)

d) none of the mentioned

30.

The variable which produces an epsilon is called:

a)

a) empty variable

b)

b) nullable

c)

c) terminal

d)

d) all of the mentioned

31.

Which among the following is the format of unit production?

a)

a) A->B

b)

b) A->b

c)

c) B->Aa

d)

d) None of the mentioned

32.

Given grammar:

S->aA

A->a

A->B

B-> A

B->bb

Which of the following is the production of B after simplification by removal of unit productions?

a)

a) A

b)

b) bb

c)

c) aA

d)

d) A| bb

33.

Which of the production rule can be accepted by Chomsky grammar?

a)

a) A->BC

b)

b) A->a

c)

c) S->e

d)

d) All of the mentioned

34.

Let G be a grammar: S->AB|e, A->a, B->b

Is the given grammar in CNF?

a)

a) Yes

b)

b) No

35.

The format: A->aB refers to which of the following?

a)

a) Chomsky Normal Form

b)

b) Greibach Normal Form

c)

c) Backus Naur Form

d)

d) None of the mentioned

36.

The pumping lemma is often used to prove that a language is:

a)

a) Context free

b)

b) Not context free

c)

c) Regular

d)

d) None of the mentioned

37.

Which of the expressions correctly is an requirement of the pumping lemma for the context free languages?

a)

a) uvnwxny

b)

b) uvnwnxny

c)

c) uv2nwx2ny

d)

d) All of the mentioned

38.

The context free languages are closed under:

a)

a) Intersection

b)

b) Complement

c)

c) Kleene

d)

d) None of the mentioned

39.

Which of the following does not obey pumping lemma for context free languages ?

a)

a) Finite languages

b)

b) Context free languages

c)

c) Unrestricted languages

d)

d) None of the mentioned

40.

Which of the following grammars are in Chomsky Normal Form:

a)

a) S->AB|BC|CD, A->0, B->1, C->2, D->3

b)

b) S->AB, S->BCA|0|1|2|3

c)

c) S->ABa, A->aab, B->Ac

d)

d) All of the mentioned

41.

Recursively enumerable languages are referred as

a)

Type 0

b)

Type 1

c)

Type 2

d)

Type 3

42.

Correct hierarchical relationship among context- free, right-linear, and context-sensitive language is

a)

context-free ⊂ right-linear ⊂ context-sensitive

b)

context-free ⊂ context-sensitive ⊂ right-linear

c)

context-sensitive ⊂ right-inear ⊂context-free

d)

right-linear ⊂context-free ⊂context-sensitive

43.

Following context free grammar

S —> aB | bA

A —>b | aS | bAA

B —> b | bS | aBB

generates strings of terminals that have

a)

equal number of a's and b's

b)

odd number of a's and odd number b's

c)

even number of a's and even number of b's

d)

odd number of a's and even number of a's

44.

Which of the following statement is correct?

a)

All languages can not be generated by CFG

b)

Any regular language has an equivalent CFG

c)

Some non regular languages can't be generated by CFG

d)

both (b) and (c)

45.

The language accepted by a Push down Automata:

a)

Type 0

b)

Type 1

c)

Type 2

d)

Type 3

46.

1. A CFG is ambiguous if

a)

It has more than one rightmost derivations

b)

It has more than one leftmost derivations

c)

No parse tree can be generated for the CFG

d)

None of the mentioned

47.

A language that admits only ambiguous grammar:

a)

Inherent Ambiguous language

b)

Inherent Unambiguous language

c)

Context free language

d)

Context Sensitive language

48.

9. Choose the correct option:

Statement: Unambiguity is the ideal structure of a language.

a)

true

b)

partially true

c)

false

d)

cant be said

49.

In which order are the children of any node ordered?

a)

From the left

b)

From the right

c)

Arbitrarily

d)

None of the mentioned

50.

Which among the following is the root of the parse tree?

a)

Production P

b)

Terminal T

c)

Variable V

d)

Starting Variable S

51.

An NFA’s transition function returns

a)

A Boolean value

b)

A state

c)

A set of states

d)

An edge

52.

Every grammar in Chomsky Normal Form is:

a)

regular

b)

context sensitive

c)

context free

d)

all of the mentioned

53.

Every grammar in Chomsky Normal Form is:

a)

regular

b)

context sensitive

c)

context free

d)

all of the mentioned

54.

If a and b be the regular expressions, then (a* ∪ b*) *

is equivalent to




a)

(b* ∪ a*)*

b)

(a ∪ b) *

c)

(b ∪ a)*

d)

All of above

55.

The logic of pumping lemma is a good example of


a)

pigeon-hole principle

b)

divide-and-conquer technique

c)

iteration

d)

recursion

56.

What is syntax in language theory?

a)

The study of phonetics

b)

Set of rules governing sentence structure

c)

The meaning of words

d)

A collection of words

57.

What are the main components of a syntax tree?

a)

trunk and bark

b)

leaves and branches

c)

nodes and edges

d)

roots and stems

58.

What is the difference between syntax and semantics?

a)

Syntax is only applicable to programming languages, while semantics is applicable to natural languages as well.

b)

Syntax and semantics are the same thing.

c)

Syntax is about the meaning and interpretation, while semantics is about the structure and rules.

d)

Syntax is about the structure and rules, while semantics is about the meaning and interpretation.

59.

What is a context-free grammar?

a)

A context-free grammar is a formal grammar that describes a formal language in terms of production rules that define how strings of symbols can be formed.

b)

A context-free grammar is a data structure used in computer science.

c)

A context-free grammar is a mathematical equation.

d)

A context-free grammar is a type of programming language.

60.

What are the four types of phrase structure rules?

a)

Phrase Structure Rule for Noun (N), Phrase Structure Rule for Adjective (Adj), Phrase Structure Rule for Adverb (Adv), Phrase Structure Rule for Conjunction (Conj)

b)

Phrase Structure Rule for Verb (V), Phrase Structure Rule for Adjective (Adj), Phrase Structure Rule for Adverb (Adv), Phrase Structure Rule for Conjunction (Conj)

c)

Phrase Structure Rule for Sentence (S), Phrase Structure Rule for Noun Phrase (NP), Phrase Structure Rule for Verb Phrase (VP), Phrase Structure Rule for Prepositional Phrase (PP)

d)

Phrase Structure Rule for Noun (N), Phrase Structure Rule for Verb (V), Phrase Structure Rule for Adverb (Adv), Phrase Structure Rule for Conjunction (Conj)

61.

What is the Chomsky hierarchy?

a)

The Chomsky hierarchy is a classification of mathematical theorems based on their complexity.

b)

The Chomsky hierarchy is a classification of computer algorithms based on their efficiency.

c)

The Chomsky hierarchy is a classification of formal grammars and languages into four levels based on their generative power.

d)

The Chomsky hierarchy is a classification of programming languages based on their popularity.

62.

What is the difference between a terminal and a non-terminal symbol?

a)

A terminal symbol represents a non-terminal symbol, while a non-terminal symbol represents a terminal symbol.

b)

A terminal symbol is used to terminate a program, while a non-terminal symbol is used to start a program.

c)

A terminal symbol is used in the production rules, while a non-terminal symbol is used in the lexical rules.

d)

A terminal symbol cannot be further expanded, while a non-terminal symbol can be expanded into other symbols.

63.

What is the purpose of a parse tree?

a)

To store the output of a program

b)

To optimize the execution of a program

c)

The purpose of a parse tree is to represent the syntactic structure of a sentence in a programming language.

d)

To handle runtime errors in a program

64.

What is the difference between leftmost and rightmost derivations?

a)

The difference between leftmost and rightmost derivations is the number of non-terminals replaced.

b)

The difference between leftmost and rightmost derivations is the order in which terminals are replaced.

c)

The difference between leftmost and rightmost derivations is the number of terminals replaced.

d)

The difference between leftmost and rightmost derivations is the order in which non-terminals are replaced.

65.

What is ambiguity in syntax?

a)

Confusing sentence structure

b)

Lack of punctuation

c)

Inconsistent word usage

d)

Multiple possible meanings

66.

What is the difference between a regular language and a context-free language?

a)

A regular language can have nested structures, while a context-free language cannot have nested structures.

b)

A regular language can be recognized by a Turing machine, while a context-free language can be recognized by a pushdown automaton.

c)

A regular language can have an infinite number of strings, while a context-free language can have a finite number of strings.

d)

A regular language can be recognized by a finite automaton, while a context-free language can be recognized by a pushdown automaton.

67.

What is the pumping lemma for context-free languages?

a)

The pumping lemma for context-free languages states that any context-free language L can be divided into six parts: uvwxyz, such that for any i ≥ 0, the string uv^iwx^iyz is also in L, where v and x are non-empty strings.

b)

The pumping lemma for context-free languages states that any context-free language L can be divided into four parts: uvwxy, such that for any i ≥ 0, the string uv^iwx^iyz is also in L, where v and x are non-empty strings.

c)

The pumping lemma for context-free languages states that any context-free language L can be divided into three parts: uvw, such that for any i ≥ 0, the string uv^iwx^iyz is also in L, where v and x are non-empty strings.

d)

The pumping lemma for context-free languages is a property that states that any context-free language L can be divided into five parts: uvxyz, such that for any i ≥ 0, the string u(v^i)x(y^i)z is also in L, where v and y are non-empty strings.

68.

What is the role of a pushdown automaton in syntax analysis?

a)

A pushdown automaton is used to implement a parser in syntax analysis.

b)

A pushdown automaton is used to optimize code generation in syntax analysis.

c)

A pushdown automaton is used to perform semantic analysis in syntax analysis.

d)

A pushdown automaton is used to generate lexical tokens in syntax analysis.

69.

What is the difference between LL and LR parsing?

a)

LL parsing is bottom-up, LR parsing is top-down.

b)

LL parsing is more efficient than LR parsing.

c)

LL parsing is used for parsing regular languages, LR parsing is used for parsing context-free languages.

d)

LL parsing is top-down, LR parsing is bottom-up.

70.

What is the purpose of a syntax-directed translation?

a)

To convert source code into target code or representation.

b)

To optimize the performance of the source code.

c)

To generate documentation for the source code.

d)

To debug and fix errors in the source code.

71.

Design the regular expression for the language containing all the strings containing any no.of a’s and any no.of b’s.

a)

ab

b)

a*b*

c)

(a+b)*

d)

a*+b*

72.

. Write regular expression for the language accepting the strings which are starting with 1 and ending with 0 over the set Σ={0,1}.

a)

0(0+1)*1

b)

0(0+1)*0

c)

1(0+1)*1

d)

1(0+1)*0

73.

Write a Regular expression to denote a language L over Σ* where Σ={a,b} such that the 3rd character from right end of the string is always a

a)

(a+b)*a(a+b)(a+b)*

b)

(a+b)*a(a+b)(a+b)

c)

(a+b)*a(a+b)*(a+b)*

d)

(a+b)(a+b)a(a+b)

74.

Ø+R=

a)

Ø

b)

R

c)

Ɛ

d)

None

75.

ε+RR*=

a)

ε

b)

R

c)

R*

d)

None

76.

According to Arden's Theorem if R=Q+RP then R=?

a)

QP*

b)

QP

c)

RP

d)

RP*

77.

(0*1*)*=(0+1)*

a)

True

b)

False

78.

(r+s)*= r*+s*

a)

True

b)

False

79.

Whats the expression for q2

a)

q2=1q1+1q2

b)

q2=0q1+Ɛ

c)

q2=0q2+(0+1)q3

d)

None

80.

According to unix syntax whats the meaning of [1,2,3,4]

a)

1*2*3*4

b)

1+2+3+4

c)

1234

d)

None

81.

How to represent Regular grammar

a)

(V,T,S,P)

b)

(V,T,P,S)

c)

(T,V,P,S)

d)

(V,S,T,P)

82.

Productions for q0

a)

q0->aq0, q0->bq1

b)

q0->aq0

c)

q0->aq0, q0->bq1, q0->b

d)

none

83.

The following grammar is

S->Bb

B->Cb

B->Ba

C->a

B->b

a)

Right Linear grammar

b)

Left Linear Grammar

c)

None

84.

According to pumping lemma what is n?

a)

n>=|z|

b)

n<=|z|

c)

any random value

d)

None

85.

Which of the following is not an application of pumping lemma

a)

Power stations

b)

Digital circuits

c)

To prove language as non regular

d)

Chess games