one mark
one mark
,cs
UNIT-I
5. Compiler
6. a* means
c. {a,aa,aaa,aaa} d. {a,aa,aaa,aaa,...}
7. a+ means
c. {a,aa,aaa,aaa} d. {a}
8. token for If is
10. A compiler is
a. A program that place program into memory and prepares them for execution
b. A program that automates the translation of assembly language into machine
language
👍🏻 c. program that accepts program written in high level language and produces an
object program
d. A program that appears to execute a source program as if it were machine
language
13. The concept of grammar is much used in this part of the compiler
18. A system program that combines the separately compiled modules of a program
into a form suitable for execution?
a) Assembler b) Compiler
👍🏻c) Linking Loader d) Interpreter
19. Which of the following system software resides in the main memory always
a) Text Editor b) Assembler
c) Linker 👍🏻d) Loader
20. System program such as Compiler are designed so that they are __________
A. Recursive B. Non-reusable
C. Serially usable 👍🏻D. Re-enterable
0. a)Low-level Language
a. 0b)High-Level Language
b. c)Decimal-Format
c. d)Middle-Level Language
23.Does the compiler program translate the whole source code in one step?
0. a)No
a. b)Depends on the Compiler
b. c)Don't Know
c. 0d)Yes
a) keyword
b) string
c)Id
0d) literal
a) syntax
b) lexical
0c) testing
d) code generation
a) parser
c) developer
d) Analyst
a)character by character
0b)line by line
c)page by page
d) module wise
0a)token
b)parse tree
c)code
d) object code
30. Compiler
UNIT II
1. A grammer gives ……… specification of a programming language.
a) Semantic b) concise 0c) syntactic d) consistent
2. The basic symbols of strings in a language are composed of
a) Symbol tables 0b) terminals c) symbols d) symbolic language
3. Lowercase letters are categorized as
a) Terminals 0 b) non terminals c) start symbols d) production
4. A graphical representation for derivations called a
a) Ans. Parse tree b) grammar c) ambiquity d) flowchart
5. A grammar that produces more than one parse tree for a sentence is said to be
a) Unambiguous 0b) ambiguous c) confused grammar d) illegal grammar
6. Exponentiation operator is ………….. associative
a) Left 0b) right c) neither right nor left d) both
7. A parser accepts string w as input and produces output as
a) Syntax tree b) binary tree 0c) parse tree d) primary tree
8. A rightmost derivation in reverse called a
a) Parse tree 0 b) canonical reduction c) error d) right sentential form
9. A grammar for which we can construct a parsing table in which every entry is
uniquely defined is called
a) SLR parser 0b) predictive parser c) LR parser d) LALR parser
10.Which one is a non terminal?
a) if b) id c) digits 0d) start symbol
11. a<.b implies
a) a is less than b b) a has smaller value than b 0c) a yields precedence to b
d) a takes precedence over b
12. In an error action of shift reduce parsing, the parser calls
0a) an error recover routine b) a function c) a method d) a recursive
function
13. All keywords are
a) non terminals 0b) terminals c) start symbol d) both terminal and non
terminal
14. Backtracking problem is usually occurred in
a) shift reduce parsing b) operator precedence parsing 0c) top down parsing
d) handle pruning
15. When the statements s…>cAd and a…..>ab, then S can be replaced as:
0a) s….>cabd b) s…..>cad c) s……….> cababd d) s………..> cab
16. ……… parser is an efficient way of implementing recursive descent parsing
a) shift reduce b) topdown c) operator precedence 0d) predictive
17. FIRST and FOLLOW are the functions used in ………… algorithm
0a) predictive b) shift c) topdown d) all
18. A method used to manipulate on grammars to make it suitable for recursive
descent
Parsing is
a) Handle pruning 0b) left factoring c) canonical reduction d) right
factoring
19. The reserved word if is considered to be as
a) nonterminal 0b) terminal c) start symbol d) keyword
20. The parsing technique used to reduce the right sentential form is
a) recursive descent parsing 0 b) shift reduce parsing c) top down parsing
d) bottom up parsing.
29.__________ checks whether the parse tree constructed follows the rules of a
language.
a)Syntax Analysis
0b) Semantic Analysis
c)Lexical Analysis
d) None of the above
30.Which of the following is/are advantage(s) of Compiler Technology?
a) Parsers for HTML in web browser
b) Software testing
c) Malicious code detection
0d) All of the above
UNIT-III
1. intermediate code form is
a) Postfix Notation b) Syntax Trees
c) Three address 0d) All of the mentioned
5.What data structure in a complier is used for managing information about variables
and their attributes?
a) Abstract syntax tree 0 b) Symbol table
c) Semantic stack d) Parse table
6.Compiler translates the source code to
A. Executable code B. Machine code
C. Binary code 0D. Both B and C
10.In a single pass assembler, most of the forward references can be avoided by
putting the restriction
A.on the number of strings/life reacts
0 that the data segment must be defined after the code segment.
b
B.
C.on unconditional rump.
D.None of these
B.a permanent table of decision rules in the form of patterns for matching with the
uniform symbol table to discover syntactic structure.
C.Both (a) and (b)
D.a permanent table which lists all key words and special symbols of the language
in symbolic form.
15. The action of parsing the source program into proper syntactic classes is called
a) Syntax analysis 0b) Lexical analysis
c) Interpretation analysis d) General syntax analysis
16. Which languages necessarily need heap allocation in the runtime environment?
a) Those that support recursion
b) Those that use dynamic scoping
0c) Allow dynamic data structure
d) Those that use global variables
19. . The postfix form of the expression (A+ B)*(C*D- E)*F / G is?
a) *AB/CD+ 0 b) AB*CD/+
c) A*BC+/D d) ABCD+/*
22. In which of the following tree, the leaf indicates the operand, and the interior node
represents the operator.
0. Ans.Syntax tree
a. Parser tree
b. Structured tree
c. Sematic tree
0. Ans.3- address
a. 2-address
b. address
c. Intermediate code
0. Parse table
a. Ans.Input
b. Output
c. Input-Output
25. Which of the following function is called the canonical collection of LR(0) item.
0. Ans.FIRST
a. GOTO
b. COMPUTE
c. FOLLOW
26. Which of the following option is not a function of the shift-reduce parser?
0. Reduce
a. Accept
b. Ans.Go
c. Shift
21. The information about data is entered into a data structure is called
a) transition table 0b) symbol table c) data table d) information table
22. The third phase of a compiler is
a) code generation b) syntax analysis c) lexical analysis 0d) intermediate code
generation
23. The simplest and easiest way to implement the data structure for a symbol table is
a) search trees b) selft organizing lists 0c) lists d) hash tables
24. In a hashing scheme, hash table and ……….. table are used
0a) storage b) link c) data d) symbol
25. Stack pointer always points to a particular position in the ……. record for
currenctly
active procedure
b) Previous 0b) activation c) deleted d) new
26. One of the primary issues in the symbol table is
0 a) format of the entries b) data type c) value of the data d) validity of the data
27. A record consists of a known number of consecutive ………. of memory
a) data b) bytes 0c) words d) bits
28. A compiler is designed to run in less space if the space is ……….. in subsequent
passes
b) Deleted b) exchanged c) shared 0d) reused
29.The main dis advantage in lists is
a) poor performance 0b) slow c) not popular d) fastness
30. The major drawback of self organizing list is
a) not efficient b) not reliable 0 c) time & space d) not flexible
UNIT V
1. An alternate term for code optimization is
a) code compilation b) code translation c) code developing 0d) code
improvement
2. Code optimization techniques are applied
0a) after syntax analysis b) before syntax analysis c) before aligning d) after
compilation
3. It is used to portray the basic blocks and their successor relationships by a directed
graph
a) Simulated graph 0b) flow graph c) flowchart d) transition diagram
4. When the value of a variable is changing at each step in a loop called
a) undefined variable b) undeclared variable c) uninitialized variable 0d)
induction
variable
5. The replacement of an expensive operation by a cheaper one is termed as
a) cheaper operation b) inexpensive operation 0c) reduction in strength d)
replaced
operation
6. In ……… we take a computation that yields the same result independent of the
number of times in a loop
a) Ans. code motion b) code invariant c) loop invariant d) invalid code
7. A statement that quits the loop based on some condition satisfied called
a) unconditional jump 0b) conditional jump c) conditional skip d)
unconditional
skip
8. One of the problem in code generation phase is
0a) what registers to use b) how to write a code c) how to compile d) how to
clear
errors
9.The major advantage of using registers is
a)| easy to implement b) it simplifies the design of a compiler c) inexpensive
0 d) easy to use
10. The major drawback of using registers is
a) lack of memory space 0b) inefficient use of registers c) costly d) not
sufficient
11. Unconditional jump may results in
0a) unreachable code b) unnecessary skips c) unwanted code d) unreliable
code
12. A technique that deals with optimizing the intermediate or object code is
a) loophole optimization b) object code generation 0c) peephole optimization
d) code reduction
13. Multiple jumps results in
a) optimized code b) time delay 0c) efficient code d) faster code
14. Redundant loads and stores results in
a) efficient run 0b) wasted time and space c) good algorithm d) efficient
programming
15. An approach to keep frequently used name in a fixed register throughout the loop
Called
a) Ans. Global register allocation b) inner loop c) local variable d) inner
variable
16. Conditional statements are used in
a) program b) global registers 0c) loops d) global variables
17. ………… that keeps track of the local of current value of a variable at runtime
a) address block b) stack c) pointer 0d) address descriptor
18. Good code generation depends on
a) programmer 0b) hardware factors c) user manual d) software engineer
19. In IBM System/370 machines, which one is the multiplication instruction?
0a) M X, Y b) MUL X, Y c) MUL Y, X d) PROD X, Y
20. The instruction MOV R0, R1 implies
0a) copies R1 into R0 b) moves R1 into R0 c) copies R0 into R1 d) moves
R0
into R1
…………………………………………………………………………………………
ANSWER KEY
UNIT I
1. c. testing
2. c. lexical analyser
3. b. line by line
4. a. token
5. c. both a and b
6. a. {epsilon, a, aa,….}
7. b. {a,aa,…}
8. c. if
9. d. literal
10. c. program that accepts program written in high level language and
produces an object program
11. b. parse tree
12. d. all the above
13. b. parser
14. a. lexical analysis
15. a. syntax analysis
16. b. divided into two halves
17. b. intermediate code generation
18. c. linking loader
19. d. loader
20. d. re-enterable
21.c) is required to create a load module
22.b)high-level language
23.d)yes
24. d) literal
25.b)object file
26. c) testing
27. b) lexical analyzer
28.b)line by line
29.a)token
30. c) both a and b
UNIT II
1. c) syntactic
2. b) terminals
3. b) non terminals
4. a) parse tree
5. b) ambiguous
6. b) right
7. c) parse tree
8. b) canonical reduction
9. b) predictive parser
10. d) start symbol
11. c) a yields precedence to b
12. a) an error recover routine
13. b) terminals
14. c) top-down
15. a) s-🡪cabd
16. d) predictive
17. a) predictive
18. b) left factoring
19. b) terminal
20. b) shift reduce parsing
21. b) concise
22 .d) symbolic language
23. c) Both LL(1) but not LR(1) & LR(1) but not LR(1)
UNIT III
21.b.Quadruples
22.a.Syntax tree
23.a.3- address
24.b.Input-Output
25.a.GOTO
26.c.Go
27.c.Operator
28.d) All of the mentioned
29. d) All of the mentioned
30. d) Cryptographic procedures are not available for dynamic linking
UNIT IV
1. d)hash table
2. d) intermediate code generation
3. c) lists
4. a) storage
5. b) activation
6. a) format of the entries
7. c) words
8. d) reused
9. b) slow
10. c) time and space
11. b) static link
12. d) stops all activities when an error is occurred
13. a) repairs the error
14. c) attempts to correct the erroreous input
15. d) min(a, 2*(3+b)
16. a) algorithmic error
17. b) semantic error
18. c) dynamic error
19. d) panic
20. b) minimum hamming distance
21. b) symbol table
22. d) intermediate code generation
23. c) lists
24. a) storage
25. b) activation
26. a) format of the entries
27. c) words
28. d) reused
29. b) slow
30. c) time and space
UNIT V
1. d) code improvement
2. a) after syntax analysis
3. b) flow graph
4. d) induction variable
5. c) reduction in strength
6. a) code motion
7. b) conditional jump
8. a) what registers to use
9. d) easy to use
10. b) inefficient use of memory
11. a) unreachable code
12. c) peephole optimization
13. c) time delay
14. b) wasted time and space
15. a) global register allocation
16. c) loops
17. d) address descriptor
18. b) hardware factors
19. a) M X, Y
20. a) copies R1 into R0
21. d) code improvement
22. a) after syntax analysis
23. b) flow graph
24. d) induction variable
25. c) reduction in strength
26. a) code motion
27. b) conditional jump
28. a) what registers to use
29. d) easy to use
30. b) inefficient use of memory
-------------------------------------------------------------------------------------------------------