0% found this document useful (0 votes)
15 views4 pages

CS209-Sessional One Mark Questions With Answers

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views4 pages

CS209-Sessional One Mark Questions With Answers

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

1.

List the different ways of acceptance by PDA


A. There are two different ways to define PDA acceptability.

Final State Acceptability


In final state acceptability, a PDA accepts a string when, after reading the
entire string, the PDA is in a final state. From the starting state, we can
make moves that end up in a final state with any stack values. The stack
values are irrelevant as long as we end up in a final state.

For a PDA (Q, ∑, S, δ, q0, I, F), the language accepted by the set of final
states F is − L(PDA) = {w | (q 0, w, I) ⊢* (q, ε, x), q ∈ F} for any input stack
string x.

Empty Stack Acceptability


Here a PDA accepts a string when, after reading the entire string, the PDA
has emptied its stack.

For a PDA (Q, ∑, S, δ, q 0, I, F), the language accepted by the empty stack is
− L(PDA) = {w | (q0, w, I) ⊢* (q, ε, ε), q ∈ Q}

2. What is CNF?

A: A CFG is in Chomsky Normal Form if the Productions are in the following


forms −

 A→a

 A → BC

 S→ε

where A, B, and C are non-terminals and a is terminal.


3. Define Context Sensitive Language?
A: Context-Sensitive Grammar –
A Context-sensitive grammar is an Unrestricted grammar in which all the productions are of
form –

Where α and β are strings of non-terminals and terminals.Language generated from this CSG is
CSL.

4. Define Halting problem


A

The Halting problem – Given a program/algorithm will ever halt or not?


Halting means that the program on certain input will accept it and halt or reject it and halt and it
would never goes into an infinite loop. Basically halting means terminating. So can we have an
algorithm that will tell that the given program will halt or not. In terms of Turing machine, will it
terminate when run on some machine with some particular given input string.

The answer in no we cannot design a generalised algorithm which can appropriately say that
given a program will ever halt or not?
It is only possible for us to run the program and check whether it halts or not.
We can refrain the halting problem question in such a way also: Given a program written in
some programming language(c/c++/java) will it ever get into an infinite loop(loop never stops) or
will it always terminate(halt).

5. Define Decidability and Un-Decidability ?

A. A problem is said to be Decidable if we can always construct a corresponding algorithm


that can answer the problem correctly. We can intuitively understand Decidable problems by
considering a simple example. Suppose we are asked to compute all the prime numbers in the
range of 1000 to 2000. To find the solution of this problem, we can easily devise an algorithm
that can enumerate all the prime numbers in this range.
Now talking about Decidability in terms of a Turing machine, a problem is said to be a Decidable
problem if there exist a corresponding Turing machine which halts on every input with an
answer- yes or no. It is also important to know that these problems are termed as Turing
Decidable since a Turing machine always halts on every input, accepting or rejecting it.

Semi- Decidable Problems –

Semi-Decidable problems are those for which a Turing machine halts on the input accepted by it
but it can either halt or loop forever on the input which is rejected by the Turing Machine. Such
problems are termed as Turing Recognisable problems.

Examples – We will now consider few important Decidable problems:

Are two regular languages L and M equivalent?

We can easily check this by using Set Difference operation.

L-M =Null and M-L =Null.

Hence (L-M) U (M-L) = Null, then L,M are equivalent.

Membership of a CFL?

We can always find whether a string exist in a given CFL by using on algorithm based on
dynamic programming.

Emptiness of a CFL

By checking the production rules of the CFL we can easily state whether the language
generates any strings or not.

Undecidable Problems –

The problems for which we can’t construct an algorithm that can answer the problem correctly in
a finite time are termed as Undecidable Problems. These problems may be partially decidable
but they will never be decidable. That is there will always be a condition that will lead the Turing
Machine into an infinite loop without providing an answer at all.

We can understand Undecidable Problems intuitively by considering Fermat’s Theorem, a


popular Undecidable Problem which states that no three positive integers a, b and c for any
n>=2 can ever satisfy the equation: a^n + b^n = c^n.

If we feed this problem to a Turing machine to find such a solution which gives a contradiction
then a Turing Machine might run forever, to find the suitable values of n, a, b and c. But we are
always unsure whether a contradiction exists or not and hence we term this problem as an
Undecidable Problem.

Examples – These are few important Undecidable Problems:


Whether a CFG generates all the strings or not?

As a CFG generates infinite strings ,we can’t ever reach up to the last string and hence it is
Undecidable.

Whether two CFG L and M equal?

Since we cannot determine all the strings of any CFG , we can predict that two CFG are equal
or not.

Ambiguity of CFG?

There exist no algorithm which can check whether for the ambiguity of a CFL. We can only
check if any particular string of the CFL generates two different parse trees then the CFL is
ambiguous.

Is it possible to convert a given ambiguous CFG into corresponding non-ambiguous CFL?

It is also an Undecidable Problem as there doesn’t exist any algorithm for the conversion of an
ambiguous CFL to non-ambiguous CFL.

Is a language Learning which is a CFL, regular?

This is an Undecidable Problem as we can not find from the production rules of the CFL
whether it is regular or not.

Some more Undecidable Problems related to Turing machine:

1. Membership problem of a Turing Machine?


2. Finiteness of a Turing Machine?
3. Emptiness of a Turing Machine?
4. Whether the language accepted by Turing Machine is regular or CFL?

You might also like