0% found this document useful (0 votes)
7 views20 pages

TCS QB

Uploaded by

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

TCS QB

Uploaded by

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

Assignment - 1 Questions

Module 1,2and 3

Question No. Ouestion


1. a) What are the applications of TCS? Explain Limitations of TCS
b) Explain Difference between Moore machine and Melay Machine
2. a) Write diference between NFA and DFA

b) Explain Four types of Grammar


3. a) Draw a DFAfor the following language over (0,1):
All strings of length at most five
2) All Strings with exactly two 1's
b How to convert an NFA to DFA ? Give an example.

4 a) Explain with an example Chomsky Hierarchy


Design a NFA for a binary number where the first and last digits are same
Sa) Design a DEA which accepts the odd number of l's and any number of 0'sover
E-{0,1}
b) Design DFA for a language of string 0 and I that
a) Ending with 10
b) Ending with 11
c) Ending with
6 a) How do you prove that language L= a'n b'n c^n is not regular?
b) Explain diferent applications of Pumping Lemma
LEGE.
OF E
INNOVATIVVE ENGINEERS' AND TEACHARS' EDUCATION SOCIETY's
TcS.
BHARAT COLLEGE OF ENGINEERING
Opp. Gajanan Maharaj empal, Kanhor, Badlapur (W) 421 504, Tal. Ambarnath, Dist. Thane. Ph.:7666615915
ADLAPUR Approved by AICTE, DTE,Govt.of Maharashtra and Affited to University of Mumbai
DTE Institute Code :3351

12hatore the cpplkcatians oí TcslExplain


Limitatiars ot

Appli catians of TCs -


1Algextthna design Develapiog efficieotalgoxithns
Hoy slauing Computtianad pao blema
2paagnomming languages Deaigningpogai
languages Campi leasand inteprtes
3Camputer nehoonck s - undestaadinq netuoxk
lproto Cols, arcbi tec tue,and Camouni catian
4lCzyptoqraphy TDevelaping secuzeienCyptian
clgorithrns and proto Cals
5Database systems i Designin andoptinizin
database monag ement sstema
Computer gaphica Genemting image,anima=
tions and specialePechs
"imiatina s Tasi
1Abstact naLure iTheaxetico Computex science
ceals uoth abstnct madela and
algoithos, which nat alulays tran
slate to parocico aealwd scenasias
2Scolability i- Some thearetical Solutiens
not be scalable tor laxge,Camplex
SyStem
3 Coneputatiana Cemplezit Some poblems may
be Camputatianally infeasible or eaulzc
an unfea sible amou at mesaurces
moore
rmachine
and
Usere eepezience equivalent
isan
2Tbere Large to
the
numbex Q. is implement
using
associaed
sDOutput
esut ffect fox has
machine
mo0Te
machine
maoe
eVery
machioe
TMecly CotTesponding
TMealy functian
modelGmay XQ
Mooremachine Caraparetiao machine
7666615915 cal dan't
accerately
uSer to
ENGINEERING State
With transi
by easy
theoxeti 0x
Mumbai outpu
Ph.:S
SOCIETY'
Thane.
qiven
aotenstae machne maore
of
University tical petoxnmance issTis
noc function|4)The
Dist.
EDUCATION
Some The
Ambarnath,
to
Affilited to iTheoxt Explain
Diference
between 3)LA ot is
o
OF Tal.and3351
TEACHARS apply ZxatQThel
qiueaby
is
Code:
504,Maharashtra
COLLEGE be afeaen
équivalent wth isglven
421 Institute 4Limied that
applicabilkhy 5s0ciated can USing
Clscuit
Seldorm
aplemerntes
AND (W)
only
meticswoxle
fo
machine
moore
Badlapur
ENGINEERS'DTE,Govt.of
DTE
machi
mtas
evey machint
metxics machine.
melay macehine tronsitian
SxMealy gachine 5 4Tetaanaitiao
unetinn
Kanhor, may real-
an
is
Thexe
state
BHARAT
INNOVATIVEAICTE,
Tempal, aa mplemzateal USing
by GLEvalwation 5Ameals
Maharaj
Approved is f
Output mealy ouciput
Gajanan numbe eitherg
Aeuith
Opp.
3)A
Sell
No
O
EGE ADLAPUR
Mealy Machine Moore Machine

Output depends on present state as Output depends only upon present


well as present input. state.

If input changes, output also If input changes, output does


changes. change.

Less number of states are required. More number of states are required.
There is more hardware requirement There is less hardware requirement
for circuit implementation. for circuit implementation.
They react faster to inputs. They react slower to inputs(One
clock cycle later).
Asynchronous output generation. Synchronous output and state
generation.

