Discrete II, Exam 2

Ace your homework & exams now with Quizwiz!

The following CFG S -> aS | bS | a | b is equivalent to the regular expression - (a*+b)* - (a+b)* - (a+b)(a+b)+ - (a+b)*(a+b)

(a+b)*(a+b)

Which of the following is most powerful? - DFA - NDFA - 2PDA - DPDA

2PDA

S -> aSa | bSb | a | b ; The language generated by the above grammar over the alphabet {a,b} is the set of: - All palindromes - All odd length palindromes - Strings that begin and end with the same symbol - All even length palindromes

All odd length palindromes

Consider the language L1, L2, and L3 as given below L1 = {0p1q | p,q ∈ N} L2 = {0p1q | p,q ∈ N and p = q} L3 = {0p1q0r | p,q,r ∈ N and p = q = r} Which of the following statements is NOT TRUE? - Push Down Automata (PDA) can be used to recognized L1 and L2 - L1 is a regular language - All the three languages are context free - Turing machine can be used to recognize all the three languages

All the three languages are context free

Which of the following problem is undecidable? - Membership problem of CFG - Ambiguity problem for CFG - Finiteness problem for FSA - Equivalence problem for FSA

Ambiguity problem for CFG

Grammar that produce more than one Parse tree for the same sentence is: - Ambiguous - Unambiguous - Complementation - Concatenation intersection

Ambiguous

Choose the correct statements - An FSM with 1 stack is more powerful than an FSM with no stack - An FSM with 2 stacks is more powerful than an FSM with 1 stack - An FSM with 3 stacks is more powerful than an FSM with 2 stacks - All of the above

An FSM with 1 stack is more powerful than an FSM with no stack and An FSM with 2 stacks is more powerful than an FSM with 1 stack

Choose the correct statements: - All languages can be generated by CFG - Any regular language has an equivalent CFG - Some non-regular languages can't be generated by any CFG - Some regular languages can't be generated by any CFG

Any regular language has an equivalent CFG and Some non-regular languages can't be generated by any CFG

Which of the following is not true: - CFLs are not closed under substitution and homomorphism. - CFLs are not closed under intersection. - CFLs are not closed under complement. - CFLs are not closed under max and min.

CFLs are not closed under substitution and homomorphism.

Which of the following statement is wrong? - The regular sets are closed under intersection - The class of regular sets is closed under substitution - The class of regular sets is closed under homomorphism - Context Sensitive Grammar (CSG) can be recognized by Finite State Machine

Context Sensitive Grammar (CSG) can be recognized by Finite State Machine

Let L = L1∩L2, where L1 and L2 are languages as defined below: L1 = { ambmcanbn | m, n >= 0 } L2 = { aibjck | i, j, k >= 0 } Then L is - Not recursive - Regular - Context free but not regular - Recursively enumerable but not context free

Context free but not regular

Which one of the following statement is false? - Context-free languages are closed under union - Context-free languages are closed under concatenation - Context-free languages are closed under intersection - Context-free languages are closed under Kleene closure

Context-free languages are closed under intersection

Which of the following is the most general phase structured grammar? - Regular - Context-sensitive - Context free - None of the above

Context-sensitive

If every string of a language can be determined whether it is legal or illegal in finite time then the language is called: - Decidable - Undecidable - Interpretive - Non deterministic

Decidable

A Pushdown automata is... if there is at most one transition applicable to each configuration? - Deterministic - Non Deterministic - Finite - Non Finite

Deterministic

Which of the following does not belong to the context free grammar? - Terminal symbol - Non-terminal symbol - Start symbol - End symbol

End symbol

The following CFG S → aB | bA, A → a | as | bAA, B → b | bs | aBB generates strings of terminals that have - Odd number of a's and odd number of b's - Even number of a's and even number of b's - Equal number of a's and b's - Not equal number of a's and b's

Equal number of a's and b's

Which one of the following is FALSE? - There is unique minimal DFA for every regular language - Every NFA can be converted to an equivalent PDA - Complement of every context-free language is recursive - Every nondeterministic PDA can be converted to an equivalent deterministic PDA

Every nondeterministic PDA can be converted to an equivalent deterministic PDA

The following problem is not decidable: - Is w in L - Is L empty? - Is L finite? - Is CFG ambiguous?

Is CFG ambiguous?

Context free language can be recognized by - Finite State Automaton - Linear bounded automaton - Pushdown automaton - Both B and C

Linear bounded automaton and Pushdown automaton

All strings having equal number of a and b can be recognized by - DFA - NDFA - PDA - All of these

PDA

The idea of an automation with a stack as auxiliary storage...? - Finite automata - Push down automata - Deterministic automata - None of these

