Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Theory of computation_Quiz3

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What does CFG stand for in formal language theory?

a)

Context-Free Grammar

b)

Context-Free Generator

c)

Contextual Function Grammar

d)

Combinatorial Formal Grammar

2.

Which of the following is a characteristic of a context-free grammar?

a)

Production rules with a single non-terminal on the left-hand side.

b)

Production rules that require a specific order of symbols.

c)

Production rules that can only generate terminal symbols.

d)

Production rules with multiple non-terminals on the left-hand side.

3.

What is the primary purpose of a pushdown automaton?

a)

To simulate finite automata.

b)

To generate context-free grammars.

c)

To parse regular languages.

d)

To recognize context-free languages.

4.

In a CFG, what does a terminal symbol represent?

a)

Terminal symbols represent the actual content of the language in a CFG.

b)

Terminal symbols are used to define the structure of the grammar.

c)

Terminal symbols are placeholders for non-terminal symbols.

d)

Terminal symbols represent the rules of the grammar.

5.

Which of the following languages can be recognized by a pushdown automaton?

a)

Regular languages

b)

Finite automata languages

c)

Context-free languages

d)

Context-sensitive languages

6.

What is the main difference between a finite automaton and a pushdown automaton?

a)

A finite automaton can recognize context-free languages, while a pushdown automaton cannot.

b)

A pushdown automaton is a type of finite automaton with no memory capabilities.

c)

The main difference is that a pushdown automaton has a stack for memory, allowing it to recognize context-free languages, while a finite automaton does not.

d)

Both finite automata and pushdown automata use a tape for memory storage.

7.

In a context-free grammar, what does a production rule define?

a)

A production rule defines the termination of a string.

b)

A production rule defines the grammar's syntax rules.

c)

A production rule defines the order of terminal symbols.

d)

A production rule defines the substitution of a non-terminal symbol with a sequence of symbols.

8.

Which of the following is true about context-free languages?

a)

Context-free languages can be generated by context-free grammars.

b)

Context-free languages cannot be parsed by any algorithm.

c)

Context-free languages are a subset of context-sensitive languages.

d)

Context-free languages can only be generated by regular grammars.

9.

What is the role of the stack in a pushdown automaton?

a)

The stack helps in executing arithmetic operations.

b)

The stack allows the pushdown automaton to manage context and recognize context-free languages.

c)

The stack is used to store input symbols only.

d)

The stack is primarily for memory management.

10.

Which of the following grammars is not context-free?

a)

{a^n c^n | n ≥ 0}

b)

{a^n b^n | n ≥ 0}

c)

{a^n b^n c^n | n ≥ 0}

d)

{a^n b^n d^n | n ≥ 0}