NEW
Font size
WorksheetsComplier design
Total questions: 30
Worksheet time: 57mins
Which of the following grammar can be converted in LL(1) parser ?
Grammar contain Left recursion
Grammar contain Left factoring
Grammar contain Left Factoring and right recursion
None of the above
Considering LALR(1) has n state for grammar, which of the following false
SLR will have n state
CLR will have exaclty n state
SLR will have n state
CLR may or may not have n state
The following grammar is:
S--> Aa/bAC/dc/bda
A-->d
Not SLR(1) and not CLR(1)
CLR(1) but not SLR (1)
SLR (1) but not CLR (1)
SLR (1) and CLR (1)
Consider the following grammer:
S-->aB/aAb , A-->bAa/a , B-->aB / ε .
How many back track are required to generate the string "ab" from the above grammar
Nil
1
2
3
Consider the statement:
P=Q+R*60.
How many tokens are:
6
7
8
9
Grammar:
E--> TE' ,
E'-->ε/+TE' ,
T--> FT',
T'--> ε/*FT' ,
F--> a / [E].
What is the first (E)
+, *
[ , ε
] , ε
a,[
In term of deadlock, What is safe sequence ?
Sequence, where the chances of deadlock in the future
Sequence, where chances of deadlock is none
Sequence, where the deadlokc is already happed
Sequence, where OS remove the process
The number of token generated by the lexical analyzer for the following program:
void main ()
{
print ("Hello world")
// To tell the world "hello"
}
9
10
11
17
The system shares 9 instance of resource R. The following scenario:
"P1 is currently holding 3,P2 is currently holding 1,P2 is currently holding 3 ".
Which of the follwowing is the best description of current scenario.
Deadlock but safe
Deadlock but unsafe
No deadlock
Can't say
The banker algorithms used for
Deadlock detection
Deadlock avoidance
Deadllock recovery
Deadlock prevention
The time complexity of Banker algorithms is
Where "n" is number of process
O( n2 )
O( n3 )
O( 2n )
O(log n)
The best descriobed statement for Wait-for-graph
It is used to prevent the deadlock
To check the dependency of between the process and resources
To check the dependency of between the processes
To solve the deadlock for multiple instances
Consider the P_0, P_1, P_2, and P_3 process with resources A,B,C and D with maximum instances of 10, 4, 9 and 6. The follwing scenario expains the process allocatiaon and maximum resouces (in term of A,B,C,D)
P_0---> 2,1,2,0 (Allocated resources)----> 4,1,3,2 ( Max resources )
P_1---> 1,0,0,2 (Allocated resources) ----> 4,1,0,3 ( Max resources )
P_2---> 2,0,2,1 (Allocated resources)----> 5,4,4,1 ( Max resources )
P_3---> 2,3,4,1 (Allocated resources)----> 3,3,6,6 ( Max resources )
What is the safe sequence
P_0, P_1, P_3, and P_2
P_0, P_1, P_2, and P_3
P_0, P_1, P_3, and P_3
P_0, P_2, P_3, and P_1
The following grammar:
S--> aXCd
X-->a/ ϵ
C--->a/d
Which of the follwing stament is true
first (S)={a,d}
follow(S)={ ϵ ,$}
This is not LL(1) grammar
This is LL(1) Grammar
Which of the follwing statement is True for LALR parser
It detect recursion and remove it
It detect left factoring and remove it
It resolve Reduce-reduce conflict only
It resolve Shif-reduce and reduce-reduce conflict
Grammar: X-->SSS/(S)/ ϵ is not suitable for parsing because the grammar is
Left recursive
Right Recursive
Ambiguious
None of the above
In the following statement: a=b*c+d*e.
Compiler generates 3-address code for the above expression. The total number of temporary variables requried are
4
5
6
Can't generate three address code
In the operator precedence rule, the + has highest precedence and right associative than -(minus) and * (multiplication). The - (minus) has high precedence and left associative than * . Finally * is right associative. Then compute the following expression :
2*3*4+5+9-1-2
360
361
320
160
The following statement:
A: Every regular grammar is LL(1)
B: Every regular expression is LR(1)
Which of the following stament is True
A is true and B is False
A is True and B is True
A is False, B is True
A is False and B is False
The main purpose of Lexical analyser
Improve the register allocation
The split whole inofrmation into small chunk
To understand syntax of the code
To undertand the meaning of code
The Parsing is assoicated with
Graph coloring
DFA minimization
Production tree
Post-order Traversing
Which of the follwing is not application of Syntax directed translation
Creating Syntax tree
Converting infix to Postfix
Creating parsing Table
Evaluating the arithmentic expression
E-->E#T / T (# means *)
T--> T$F/F ($ means + )
F--> id (id means numerical value)
With the help of above grammar, calculate 2#3$5 using bottom up parsing
16
30
25
None of the above
Consider the follwing grammar:
S--> FR
R--> *S/ ϵ
F-->id
In the LL(1) parsing table i.e. M , the entries of M[F,id] and M[R,$] are
S-->FR
and
R--> ϵ
S-->FR
and
noting
Nothing
and
R-->S
F-->id
and
R--> ϵ
Given Grammar:
E-->E+T/E
T-->F-T/F
F-->id
Which one of the follwing is TRUE
+ and - are left associative
+ and - are right associative
+ is right associative and
- is left associative
- is right associative and
+ is left associative
Grammar is
X-->xXYZ
Y--> y/z/ ϵ
Z-->x
What is follow of X
{Y}
{z}
{y,z}
{x,y,z}
Which of the following statement is/are correct
A: Canonical LR is powerful than LL(1)
B: LL(4) is powerful than LL(2)
C: SLR is more powerfull than Canonical LR
A and B
A,B and C
A and C
A only
Which of the following statement is True
LALR is more powerful than CLR
CLR is more powerful than LALR
Both have same power
CLR cannot be compared with LALR
An LALR can have Shift-Reduce confict if and only if
LR(0) have Shift-reduce conflict
SLR have Shift-reduce conflict
CLR have Shift-reduce conflict
None of the above
A grammer can be solve sovle by operator precedence parser if and only if
It remove left recursion
it remove left factoring
In between two non-terminal there is a terminal
None of the above
