Lexical Analysis

 Question 1
In a two-pass assembler, resolution of subroutine calls and inclusion of labels in the symbol table is done during
 A Second pass B first pass and second pass respectively C second pass and first pass respectively D first pass
ISRO CSE 2020   Compiler Design
Question 1 Explanation:
 Question 2
The number of tokens in the following C code segment is
 switch(inputvalue)
{
case 1 : b =c*d; break;
default : b =b++; break;
}
 A 27 B 29 C 26 D 24
ISRO CSE 2020   Compiler Design
Question 2 Explanation:
 Question 3
Consider the following statements.

I. Symbol table is accessed only during lexical analysis and syntax analysis.
II. Compilers for programming languages that support recursion necessarily need heap storage for memory allocation in the run-time environment.
III. Errors violating the condition 'any variable must be declared before its use' are detected during syntax analysis.

Which of the above statements is/are TRUE?
 A I only B I and III only C II only D None of I, II and III
GATE CSE 2020   Compiler Design
Question 3 Explanation:
 Question 4
A particular BNF definition for a "word is given by the following rules.
< word > :: =< letter > I < letter > < charpair > I < letter >< intpair >
< charpair > :: =< letter >< letter > I < charpair >< letter >< letter >
< intpair > :: = < integer >< integer > I < intpair >< integer >< integer >
< letter > :: = a I b I c I ......I Y I Z
< integer > :: = 0 I 1 I 2 I ......I 9
Which of the following lexical entries can be derived from < word >?
I. pick
II. picks
III. c44
 A I, II and III B I and II only C I and III only D II and III only
ISRO CSE 2018   Compiler Design
Question 4 Explanation:
 Question 5
A lexical analyzer uses the following patterns to recognize three tokens $T_{1}, T_{2}, \; and \; T_{3}$ over the alphabet {a,b,c}.

$T_{1}:a?(b|c)^* a$
$T_{2}:b?(a|c)^* b$
$T_{3}:c?(b|a)^* c$

Note that 'x?' means 0 or 1 occurrence of the symbol x. Note also that the analyzer outputs the token that matches the longest possible prefix.

If the string bbaacabc is processed by the analyzer, which one of the following is the sequence of tokens it outputs?
 A $T_{1}T_{2}T_{3}$ B $T_{1}T_{1}T_{3}$ C $T_{2}T_{1}T_{3}$ D $T_{3}T_{3}$
GATE CSE 2018   Compiler Design
Question 5 Explanation:
 Question 6
The output of a lexical analyzer is
 A A parse tree B Intermediate code C Machine code D A stream of tokens
ISRO CSE 2017   Compiler Design
Question 6 Explanation:
 Question 7
Yacc stands for
 A yet accept compiler constructs B yet accept compiler compiler C yet another compiler constructs D yet another compiler compiler
ISRO CSE 2015   Compiler Design
Question 7 Explanation:
 Question 8
The number of tokens in the following C statement is
 printf("i=%d, &i=%x", i, &i);
 A 3 B 26 C 10 D 21
ISRO CSE 2015   Compiler Design
Question 8 Explanation:
 Question 9
A symbol table of length 152 is processing 25 entries at any instant. What is occupation density?
 A 0.164 B 127 C 8.06 D 6.08
ISRO CSE 2011   Compiler Design
Question 9 Explanation:
 Question 10
Number of comparisons required for an unsuccessful search of an element in a sequential search organized, fixed length, symbol table of length L is
 A L B L/2 C (L+1)/2 D 2L
ISRO CSE 2011   Compiler Design
Question 10 Explanation:
There are 10 questions to complete.

6 thoughts on “Lexical Analysis”

1. everything is fantastic but facebook,whatsapp,telegram,and linkedin icon are in wrong position kindly change it’s position

• Thank you for your concern. We will try to work on it.