# Answers by Dharmendra Verma

1 vote
1
Consider the following synchronization construct used by the processes P1, P2 and P3. The S1, S2 and S3 are counting semaphore variables: S1 = 3, S2 = 2, S3 = 1; P (S1); P (S2); P (S3); Critical section V (S3); V (S2); V (S1) ... but not mutual exclusion. C It satisfies mutual exclusion and bounded waiting but not progress. D It satisfies all the mutual exclusion, progress and bounded waiting.
2
Please draw the GANTT CHART
3
what is meant by reusing machine independent code optimizer in other compilers ???? generally the machine independent code is the intermediate code which can be used to build a back end for any platform ..please clarify
1 vote
4
The minimum number of temporary variables created in 3 address code of the following expression are _____ a+b*c+d-e-a+b*c Assume order of precedence from highest to lowest as: *,+ and - .Consider associativity for + and * are not important but - is left associative.
1 vote
5
If grammar is LL(1) then which of the following is always true? A. It is LALR B. It is LR (1) C. Both A and B Please give answer with necessary explanations as there are different answers in different sites.
6
1. For a $N$ state DFA its equivalent NFA would contain how many numbers of states:- a) In worst case? b) In best case? 2. For a $N$ state NFA its equivalent DFA would contain how many numbers of states:- a) In worst case? b) In best case?
7
{a^n b^kn | k>=1,n>=0} which language (a) DCFL (b)CFL (c)DCFL hence CFL (d)CSL (e)out of CSL
8
Which of the following is Regular?
9
Consider the following grammar G. Is this regular? S →EF E → a|∈ F → abF|ac
10
11
12
13
14
15
16
Consider the following statements $S_{1}:$ The set of string described by a rule is called pattern associated with the token. $S_{2}:$ A lexeme is a sequence of character in the source program that is matched by Pattern for a token. Which of the following statement is/are true? Both $S_{1}$ ... $S_{2}$ is false $S_{2}$ is true $S_{1}$ is false Both $S_{1}$ and $S_{2}$ are false
17
Which of the following statements is correct? (A) For any context free grammar there is a parser that takes at most O(n2) to parse a string for n terminals. (B) Recursive descent method can't be used to both parse and implement syntax-directed translation. (C) Software tools for generating parsers directly from grammars often use top-down methods. (D) None of the above.
18
Consider the grammar given S->AA A->aA / b How many entries will be blank in the GOTO table for SR(0) items? What is the meaning of SR(0) items?
19
The power of parsers is as follows: CLR(1) > LALR(1) > SLR(1) > LR(0) > LL(1) Can we say that if a language is not parsed by powerful parser then less powerful parsers can't parse that language? Likewise, if a language can be parsed by less powerful ... it be parsed by all powerful parsers than that? Is there a formal proof for the above two questions? How to compare SLR and LALR parser formally?
20
Which of the Following is True ? A. Symbol table Construction is during the analysis part of the Compiler. B. Type checking is Done during Syntax Analysis phase C. SDD with only synthesized attribute have an order of evaluation D. Both A and C Please Explain the C part only rest are easy :)
21
a) A.val = A.val * B.val B.val = C.val * D.val E.val = E.val + F.val b) A.val = A.val * B.val B.val = C.val - D.val E.val = E.val + F.val c) A.val = A.val / B.val B.val = C.val * D.val E.val = E.val + F.val d) A.val = A.val / B.val B.val = B.val / D.val E.val = E.val * F.val What is the fastest way to solve this question?
22
23
S→(X S→E] S→E) X→E) X→E] E→ϵ Is this grammar CLR(1)? The answer says it is but I find a shift reduce conflict for E-> epsilon with lookup symbols ),]
24
25
Among Deterministic pushdown automata and Non deterministic pushdown automata, which is more powerful and why ?
26
Time taken by one tape TM to simulate n moves of k-tape TM is 1) O(n) 2) O(n^k) 3) O(n^2) 4) None of the above
F(A,B,C,D)=$\Sigma$(0,2,3,5,8,10,11,12,15) Realize it using 8:1 MUX . what is the logic behind?