Output is placed on transitions. Output is placed on states.

It is difficult to design. Easy to design.


EDUCATION SOCIETY's
INNOVATIVE ENGINEERS' AND TEACHARS'
BHARAT COLLEGE OF ENGINEERING 7666615915
(W) 421 504, Tal. Ambarmath, Dist. Thane. Ph.:
Opp. Gajanan Mahara empal, Kanho, Badlapur Mumbai
Approved by AICTE, DTE,Govt.of Maharashtra and Aflited to University of
DTEInstitute Code: 3351

2.aite diffxence hetueen Aano DA

6x.Daxame Bez NEA DIA

1.Tansitian Non- detexministic Deteroinistic


2No.of StatesNA has fesesouahed Moxe if NEA Caataicd
a states then he
Cozespooding DiA
Lhaue29%tates
2.Daut. LsoDEA.
to design oue Re lodiely Mare
4Design to nondelemioisroAificut to design
ctansitians are
loeexoiaistic
to Pind
ahethex ELoslthezehethey êL y
ore Sevea peths.Back-tra nsition a cTe
taacking isequizeo detexoini stic
to xploxe evexoe
Parallel Paths
Deterministic FInite Automata (DFA) NondeterministicFinite Automata (NFA)
Building a DFA is difficult. An NFA is simple to construct.

In DFA, just a single state transition may be The user does not require to provide any
achieved for each symbolic representation information about how various symbols
of the alphabet. influence the NFA.

In DFA, the next potential state is explicitly Every pair of input symbols and states in NFA
defined. might contain many possible states.
NFAs are the source of allI DFAs. All NFAs are not DFAs.

There is a need for more space allocation There is less need for space requirement.

In DFA, the total time it takes to run any In comparison to DFA, the total time required
input string is less than it is in NFA. to run any input string in NFA is longer.
It doesnt know how to handle an empty It is capable of handling empty string
string transition. transitions.
Dead state may be required. Dead state is not required.

Backtracking is permitted in DFA. Backtracking is not pemitted in the NFA.


Requlazq 1Tpeg
tpes follooiag the
ta Classified
n Chomsky mulesduetiao
po basic
ot oo
the classi'ied 4amar
be Can A
Gzamar of ypes
ttypes JExpla:n
four
Context- Free

Regular

Type - 3 Grammar

Type-3 grammars generate regular languages. Type-3 grammars must have a


single non-terminal on the left-hand side and a right-hand side consisting of a
single terminal or single terminal followed by a single non-terminal.

The productions must be in the form X’a or X’ aY

where X, Y EN (Non terminal)


and a ¬ T (Terminal)
The rule seis allowed if Sdoes not appear on the right side of any rule.
Example
X’¬
X’a<aY
Y’b

Type- 2 Grammar
Type-2 grammars generate context-free languages.
The productions must be in the form A’y
where AEN (Non terminal)
and y e(TUN)* (String of terminals and non-terminals).
These languages generated by these grammars are be recognized by a
non-deterministic pushdown automaton.

Example
S’Xa
X’a
X’ aX
X’ abc
X’[

Explore our latest online courses and learn new skills at your own pace. Enroll
and become a certified expert to boost your career.
Type - 1 Grammar
Type-1 grammars generate context-sensitive languages. The productions must be
in the form

a Aß’ ayß
where A eEN (Non-terminal)
and a, B, y ¬ (T U N)* (Strings of terminals and non-terminals)

The strings a and ß may be empty, but y must be non-empty.


The rule S’[ is allowed if S does not appear on the right side of any rule. The
languages generated by these grammars are recognized by a linear bounded
automaton.

Example
AB ’ AbBc
A’ bcA
B’b

Type -0 Grammar
Type-0 grammars generate recursively enumerable languages. The productions
have no restrictions. They are any phase structure grammar including all formal
grammars.

They generate the languages that are recognized by a Turing machine.


The productions can be in the form of a ’B where a is a string of terminals and
nonterminals with at least one non-terminal and a cannot be null. ß is a string
of terminals and non-terminals.

Example
S’ ACaB
Bc ’ acB
CB’ DB

aD--Db
ZaDaous a DEA foz the falousing
lanquage auezlb.
1) All strings oP_lengthat mostTve
2)A) Stxings oith eactlly tOD 1s.
iDhese ae he valhd stxingsi
Stzing
sting'a
af length 0- accept thcouh
length aoept thaaugh
2a.

shing length 2- accept thzugh 22