Push down automata

Which of the following CFG's can't be simulated by an FSM? - S -> Sa | a - S -> abX X -> cY Y -> d | aX - S -> aSb | ab - none of the above

S -> aSb | ab

Assume the statements S1 and S2 given as : S1 : Given a context free grammar G, there exists an algorithm for determining whether L(G) is infinite. S2 : There exists an algorithm to determine whether two context free grammars generate the same language Which of the following is true? - S1 is correct and S2 is not correct. - Both S1 and S2 are correct. - Both S1 and S2 are not correct. - S1 is not correct S2 is correct

S1 is correct and S2 is not correct.

Push-down machine represents: - Type 0 Grammar - Type 1 grammar - Type-2 grammar - Type-3 grammar

Type-2 grammar

The production grammar {S->aSbb, S->abb} is: - Type-3 grammar - Type-2 grammar - Type-1 grammar - Type-0 grammar

Type-2 grammar

The following grammar S -> bS S -> b S -> aA A -> bA - Type-3 grammar - Type-2 grammar - Type-1 grammar - Type-0 grammar

Type-3 grammar

A context-sensitive grammar (CSG) is - a formal grammar in which the left-hand sides and right-hand sides of any production rules may be surrounded by a context of terminal and nonterminal symbols. - Is an unrestricted grammar. - No more general than context free grammar. - One that does not allow S → λ

a formal grammar in which the left-hand sides and right-hand sides of any production rules may be surrounded by a context of terminal and nonterminal symbols.

Which string can be generated by S->aS | bA, A->d | ccA? - aabccd - adabcca - abcca - abababd

aabccd

Any string of terminals that can be generated by the following CFG S -> XY X -> aX | bX | a Y -> Ya | Yb | a - has at least one b - should end in an 'a' - has no consecutive a's or b's - has at least two a's

has at least two a's

The union of CFL and regular languages: - is always regular - is always context-free - both option 1 and option 2 above - need not be regular

is always context-free

The union of a context free language and a regular language - need not be regular - need not be context-free - is always regular but not always context free - is always regular and always context free

is always regular and always context free

Let L(G) denote the language generated by the grammar G. To prove set A = L(G) - it is enough to prove that an arbitrary member of A can be generated by grammar G - it is enough to prove that an arbitrary string generated by G, belongs to set A - both the above comments (a) and (b) are to be proved - either of the above comments (a) or (b) is to be proved

it is enough to prove that an arbitrary member of A can be generated by grammar G and it is enough to prove that an arbitrary string generated by G, belongs to set A

CSG can be recognized by a - FSM - DPDM - NDPDM - linearly bounded memory machine

linearly bounded memory machine

Definition of a language L with alphabet {a} is given as following. L = {ank | k > 0, and n is a positive integer constant}. What is the minimum number of states needed ina DFA to recognize L? - k + 1 - n + 1 - 2n + 1 - 2k + 1

n + 1

Which of the following conversion is not possible (algorithmically)? - regular grammar to context-free grammar - nondeterministic FSA to deterministic FSA - nondeterministic PDA to deterministic PDA - nondeterministic TM to deterministic TM

nondeterministic PDA to deterministic PDA

Give a production grammar for the language L = {x | x ∈ {a,b}*, the number of a's in x is a multiple of 3}. - {S->bS, S->b, S->aA, S->bA, A->aB, B->bB, B->aS} - {S->aS, S->bA, A->bB, B->bBa, B->bB} - {S->aaS, S->bbA, A->bB, B->ba} - None of the above

{S->bS, S->b, S->aA, S->bA, A->aB, B->bB, B->aS}

The classic example of a non-context-free language whose complement is context-free is: - {ww | w ∈ {a,b}+} is not a CFL, but its complement is. - No such example. - The complement of a non-context-free language is always not context-free - The complement of a context free language is always not context free.

{ww | w ∈ {a,b}+} is not a CFL, but its complement is.

Let P be a regular language and Q be context-free language such that Q ⊆ P. (For example, let P be the language represented by the regular expression p*q* and Q be {pnqn | n ∈ N}). Then which of the following is ALWAYS regular? - P ∩ Q - P - Q - Σ* - P - Σ* - Q

Σ* - P


Related study sets

Diabetes & Metabolic Syndrome PQs

View Set

Chapter 13 - Conflict Management

View Set

Simplifying Rational Expressions

View Set

Chapter 13 Personal Finance: Investing In Mutual Funds

View Set

Computer Science 307: Software Engineering : Chapter 1

View Set

Finance Test (Chapters 6, 7, & 8)

View Set

Government Test 3- Review(Part 3)

View Set