Home
Subjects
Create
Search
Log in
Sign up
Upgrade to remove ads
Only $2.99/month
Home
Science
Computer Science
Computational Theory
CSE 355 Test 2
STUDY
Flashcards
Learn
Write
Spell
Test
PLAY
Match
Gravity
Terms in this set (35)
An HPDA is a PDA in which every transition that reads a symbol in a computation must be followed by at least one transition that does not read a symbol. HPDAs recognize:
exactly the CFLs
Is the following correct? To convert a DFA into an equivalent PDA, replace every transition labeled a in the transition diagram of the DFA by a transition a, eps -> eps between the same pair of states
It is correct because DFAs are just PDAs that ignore the stack
When converting a PDA with n states to a CFG, the number of variables created (without doing any simplifications rae)
O(n^2) but not a constant independent of n
When converting a PDA with n states to a CFG, the number of rules created (without doing any simplifications) is:
Impossible to classify without more information
To show that a language is not context-free, one could
use the pumping lemma for context-free languages OR use closure properties
Whenever each transition of a PDA M does not pop a symbol, the language of M
must be regular but need not be finite
Whenever each transition of a PDA M that pushes also pops, the language of M
must be regular but need not be empty
Whenever each transition of a PDA M pops a symbol, the language of M
must be finite but need not be empty
Whenever each transition of PDA M either pops or pushes, but not both, the language of M
must be context-free but need not be regular
In a CFG in CNF with start variable S, variables {S, A, B, C} and terminals {a,c} which rule could not arise?
S -> eps
S -> BC
B -> Bc
B -> a
A -> BC
B → Bc
In converting a regular grammar to Chomsky normal form, which step is never required?
Break up long right hand sides
Make the start variable not recursive
Eliminate unit rules
Ensure right hand sides are single terminals or just variables
Eliminate eps rules except possibly for S -> eps
Break up long right hand sides
Context-free languages are closed under
union, star, and concatenation (but not intersection or complementation)
Suppose that M = (Q, Σ, Γ, δ, q0, F ) is a PDA. Which of the following must be false?
Q is empty
Σ is empty
Γ is empty
F is empty
Σ ̸⊆ Γ
Q is empty
When converting a CFG into a PDA with the same language, by the method described in class, how many final states are in the resulting PDA?
Exactly 1
Given a CFG with N rules, in which every rule's right-hand side has length at most 5 (including variables and terminals), the best upper bound on the number of states in the equivalent PDA< using the method from class, is:
5n+5
A class of languages is closed under subsets if whenever L is int he class and L′ ⊆ L, L′ is also in the class. Among the context-free, regular, and finite languages, the classes that are closed under subsets are:
only finite
A derivation of a string w of length n in a context-free grammar
can involve any positive integer number of rules
A derivation of a string w of length n in a context-free grammar in Chomsky normal form
must involve exactly 2n-1 applications of rules, except possibly when n <= 5
A context-free grammar G is ambiguous if
some string w in L(G) has at least two different parse trees
To show that a language is context-free, one could give a PDA for it. One could also
give a context-free grammar for it or use closure properties
Every regular language is a context-free language
True
Every context-free language is a regular language
False
There can exist a regular language having no unambiguous context-free grammar
False (apply the NFA to regular grammar conversion to a DFA)
G is a CFG in which no rule has empty right hand side. The string w has length 5 and is in L(G). What can I tell about a derivation of w in G?
a.
The derivation involves exactly 10 applications of rules to derive this string.
b.
The derivation involves exactly 9 applications of rules to derive this string.
c.
The derivation involves at least 5 applications of rules to derive this string, but can be arbitrarily large.
d.
The derivation involves some number of applications of rules to derive this string, but is at most 32.
e.
None of the above is true.
e. None of the above is true
I have a context-free language L and a context-free grammar G with L = L(G). Which of the following is true?
a.
L is inherently ambiguous if and only if G is ambiguous.
b.
If G is ambiguous, then L is inherently ambiguous, but the converse need not hold.
c.
If L is inherently ambiguous, then G is ambiguous, but the converse need not hold.
d.
None of (a), (b), or (c) is true.
C. If L is inherently ambiguous, then G is ambiguous, but the converse need not hold.
I have a language L over the alphabet, {a,b,c}, in which every string has the same number of a, b, and c. Which of the following is true?
L might be regular (or might not)
Consider the language {abc} as a candidate for L. Because it is regular, this rules out answers in which L cannot be regular. It also shows that L need not be closed under star or concatenation. So L either might or must be regular. But taking strings containing n a's, n b's, then n c's for all n >= 0 gives an L that is not regular (pump). So L might be regular.
The number of states in a PDA can be 0.
False
PDAs always start computation with an empty stack.
True
PDAs always end computation with an empty stack
False
Call a PDA strict if it can only do exactly one of its push or pop operations one ach transition. Then, every PDA can be converted into a strict PDA with the same language.
True
Call a PDA poppy if it can only push, but not pop, on each transition. Then, every PDA can be converted into a poppy PDA with the same language.
False
Suppose we are given a CFG in which the longest right-hand side of any rule has length at most 5 (including variables + terminals), and there are n rules. Which of the following is the best upper bound on the number of states that will be in the equivalent PDA produced by the method in class?
5n+5 (always 4 base states + 1 set of states for every rule. If there are n rules of length 5 each, then there are 5n+4 states in total so 5n+5 is best bound)
The pumping lemma for context-free languages is proved by
showing that every derivation in a CFG in CNF must satisfy A =>* vAy for some variable A and some strings v and y of terminals, provided that the string is long enough
In converting a PDA into an equivalent CFG using the method in class, which of the following steps is never needed?
Convert the PDA to add a new symbol $ to mark the bottom element of the stack
A CFG G in CNF is used to derive a non-empty string w of length n. How many rules are applied?
always 2n-1
YOU MIGHT ALSO LIKE...
Automata Re-Exam
47 terms
Py4e: Chapter 11
11 terms
Ling 118 Final
22 terms
OTHER SETS BY THIS CREATOR
All Handelsman Words
262 terms
Jonathan's Master Makeup Quizlket
76 terms
Culture Tema 1 for Exam
23 terms
Vocab 3.1.1
45 terms
OTHER QUIZLET SETS
Coducting Midterm Review
17 terms
Chpt. 8 philosophy of religion
17 terms
Genetics Exam 4
90 terms