Sthin af length3accep+ thaough qe
Staing af length 4-cept thzough u
stingof Jeagths-acLept thacugh 2a.
5tzing of lengtkShold ke seected thzaugh
dead stte ox a failue state. Afailwax atate

0,)

Calstate taonsition diagom


EDUCATION SOCIETY'S
INNOVATIVE ENGINEERS' AND TEACHARS
OF ENGINEERING
BHARAT COLLEGE 504, Tal. Ambarnath, Dist. Thane. Ph.:7666615915
Badlapur (W) 421
Opp. Gajanan Maharaj empal, Kanhor,
DTE, Govt. of Maharashtra and Afited to University of
Mumbai
Approved by AICTE, DTE Institute Code :3351

tahle
Cb)state tsansitian
GHhauct a failueState

(c) state transitton dicgm

Cd)state tzanstian table.


GADLAPUR LEGE OF
E

"A 2)
diagaaaL
Second
te40 State
ia)
Pirsttronsitian
Ce)Gtate A
1in Opp.
C
Gajanan
1take Stxinqswith BHARAT
Approved by
Maharaj
1 INNOVATIVE
takes Tempal,
the s AlCTE,
the COLLEGE Kanhor,
ENGINEERS'
DTE,Govt.of
Badlapur
the
machine DTE
Maharashtra
Institute (W) AND

machine eseactlytwo1s TEACHARS'


421
Code: 504,
chine and Tal.
OF
Prom 3351
Affilited
Ambarnath,
ENGINEERING EDUCATION
tansition
rm)state
table to
University
Murnbai of
olo Dist.
SOCIETY'S
Thane.
lure
48la J
to Ph.:
la. 7666615915

a
is
c
b Hau to Conet an ezaraple

To NIA wheg a spacificainput sqiven o the


Cusent state, the machine qoes to mutiple states
It Can have zes0one ox mare thag oDe maVe on a
lqiven input synnbal ooAhe othes hand in DÉA lhen
a Specific input is qiven o the cuént staie,the
machine goes to oaly o0e stade. DÀA hasanlu ane
mae On agien input aymbal.
Steps fox Conveting E to D£A.
Step1-Toitialls Q'=
Step 2 - Add 0 o NEA toQThen find the taans
itiogg foomAbis stoot tate
step 3iLaafind the possibleSet o states
Tor eocb input syalal. Tf this set of staBes i5
SOCIETY'S
TEACHARS' EDUCATION
ENGINEERING
INNOVATIVE ENGINEERS'
AND
COLLEGE OF Ambarnath, Dist. Thane, Ph.: 7666615915
EGE OR
BHARAT (W) 421 504, Tal. Afilited to University of Mumbai
Maharaj Tempal, Kanhor, BadlapurMaharashtra and
Opp. Gajanan
Approved by AICTE,
DTE,Govt.of
DTE Institute Code:3351
CADLAPUR

nat in theo add it to


stat e eiIL be oll the
Pinel
Step 4 - Ln EA, the (ioe states of fA)
Stetes wbichContako

*Example
AA to DÊA
Caovezt the given dA

state

H1 o

Nowse wl Obtein 6trostho Pox State o

46(9o], ) =Ao
25(C90]. )=21
The ötransitian tax Stote q1isobtained al:
15Cl,o) =L,2Cneu Staie qeneaate
2.5'(2), )=L1.
he 5'tansitiao fox state q2 is obtined si
TEACHARS'EDUCATION SOCIETY'S
INNOVATIVE ENGINEERS' AND
ENGINEERING
OF Ambarnath,
6E OF E
BHARAT COLLEGE
Badlapur (W) 421504, Tal.
Dist. Thane. Ph.: 7666615915
Kanhor, and Aflited to University of Mumbai
Opp. Gajanan Maharaj Tempal,
AlCTE, DTE,Gov.of Maharashtra
Approved by DTE Institute Code:3351

s t r t e s t h e fipad 5tete o oelIL


he finalstete Qa. The thans
heCange t ontoins a
A wo) be -
oxthe Cons4xnctee DE
itian table

State
’ 0 0

ThetanSitian diagnm

The State qa Can be eltmioated be case 2


san UnTeachable Stote.
EGE O INNOVATIVE ENGINEERS AND TEACHARS' EDUCATION SOCIETYS
BHARAT COLLEGE OF ENGINEERING
Opp. Gajanan Maharaj Tempal,Kanhoc Badapur (w) 421 504, Tal. Ambamath, Dist Thane. Ph: 7888615915
ADLAPUR Approved by AICTE, DTE,Govt.of Maharashtra and Aflited to University of Mumbai
DTE Institute Code: 3351

