Lexical Analysis · Compiler Design · GATE CSE

Start Practice

Marks 1

1

Consider the following two sets:

Set X

P. Lexical Analyzer

Q. Syntax Analyzer

R. Intermediate Code Generator

S. Code Optimizer

Set Y

1. Abstract Syntax Tree

2. Token

3. Parse Tree

4. Constant Folding

Which one of the following options is the correct match from Set X to Set Y?

GATE CSE 2024 Set 2
2
In a compiler, keywords of a language are recognized during
GATE CSE 2011
3
Which data structure in a compiler is used for managing information about variables and their attributes?
GATE CSE 2010
4
Match all items in Group 1 with correct options from those given in Group 2.

Group 1

P. Regular expression
Q. Pushdown automata
R. Dataflow analysis
S. Register allocation

Group 2

1. Syntax analysis
2. Code generation
3. Lexical analysis
4. Code optimization
GATE CSE 2009
5
The number of tokens in the following C statement is:
printf("i = %d, &i = %x",i, &i);
GATE CSE 2000
6
Type checking is normally done during
GATE CSE 1998
7
In some programming languages, an identifier is permitted to be a letter following by any number of letters or digits. If L and D denote the sets of letters and digits respectively, which of the following expressions defines an identifier?
GATE CSE 1995
8
Which of the following strings can definitely be said to be tokens without looking at the next input character while compiling a Pascal program?

I. begin
II. program
III. <>

GATE CSE 1995
9
Match the following:

List - I

(a) Lexical Analysis
(b) Code Optimization
(c) Code Generation
(d) Abelian Group

List - II

(p) DAG's
(q) Syntax trees
(r) Push Down automata
(s) Finite automata
GATE CSE 1990
10
In a compiler the module that checks every character of the source text is called:
GATE CSE 1988

Marks 2

1

Consider the following C code segment:

a = b + c;

e = a + 1;

d = b + c;

f = d + 1;

g = e + f;

In a compiler, this code segment is represented internally as a directed acyclic graph (DAG). The number of nodes of nodes in the DAG is ______

GATE CSE 2021 Set 1
2
Which one of the following statements is FALSE?
GATE CSE 2018
3
A lexical analyzer uses the following patterns to recognize three tokens $${T_1},{T_2},$$ and $${T_3}$$ over the alphabet $$\left\{ {a,b,c} \right\}.$$

$$\eqalign{ & {T_1}:\,\,\,a?{\left( {b|c} \right)^ * }a \cr & {T_2}:\,\,\,b?{\left( {a|c} \right)^ * }b \cr & {T_3}:\,\,\,c?{\left( {b|a} \right)^ * }c \cr} $$

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?

GATE CSE 2018
4
Which one of the following grammars is free from $$left$$ $$recursion$$?
GATE CSE 2016 Set 2
5
Which of the following are true?

I. A programming language which does not permit global variables of any kind and has no nesting of procedures/functions, but permits recursion can be implemented with static storage allocation

II. Multi-level access link (or display) arrangement is needed to arrange activation records only if the programming language being implemented has nesting of procedures/functions

III. Recursion in programming languages cannot be implemented with dynamic storage allocation

IV. Nesting procedures/functions and recursion require a dynamic heap allocation scheme and cannot be implemented with a stack-based allocation scheme for activation records

V. Programming languages which permit a function to return a function as its result cannot be implemented with a stack-based storage allocation scheme for activation records

GATE CSE 2008
6
The number of tokens in the Fortran statement DO 10 I = 1.25 is
GATE CSE 1999
EXAM MAP
Medical
NEETAIIMS
Graduate Aptitude Test in Engineering
GATE CSEGATE ECEGATE EEGATE MEGATE CEGATE PIGATE IN
Civil Services
UPSC Civil Service
Defence
NDA
Staff Selection Commission
SSC CGL Tier I
CBSE
Class 12