Consider the following statements.

S1: Symbol table is accessed only during lexical analysis and syntax analysis.

S2: Errors “a variable is used before its declaration” are detected in semantic analysis phase.

Select the correct option.

Both S1 and S2 are true.
S1 is true while S2 is false.
S1 is false while S2 is true.
Both S1 and S2 are false.
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Consider the following statements.

S1: Context free grammar can be used for both lexical analysis and syntax analysis.

S2: Type checking is done by lexical analyser, i.e, type checking is done before parsing phase.

Select the correct option.

Both S1 and S2 are true.
S1 is true while S2 is false.
S1 is false while S2 is true.
Both S1 and S2 are false.
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Match the following according to input (from the left column) to the compiler phase (in the right column) that processes it:

P-iv, Q-ii, R-i S-iii
P-i, Q-ii, R-iv S-iii
P-ii, Q-i, R-iv S-iii
P-iv, Q-i, R-ii S-iii
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Match the items of group 1 to the corresponding item of group 2

P-iv, Q-ii, R-i S-iii
P-i, Q-ii, R-iv S-iii
P-ii, Q-i, R-iv S-iii
P-iv, Q-i, R-iii S-ii
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
The output of lexical analyser is a stream of ____________

Lexemes
Patterns
Tokens
Strings
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Consider the grammar defined by following production rules with two operators * and %

S→A%B

A→ C | A*C

B→D%B | D

C→id

D→id

Select the correct option

% is left associative while * is right associative
% is right associative while * is left associative
Both % and * are left associative
Both % and * are right associative
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the following grammar

S→SA | A

A→T | a

T→TA | ϵ

Select the wrong option

First(S)=First(A)=First(T).
Follow(S)= Follow(A)=Follow(T).
Follow(A) will contain a also.
First(A) ={a}.
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the following grammar:

A→Ax | yA | y

How to convert the given grammar into LL(1) grammar.

eliminate left recursion
eliminate left factoring
eliminate both (left factoring and left recursion)
eliminate ambiguity
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the following string: “pqppqppqpqpqqpppqppq” and its tokenization: $ pqpp $ qp $ pqpqp $ qqp $ pp $ qp $ p$ q $

Note: String between two $ is considered as one token, for ex: $pqpp$ is one token.

Select the regular expression which breaks the given string into the given tokens.

(p*q*q*)*
(pq)*p*(qp)*q*
(pq)*pp* + q*p +p+q
None of these
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
The attributes of three arithmetic operators in some programming language are given below.

2021
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
Consider the Line 3 of the following C- program

int main ( ) { /*Line 1*/

int A, B; /*Line 2*/

fro (A=0, A<B, A++); /*Line 3*/

}

Identify the compilers response for line 3 while creating the object code.

No compilation error
Only Lexical error
Only Syntax error
Both Lexical and syntax error
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the following C program.

Void main()

{

int final-value;

int num=2;

int Total=5;

int 1var=2;

5=num;

total=Num*1;

if(total=5)

{

total=total+1

}

}

Choose the correct option, about the errors in this program.

Two lexical error, one syntax error, one semantic error.
Three lexical error, two syntax error, one semantic error.
Two lexical error, one syntax error, two semantic error.
Three lexical error, one syntax error, two semantic error.
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the following grammar

S→Aw | x

A→Ay | Sz |y

The resulting grammar after elimination left recursion

S→Aw | x & A→SzA’ | yA’ & A’→yA’ | ϵ
S→Aw | x & A→xzA’ | yA’ & A’→yA’ |wzA’ | xA’| ϵ
S→Aw | x & A→ xzA’ | yA’ & A’→yA’ | wzA’|ϵ
None of these
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the following grammar

S→S+S | S×S | id | ϵ

Select the option which is not correct.

The grammar is ambiguous.
The grammar is ambiguous hence cannot be parse by LR(1) parser.
The grammar is ambiguous but it can be parse by operator parser.
The grammar is ambiguous hence cannot be parse by any LL(k) parser, for any value of k.
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the regular expressions A=(ϵ+0+1) and B=(0+1). Select the regular expression which does not generate set of all strings of length exactly 4.
B^4
A^4 –A^3
A^4 –B^3
All of the above
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66