1. Complier Design
Class : M.Sc CS
1. A --------------- is a program that accepts a program written in one programming language
and produces output in another language.
a. compiler b. interpreter
c. assembler d. translator
2. Portions of one or more phases are combined into a module is called a --------.
a. pass b. coroutine
c. subroutine d. synthesis
3. The ----------- is the interface between the source program and the compiler.
a. lexical analyzer b. scanner
c. syntax analyzer d. both a and b
4. A large block of storage that may be partitioned into smaller blocks is known as --------.
a. linked list b. tree
c. heap d. compaction
5. The symbol Sigma is used to denote ---------.
a. empty b. alphabet
c. characters c. summation
6. The expression (aa/bb/ba/bb)* denotes all strings of -------.
a. odd b. even
c. zero d. all of the above
7. ----------- is a program that accepts a string x and say ‘yes’ if x is a sentence and ‘no’
otherwise.
a. DFA b. NFA
c. automataon d. recognizer
8. A notation which is suitable for describing tokens is known as ----------.
a. regular expression b. transition diagram
c. context-free grammar d. regular grammar
9. No transition on empty input is the property of
a. NFA b. DFA
c. BNF d. NDFA
10. The set of all strings generated by the expression aa*/bb* is
a. {a,aa,aaa,...} b. {b,bb,bbb,...}
c. both a and b d. either a or b
2. 11. The syntactic structure of a programming language is described by ---------------.
a. context-free grammar b. regular grammar
c. context-sensitive grammar d. phrase-structure grammar
12. The word ‘token’ is a synonym for -------------.
a. start symbol b. production
c. nonterminal d. terminal
13. Graphical representation of derivations is said to be ----------.
a. syntax tree b. binary tree
c. search tree d. parse tree
14. A grammar that produces more than one parse tree for some sentence is called ----------.
a. ambiguous grammar b. unambiguous grammar
c. regular grammar d. context-free grammar
15. The string ‘w’ denotes the string of terminals is called ----------.
a. sentential form of G b. sentence
c. leftmost derivation d. rightmost derivation
16. The process of replacing the right side of production with the left side is known as --------.
a. derivation b. construction
c. recognition d. reduction
17. A rightmost derivation in reverse is obtained by -----------.
a. handle b. handle pruning
c. reduction d. all of the above
18. The symbol to mark the bottom of the stack and the right end of the of the input is -------.
a. # b. $
c. & d. @
19. A grammar with no production right side has two adjacent nonterminals is called --------.
a. operator grammar b. conditional grammar
c. LR grammar d. LR(k) grammar
20. ------------ cancause a top-down parser into an indefinite loop.
a. left-recursion b. right-recursion
c. backtracking d. pruning
21. A --------- does not need to scan the entire stack to know the handle that appears on top.
a. predictive parser b. top-down parser
c. bottom-up parser d. LR grammar
22. The most powerful and will work on a large class of grammar but expensive is -----------.
a. SLR b. canonical LR
c. LALR d. LR
3. 23. The function ------------ has two parameters namely state and grammar symbol.
a. GOTO b. ACTION
c. FIRST d. FOLLOW
24. A program fragment is attached with each production is called ---------------.
a. output action b. semantic action
c. semantic rule d. all of the above
25. Let AXYZ and {Y.VAL:=2*A.VAL }, then it is a kind of ------------- translation.
a. synthesized b. inherited
c. syntax directed d. both a and b
26. The postfix notation a*(b+c) is
a. abc+* b. bc+a*
c. abc*+ d. a*bc+
27. The three address statements T1:=B and C and T2:=A OR T1 represent the Boolean
expression
a. B and C or A b. A or B and C
c. B or C and A d. both a and b
28. A record structure with four fields to implement three address statements is called -------.
a. triples b. indirect triples
c. quadruples d. syntax trees
29. Listing of pointers to triples rather than triples is called ----------.
a. triples b. indirect triples
c. DAG d. flow graph
30. Subsequent filling of quadruples for Boolean expressions to which the jumps are to be
made is referred to as -------------.
a. makelist b. merge
c. backtracking d. backpatching
31. Which of the following data structure is not used to implement symbol table?
a. lists b. binary search trees
c. hash tables d. AVL trees
32. Which of the following is not true for error detection and recovery?
a. main task for compiler b. errors detected during lexical analysis
c. compiler retruns an error d. all of the above
33. A ------------ is the simplest to implement but the performance is poor.
a. linear list b. self organizing list
c. binary search tree d. hash table
4. 34. ------------- based on the property that no limit on the number of entries.
a. binary search trees b. lists
c. open hashing d. closed hashing
35. Performance of hashing is measured in time is
a. log2(n+e) b. cn(n+e)
c. n(n+e) d. n(n+e)/m
36. Single execution of a procedure is managed by
a. static allocation b. heap allocation
c. activation record d. stack allocation
37. -------------- allocation allocates and deallocates storage as needed at run time from a data
area.
a. static b. stack
c. heap d. both a and b
38. ----------- canbe detected during either compile time or runtime.
a. syntax error b. semantic error
c. runtime error d. logical error
39. ---------- can be detected at compile time.
a. syntax error b. semantic error
c. runtime error d. logical error
40. ------------- was designed to permit static storage allocation.
a. FORTRAN b. PASCAL
c. C d. JAVA
41. Optimize code by
a. dead code elimination b. common subprograms
c. data flow analysis d. loop declaration
42. The optimization which avoids test at every iteration is
a. loop unrolling b. loop jamming
c. constant folding d. all of the above
43. A graph that shows basic blocks and their successor relationship is called
a. DAG b. flow graph
c. labelled graph d. acyclic graph
44. ---------- moves code outside the loop.
a. code motion b. code elimination
c. loop invariant d. loop optimization
5. 45. Reduction in strength means
a. moving code outside the loop b. expensive operation by cheaper one
c. eliminating common subexpression d. induction variable elimination
46. --------- is used for analyzing basic blocks automatically.
a. DAG b. flow graph
c. acyclic graph d. labelled graph
47. ------------- optimization examining a short sequence of target code.
a. loop b. local
c. peephole d. code
48. The input of the code generation algorithm is
a. postfix notations b. syntax trees
c. quadruples d. three address code
49. --------------- keeps track of the location where the current value of the name can be found.
a. register descriptor b. address descriptor
c. register d. all of the above
50. A leader in basic block means
a. first statement of basic block
b. target of conditional and unconditional goto
c. any statement that follows a goto or unconditional go to
d. all of the above
##################