Anda di halaman 1dari 4

Regulation: 2013

Academic year: 2015-2016

EX.NO:1

Implementation of Symbol Table

PRELAB QUESTIONS:
1. Which data structure in a compiler is used for managing information about variables and
their attributes?
(A) Abstract syntax tree
(B) Symbol table
(C) Semantic stack
(D) Parse Table
2. In a compiler, the data structure responsible for the management of information about
variables and their attributes is
(A) Semantic stack
(B) Parser table
(C) Symbol table
(D) Abstract syntax-tree
3. Which one of the following is NOT performed during compilation?
(A) Dynamic memory allocation
(B) Type checking
(C) Symbol table management
(D) Inline expansion
4. Symbolic names can be associated with
(A) Information
(B) data or instruction
(C) operand
(D) mnemonic operation
5. Pick the machine independent phase of the compiler?
(A) Syntax analysis
(B) Code generation
(C) Lexical analysis
(D) Intermediate code generation
(E) a,c and d
6. A program in execution is called
(A) Process
(B) Instruction
(C) Procedure
(D) Function
IFETCE/CSE/III Yr/VI Sem/CS6612/COMPILER /LAB MANUAL/VER 1.0
1

Regulation: 2013

Academic year: 2015-2016

7. A linker program
(A) places the program in the memory for the purpose of execution.
(B) relocates the program to execute from the specific memory area allocated to it.
(C) links the program with other programs needed for its execution.
(D) interfaces the program with the entities generating its input data.

POSTLAB QUESTIONS:
1. The error that can be pointed out by the compiler are
1.syntax errors
3.logical errors

2.semantic errors
4.internal errors

2. Context free language can be recognized by


A) finite state automation
B) push down automata

B)linear bounded automation


D) both (B) and (C)

3. Analysis which determines the meaning of a statement once its grammatical structure becomes
known is termed as
(A) Semantic analysis (B) Syntax analysis
(C) Regular analysis
(D) General analysis
4. Which of the following is used for grouping of characters into tokens?
(A) Parser
(B) Code optimization
(C) Code generator
(D) Lexical analyzer
5. Symbolic names can be associated with
(A) Information
(B) data or instruction
(C) operand
(D) mnemonic operation

IFETCE/CSE/III Yr/VI Sem/CS6612/COMPILER /LAB MANUAL/VER 1.0


2

Regulation: 2013

EX.NO:2

Academic year: 2015-2016

Develop a lexical analyzer to recognize a few patterns in C


(Ex. identifiers, constants, comments, operators etc.)

PRELAB QUESTIONS:
1. In a compiler _______________ checks every character of the source text.
(A) The lexical analyzer
(B) The syntax analyzer
(C) The code generator
(D) The code optimizer
2. In a compiler, when is the keyboards of a language are recognized?
(A) During the lexical analysis of a program
(B) During parsing of the program
(C) During the code generation
(D) During the data flow analysis
3. The task of the lexical analysis phase is
a) to parse the source program into the basic elements or token of the language
b) to build the literal table and an identifier table
c) to build a uniform symbol table
d) all of the above
4. The output of lexical analyzer is
a) to set of regular expressions
b) syntax tree
c) set of tokens
d) string of characters
5. In compilers generation of intermediate code based on an abstract machine model is
useful because
(A) Syntax-directed translations can be written for intermediate code generation
(B) To generate code for real machines directly from high-level language programs is not
IFETCE/CSE/III Yr/VI Sem/CS6612/COMPILER /LAB MANUAL/VER 1.0
3

Regulation: 2013

Academic year: 2015-2016

possible
(C) Portability of the front end of the compiler is enhanced
(D) Implementation of lexical and syntax analysis is easier
6. Count number of tokens in the given expression:intmax(inti);
(A) 5
(B) 7
(C) 4
(D) 8
POST LAB QUESTIONS:
1._________or scanning is the process where the stream of characters making up the source
program is read from left to right and grouped into tokens.
(A) Lexical analysis
(B) Diversion
(C) Modeling
(D) None of the above
2.Which of the following operators is incorrect and why?
(a) >=

(b) <=

(c) <>

(d) ==

3. Write a loop statement that will show the following output:


1
12
123
1234
12345
(a)
for (a=1; a<=5; i++) {
(b)
for (a=1; a<5; i++) {
for (b=1; b<=a; b++)
for (b=1; b<=a; b++)

}
}
(a)
for (a=1; a<=5; i++) {
(b)
for (a=1; a<5; i++) {
for (b=1; b<a; b++)
for (b=1; b<a; b++)

}
}
4.A character variable can at a time a store?
(a) 8 character
(b) 1 character (c) 254 character
(d) None
5. A C variable cannot start with?
(a) An alphabet
(b) A number

(c) A special symbol

(d) Both B and C

IFETCE/CSE/III Yr/VI Sem/CS6612/COMPILER /LAB MANUAL/VER 1.0


4