cd bits
cd bits
MULTIPLE CHOICE
1. What is a compiler
a. system program that converts instruction c. System program that writes instruction to
to machine Language perform
b. system program that converts machine d. none of the mentioned
Language into high level ;anguage
ANS: A PTS: 1
2. Does the compiler program translate the whole source code in on step
a. No c. depending on the compiler
b. Dont know d. Yes
ANS: D PTS: 1
4.
A programmer, writes a program to multiply two numbers instead of dividing them by
mistake, how can this error be detected?
a. Compilers or interpreter c. interpreter only
b. Compiler only d. none of the above mentioned
ANS: D PTS: 1
5. Which tool is used for groupin gof characters in tokens in the compiler
a. Parser c. Code Optimizer
b. Code Generator d. Scanner
ANS: D PTS: 1
6. What is a Linker
a. It is always used before the program c. It is the same as the loader
execution
b. It id required to create the load module d. None of the above
ANS: B PTS: 1
8.
In a compiler Lexical Analyzer is used for?
a. Removing Comments c. Removing white space
b. Breaking syntaxes into tokens d. All the above
ANS: D PTS: 1
10.
Which of the following is not a characteristics of compiler
a. More Execution time c. The execution takes place afet the
removal of all syntax errors
b. Debugging process is slow d. First scans the entire program and then
transform it into machine
understandable code
ANS: A PTS: 1
11. Which compiler runs on one machine and generates code for multiple machines
a. Multipass Compiler c. Cross compi;er
b. Optimizing Compiler d. One pass compiler
ANS: C PTS: 1
12. Which phase of the compiler checks the grammar of the programming?
a. Code Optimization c. Semantic Analysis
b. Syntax Analysis d. Code Generation
ANS: B PTS: 1
17. If the Lexical analysis finds a lexeme with the same name as that of a reserved words it____
a. Overwrites the word c. Generated an error
b. Overwrites the functionality d. something Else
ANS: C PTS: 1
19. Which among the following is not a tool to construct lexical analyzer from a regular expression
a. LEX c. jflex
b. flex d. None of the above
ANS: D PTS: 1
20. Lexers and parsers are not found in which of the following?
a. Compiler Front end processing c. Linkers
b. Pretty Printers d. None of the above
ANS: D PTS: 1
21. Which of the followoing characters are ignored while lexical analysis
a. . c. =
b. # d. white space
ANS: D PTS: 1
22. Which of the following phase of the compiler involves type checking
a. Parsing c. Scanning
b. Syntax Directed Translation d. Semantic Analysis
ANS: B PTS: 1
23. When the expression sum=3+2 is tokenized then what is the token category of 3?
a. Identifier c. Assignment Operator
b. Integer Literals d. Addition operator
ANS: B PTS: 1
25. Lexer are often generated by leer generators, same as parser generators
a. True b. False
ANS: A PTS: 1
26. The number of tuples in the Finite State Machines are
a. 2 c. 5
b. 4 d. 6
ANS: C PTS: 1
31. The number of final states required to accept accept Φ in minimal finite automata
a. 1 c. 3
b. 2 d. None
ANS: D PTS: 1
32. The regular expression of all strings starts with ab and ends with bba is
a. aba*b*bba c. ab(a+b)*bba
b. ab(ab)*bba d. All
ANS: C PTS: 1
ANS: A PTS: 1
37. A system program that brings together separately compiled modules of a program into a
form language that is suitable for execution.
a. Assembler c. Cross Compiler
b. Linking Loader d. None of the above
ANS: B PTS: 1
45. Which phenomenon happens when the non-terminal on the left side is repeated as the first
symbol on the right side?
a. Left Most Derivation c. Left Recursion
b. Left factoring d. Left Parsing
ANS: C PTS: 1
46. In which derivation the right-most non-terminal symbol is replaced at each step?
a. Right Lookahead c. Right Lexeme
b. Right Most Symbol d. Right Non Terminal
ANS: B PTS: 1
49. Which among the following parser is the most powerful one?
a. SLR c. CLR
b. LALR d. LR(0)
ANS: C PTS: 1
50. Which Grammar gives multiple parse tree for the same string
a. Unambigous Grammar c. Regular Grammar
b. Ambigous Grammar d. All the above
ANS: B PTS: 1
57. To derive a string using the production rules of a given grammar, we use
a. Scanning c. Derivation
b. Parsing d. All the above
ANS: B PTS: 1
58. Which of the following parser reaches the root symbol of the tree at last?
a. Top doen Parser c. Both a and b
b. Bottom up parser d. None
ANS: B PTS: 1
68. The grammar can be defined as G={V,T,P,S}, What does ‘S’ repesents
a. Accepting State c. Sensitive grammar
b. Starting Variable d. none
ANS: B PTS: 1
ANS: D PTS: 1
72. 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 c. Closure and additive operations work a
little bit different little bit different
b. Closure and goto operations work d. Closure and associatively operations
similarly work a little bit different
ANS: A PTS: 1
73.
When ß is empty (A -> ß.,a), the reduction by A-> a is done by _________
a. If next symbol is a terminal c. Only If the next input symbol is A
b. Only If the next input symbol is a d. None of the above
ANS: B PTS: 1
74. 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
75.
Which of the following is incorrect for the actions of A LR-Parser I) shift s ii) reduce A->ß
iii) Accept iv) reject?
a. Only I) c. I), ii) and iii)
b. I) and ii) d. I), ii) , iii) and iv)
ANS: C PTS: 1
76.
Which of these is true about LR parsing?
a. Is most general non-backtracking c. s most general non-backtracking
shift-reduce parsing shift-reduce parsing & It is still
efficient
b. It is still efficient d. None of the mentioned
ANS: C PTS: 1
79.
Which of these is also known as look-head LR parser?
a. SLR c. LLR
b. LR d. None of the above
ANS: C PTS: 1
80.
Which of the following describes a handle (as applicable to LR-parsing) appropriately?
a. Position where next reduce or shift c. Used for reduction in a coming-up
operation will occur step along with a position in the
sentential form where the next shift or
reduce operation will occur
b. The next step has use of Non-terminal d. Used in the next step for reduction
for reduction along with a position in the sentential
form where the right hand side of the
production may be found
ANS: D PTS: 1
82.
Which one of the following is true at any valid state in shift-recuce parsing?
a. At the bottom we find the prefixes c. Stack contains ony viable prefixes
b. None d. Stack consists of viable prefixes
ANS: C PTS: 1
85. Assume that SLR parser for a grammar G has n1 states and LALR parser for G has n1 states
a. n1 is necessarily less than n2 c. n1 is necessarily greater than n2
b. n1 is necessarily equal to n2 d. None of the mentioned
ANS: B PTS: 1
86. Which of the following suffices to convert an arbitrary CFG to an LL(1) Grammar?
a. Removing Left recursion only c. Factoring & left recursion removal
b. Factoring of the Grammar alone d. None
ANS: D PTS: 1
87. The grammar A->AA/(A)/e is not suitable for predictive parsing because the grammar is
a. Ambigous c. Right Recursive
b. Left Recursive d. An operator grammar
ANS: B PTS: 1
96. Which of the following is incorrect for the actions of A LR-Parser I) shift s ii) reduce A->ß iii)
Accept iv) reject?
a. Only I c. I, ii and iii
b. I and ii d. I, ii , iii and iv
ANS: C PTS: 1
97. 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
99. When ß (in the LR(1) item A -> ß.a,a) is not empty, the look-head ________
a. Will be affecting c. Shift will take place
b. Does not have any affect d. Reduction will take place
ANS: B PTS: 1
100. 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