At&cd
At&cd
MULTIPLE CHOICE
5. What characteristic of RAM memory makes it not suitable for permanent storage?
a) Too slow b) Unreliable c) It is volatile d) Too bulky
ANS: C PTS: 1
12. A group of bits that tell the computer to perform a specific operation is known as ________
a) Instruction code b) Micro-operation c) Accumulator d) Register
ANS: A PTS: 1
14. S -> CC
C -> cC | d
The grammar is
a) LL(1) c) LALR(1) but not SLR(1)
b) SLR(1) but not LL(1) d) LR(1) but not LALR(1)
ANS: A PTS: 1
ABCD
a) 2 3 1 4 c) 2 4 1 3
b) 2 1 4 3 d) 2 3 4 1
ANS: C PTS: 1
20. What is the maximum number of reduce moves that can be taken by a bottom-up parser for a
grammar with no epsilon- and unit-production to parse a string with n tokens?
a) n/2 b) n-1 c) 2n-1 d) 2^n
ANS: B PTS: 1
24. If a state does not know whether it will make a shift operation or reduction for a terminal is
called _________
a) Shift/reduce conflict c) Shift conflict
b) Reduce /shift conflict d) Reduce conflict
ANS: A PTS: 1
25. The construction of the canonical collection of the sets of LR (1) items are similar to the construction
of the canonical collection of the sets of LR (0) items. Which is an exception?
a) Closure and goto operations work a little c) Closure and additive operations work a
bit different little bit different
b) Closure and goto operations work d) Closure and associatively operations work
similarly a little bit different
ANS: A PTS: 1
27. In the correct grammar above, what is the length of the derivation (number of steps starting
from S to generate the string a l b m with l ! m?
a) max (l, m) + 2 b) l+m+2 c) l + m + 3 d) max (l, m) + 3
ANS: A PTS: 1
28. Some code optimizations are carried out on the intermediate code because _______________
a) They enhance the portability of the complier to other target processors
b) Program analysis is name accurate on intermediate code than on machine code
c) The information from data flow analysis cannot otherwise be used for optimization
d) The information from the front end cannot otherwise be used for optimization
ANS: B PTS: 1
30. An LALR(1) parser for a grammar can have shift-reduce (S-R) conflicts if and only if
___________
a) The SLR(1) parser for G has S-R conflicts
b) The LR(1) parser for G has S-R conflicts
c) The LR(0) parser for G has S-R conflicts
d) The LALR(1) parser for G has reduce-reduce conflicts
ANS: B PTS: 1
31. Which of the following techniques is used to replace run-time computations by compile time
computations?
a) constant folding b) code hoisting c) peephole d) invariant
optimization computation
ANS: D PTS: 1
32. What data structure in a complier is used for managing information about variables and their
attributes?
a) Abstract syntax tree c) Semantic stack
b) Symbol table d) Parse table
ANS: B PTS: 1
33. The lexical analyzer takes _________ as input and produces a stream of _______ as output.
a) Source program, tokens c) Either A and B
b) Token, source program d) None of the mentioned
ANS: A PTS: 1
34. The action of parsing the source program into proper syntactic classes is called ________
a) Syntax analysis c) Interpretation analysis
b) Lexical analysis d) General syntax analysis
ANS: B PTS: 1
40. Substitution of values for names (whose values are constants) is done in----------
a) Local optimization c) Constant folding
b) Loop optimization d) Strength reduction
ANS: C PTS: 1
44. Which part of the compiler highly used the grammar concept?
a) Code optimization c) Parser
b) Code generation d) Scanner
ANS: C PTS: 1
45. Leaf nodes in a parse tree indicate?
a) sub-terminals b) half-terminals c) non-terminals d) terminals
ANS: D PTS: 1
46. Which graph describes the basic block and successor relationship?
a) Control graph c) DAG
b) Flow graph d) Hamilton graph
ANS: B PTS: 1
48. The value of which variable is updated inside the loop by a loop-invariant value?
a) loop c) induction
b) strength d) invariable
ANS: C PTS: 1
49. Which compiler runs on one machine and generates code for multiple machines?
a) Multipass b) Optimizing c) Cross compiler d) Onepass compiler
compiler compiler
ANS: C PTS: 1
50. Which method merges the multiple loops into the single one?
a) Loop fusion or b) Constant Folding c) Loop rolling d) None of the above
jamming
ANS: A PTS: 1
54. _________ register keeps track of the instructions stored in program stored in memory.
a) AR (Address Register) c) PC (Program Counter)
b) XR (Index Register) d) AC (Accumulator)
ANS: C PTS: 1
56. Which of the following term is used to keep track of the location where the current values of the name
are stored?
a) Register descriptor c) Allocation descriptor
b) Address descriptor d) Flag register
ANS: B PTS: 1
ANS: C PTS: 1
61. Substitution of values for names (whose values are constants) is done in
a) Local optimization c) Constant folding
b) Loop optimization d) Strength reduction
ANS: C PTS: 1
ANS: D PTS: 1
ANS: D PTS: 1
64. The graph that shows basic blocks and their successor relationship is called:
a) DAG b) Control graph c) Flow graph d) Hamiltonian
graph
ANS: C PTS: 1
65. Identify the technique used to replace run-time computations with compile-time computations.
a) Code Hosting c) Invariant Computation
b) Peephole Optimization d) Constant Folding
ANS: D PTS: 1
71. Any instruction that follows conditional and unconditional jumps is _________
a) leader c) header
b) jump d) first
ANS: A PTS: 1
74. Code optimization & generation phases are often referred as _________
a) design phase c) optimization phase
b) back end d) front end
ANS: C PTS: 1