4aExplain uith as etample chamsky Hiezaxchy


The Chnmsky hieaazchy isa Cancept in the
theat c Camputatian that qraups Pazmal
languages into fouz levels af Cooplezity
11Requla languages (Type g)i- Recog nizable by
Pinlte autonate
Example -The laquage of all strings Coasist
ing of only la's and uith ao egual numbex cP
landb
Language ie, ah, "aabhanb
Cantezt-fzee languages (Type 2) Recagnizable ay
pushdaun itannata
Eeample The language af alll atings af hala
nted Paeotheses
Languageifa " ,"otoo"
3 Caateat- Sensitive langunges (Type )i- Recegni 2able
by line baunded otomata
fromple The langage of all Sting of the
Porm latnh ^nc^n" where n )

4Recuraive
Recognini2able
enumerable
by 1aing
languagesType
moe bines
o)i
Peample - The languaye oP all sting
that aTe a Valid Canmpu tatiaA
histaag O a Tuxing machine
BADLAPUR I

"TÊ bp
eotethe and
wiL A11 Opp.
NEA TE DesignaNAtor
n-detemini Gajanan
entexthe the fhe State lost BHARAT
ApprovedMaharaj
fll INNOVATIVE
Gtarting by
Tempal,
end Startn4 digits AlCTE,
finalendtn, Kanhor,
ENGINEERS'
to COLLEGE
tantiHoo DTE,Govt.of
stically in Badlapur
Code:3351
Institute
DTE
fina
thetafte+ state are Maharashtra (W) AND
ands 421
hy
ond TEACHARS'
in by Som bina 504, OF
and Tal.
State ending
makinq u making
ending dio Ambarnath,
AffilitedEDUCATION
ENGINEERING
a grom
and numbez UniversitytoDist.
Thane.SOCIETY'S
ds diqits a of
an a
digits Mumbai Ph.:
mave 7666615915
last wilmave whexe
are Hoqzton axe
the
1waittoqa 0theo
it the fixs
of OandJ (s
lo
Senuence
oumber
even,add
odd
76F615915
ENGINEERING t be string
by be in
the
Ph..
SOCIETYS
Murnbai
of Seen 1sseenCald
seea'Could
Thane. qiven Eeen
ofUniversity
whichaccepts tack of
Dist.
EDUCATION aleady W
1s language statt,nothia
Arnbarnath,
to
Afilited diagram 16is
OF
TEACHARS Code:3351
Tal,and
Insttute
DTE Reep numberofs
D¾A Laith
COLLEGE
504,Maharashtra o2th
thotCading
AND
421
(W)
Stxing
oustStxing of
equised State
ansitian uence
Badiapur
ENGINEERSDTE,Govt.of c Ending1o.
with
a)ndiag
Kanhor, DAany number Fo Seq
BHARATAICTE,
INNOVATIVE
Ternpal, DEA oState
the DEA oislatin
by and b)
Approved
Maharaj o he b)Desigo Seen
Gajanan Destlgo
1% ne in tate
1'5The The
Opp.
Of
5a
ADLAPUR
"he
QEndingottostarting
h 1.223
symbalis
Pxecedin 1 22inal Opp.
Gajanan
ransitianciagzm
DEA State final State BHARAT
Approved
Maharaj
INNOVATIVE
twil) by
Tempal,
AICTE,
stete txansitisn State COLLEGE Kanhor,
ENGINEERS
3fate, DTE,Govt.of
be Badilapur
Seauence Code:3351
InstituteDTE
in of Maharashtra (W) AND
tox 421
TEACHARS'
state nathing dag 504,
5tings OF
St and Tal.
Ambarnath,
AffilitedEDUCATION
ao ENGINEERING
xingsen
Q at to
Uiversity Dist.
ending SOCIETYS
Sequence Thane.
oheneve of
Mumbai Ph.:
ding 7666615915
wth
Lwtth
the uith
sseen
lo
3.6.4 Application of Pumping Lemma
Pumping lemma should be used to prove that given set is not regular.
Pumping lemma should be applied to a problem in steps as given below.
.
Step 1: To prove that L is not regular, we proceed with assumption that L is regular and it is
accepted by a FA with n states.
Step 2 : Now, we choose a string 0¬ L such that I o l>n.
which o to select is very important and it is the key to solution using
pumping lemma.
Step 3 : o is written as xyz,
With Ixyl s n
and lyl > 0
Now we must find an i such that xy'z e L. This will contradict the assumption that L
is regular and hence we can conclude that L is not regular.
-whichitoselect such that xy'z g L is very important.
Example 3.6.1: Show that the languar

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy