Theory of Computation & Compilers Previous Year Questions
27 Theory of Computation & Compilers (Computer Science) questions asked in CIL MT previous year papers, each with the correct answer and explanation. Read them free on UTpaper, or attempt the full papers as timed online tests.
Consider the following grammar G:
E → T E'
E' → + T E' ε
T → F T'
T' → * F T' ε
F → (E) id
Which of the following statements about top-down parsing of grammar G is true?
AThe grammar is not left-recursive and can be parsed using a predictive (LL(1)) parser.
BThe grammar requires backtracking since FIRST and FOLLOW sets of E’ overlap.
CThe grammar is left-recursive and hence cannot be used for top-down parsing.
DThe grammar is suitable for LL(1) (predictive) parsing and does not require backtracking.
Show answerHide answer
Correct answer: (D) The grammar is suitable for LL(1) (predictive) parsing and does not require backtracking.
In the context of programming languages, if a compiler can determine the scope of a declaration by examining the program text alone, the language is said to use:
ADynamic policy and lexical scope
BStatic policy and lexical scope
CStatic policy and dynamic scope
DDynamic policy and dynamic scope
Show answerHide answer
Correct answer: (B) Static policy and lexical scope
Let L be the language on A = {a, b, c} which consists of all words of the form w = aʳbˢcᵗ where r, s, t > 0. Which of the following is the valid regular expression 'r' such that L = L(r)?
Consider the following problem X
"Given a Turing Machine M over the input alphabet Σ any state q of M and word w in Σ*, does the computation of M on w visit the state q"
Which of the following X is correct?
AX is undecidable but partially decidable
BX is not a decision problem
CX is decidable
DX is undecidable but not even partially decidable
Show answerHide answer
Correct answer: (A) X is undecidable but partially decidable
Which of following problems are undecidable?
I. Membership problem in context-free languages
II. Whether a given context-free language is regular
III. Whether a finite state automation halts on all inputs
IV. Membership problem for type 0 languages
AIII and IV
BI and IV
CI and II
DII and IV
Show answerHide answer
Correct answer: (D) II and IV
How to use these CIL MT Computer Science questions
Every question here was asked in a real CIL MT paper; the paper and shift are shown on the card, and the number opens the question on its own page. Try each one before tapping Show answer, then attempt the full CIL MT papers as timed tests to check your speed under exam conditions.