Which of the following is/are type of
data supported/added by/in typical
object file formats in code generation
phase of a compiler?
(i)
Data segment
(ii) Block started by symbol
(iii) Text segment
Data segment: This section holds initialized global variables. It's read/write.
Block started by symbol (BSS): This section holds uninitialized global variables.
Text segment: This section contains the executable machine code. Also known as the code segment.
All the three options are correct!
Which one of the following is not
decidable?
(A) Given a Turing machine M, a
string S and an integer K, M
accepts S with K step S
(B) Equivalence of two given
Turing machines
(C) Language accepted by a given
DFSA is non-empty
(D) Language generated by a CFG
is non-empty
Otherwise, the problem is undecidable, it means no algorithm can guarantee a correct answer for all cases.
A simulation of running on S for at most K steps can always provide an answer
The Turing machine equivalence problem asks whether two machines accept the same language, but due to the halting problem, there is no general procedure that can always determine equivalence.
We can check if any accepting state is reachable from the start state.
his can be solved by checking whether there exists a derivation that produces a string using the given CFG.
Determine the regular expression for the language accepted by L1/L2 for L1 = L(a*baa*), L2 = (ab*) :
This book's 6th edition is available in the web.
Determine the context free grammar
for the following language where
n, m >= 0 :
L { w belongs to { a,b }* | count of a(v) = count of b(v) , where
v is any prefix of w}
Prefix is a pattern which occurs in the starting of the string.
The given language consists of strings in {a, b}* such that, in every prefix, the number of occurrences of 'a' equals the number of occurrences of 'b'.
This property strongly suggests a need for balancing 'a' and 'b' throughout the derivation process.
(A) S -> A | B
A -> aA | aS | epsilon
B -> bB | epsilon
Option A doesn't enforce strict balancing at every prefix.
(B) S -> A | B
A -> aA | aS | epsilon
B -> bB | bS | epsilon
Option B allows transitions between 'a' and 'b' but doesn’t maintain balance in every prefix.
(C) S -> A | B
A -> aA | aB | epsilon
B -> bB | epsilon
Option C correctly ensures that every prefix maintains balance by switching between 'a' and 'b'
(D) S -> A | B
A -> aA | SS | epsilon
B -> bB | bA | epsilon
S -> aSbS I bSaS | epsilon
to make sure a's count = b's count.
Determine the state table of a minimal machine which produces and maintains an output of 1 wherever it detects the sequence 001. The output returns to zero only when another sequence 010 is detected.
It means in 00101001 we can take 001-010-01 separately.
Aspirants can use this implementation for your learning purpose to understand how this machine works.
Implementations may differ.
Comments
Post a Comment