Exam 3: Compiler Construction and Parsing Algorithms
Exam 1: Formal Languages and Automata Theory: Part A25 Questions
Exam 2: Formal Languages and Automata Theory: Part B25 Questions
Exam 3: Compiler Construction and Parsing Algorithms24 Questions
Exam 4: Compilation and Programming Languages22 Questions
Select questions type
Which of the following statements are TRUE?
I. There exist parsing algorithms for some programming languages whose complexities are less than O( n3).
II. A programming language which allows recursion can be implemented with static storage allocation.
III. No L-attributed definition can be evaluated in the framework of bottom-up parsing.
IV. Code improving transformations can be performed at both source language and intermediate code level.
Free
(Multiple Choice)
4.7/5
(38)
Correct Answer:
B
Consider the following statements related to compiler construction :
I. Lexical Analysis is specified by context-free grammars and implemented by pushdown automata.
II. Syntax Analysis is specified by regular expressions and implemented by finite-state machine.
Which of the above statement(s) is/are correct?
Free
(Multiple Choice)
4.9/5
(34)
Correct Answer:
D
Which one of the following statements is FALSE?
Free
(Multiple Choice)
4.8/5
(34)
Correct Answer:
B
From the given data below : a b b a a b b a a b which one of the following is not a word in the dictionary created by LZ-coding (the initial words are a, b)?
(Multiple Choice)
4.9/5
(40)
The lexical analysis for a modern computer language such as Java needs the power of which one of the following machine models in a necessary and sufficient sense?
(Multiple Choice)
4.8/5
(40)
Which of the following statement(s) regarding a linker software is/are true?
I. A function of a linker is to combine several object modules into a single load module.
II. A function of a linker is to replace absolute references in an object module by symbolic references to locations in other modules.
(Multiple Choice)
4.8/5
(43)
The number of tokens in the following C statement is printf("i=%d, &i=%x", i&i);
(Multiple Choice)
4.8/5
(39)
Consider the grammar defined by the following production rules, with twooperators ? and +
S --> T * P
T --> U | T * U
P --> Q + P | Q
Q --> Id
U --> Id
Which one of the following is TRUE?
(Multiple Choice)
4.8/5
(36)
Consider the following statements:
(I) The output of a lexical analyzer is groups of characters.
(II) Total number of tokens in printf("i=%d, &i=%x", i, &i); are 11.
(III) Symbol table can be implementation by using array and hash table but not tree.
Which of the following statement(s) is/are correct?
(Multiple Choice)
4.7/5
(33)
Consider the following translation scheme. S ? ER R ? *E{print("*");}R | ? E? F + E {print("+");} | F F ? (S) | id {print(id.value);} Here id is a token that represents an integer and id.value represents the corresponding integer value. For an input '2 * 3 + 4', this translation scheme prints
(Multiple Choice)
4.9/5
(34)
Consider the following grammar. S -> S * E
S -> E
E -> F + E
E -> F
F -> id
Consider the following LR(0) items corresponding to the grammar above.
(i) S -> S * .E
(ii) E -> F. + E
(iii) E -> F + .E
Given the items above, which two of them will appear in the same set in the canonicalsets-of-items for the grammar?
(Multiple Choice)
4.8/5
(42)
Consider the grammar S ? (S) | a Let the number of states in SLR(1), LR(1) and LALR(1) parsers for the grammar be n1, n2 and n3 respectively. The following relationship holds good
(Multiple Choice)
4.8/5
(38)
In compiler optimization, operator strength reduction uses mathematical identities to replace slow math operations with faster operations. Which of the following code replacements is an illustration of operator strength reduction?
(Multiple Choice)
4.8/5
(42)
The grammar A ? AA | (A) | ? is not suitable for predictive-parsing because the grammar is
(Multiple Choice)
4.8/5
(35)
Which of the following describes a handle (as applicable to LR-parsing) appropriately?
(Multiple Choice)
4.9/5
(42)
Consider the following two sets of LR(1) items of an LR(1) grammar.
X -> c.X, c/d
X -> .cX, c/d
X -> .d, c/d
X -> c.X, $
X -> .cX, $
X -> .d, $
Which of the following statements related to merging of the two sets in thecorresponding LALR parser is/are FALSE?
1) Cannot be merged since look aheads are different.
2) Can be merged but will result in S-R conflict.
3) Can be merged but will result in R-R conflict.
4) Cannot be merged since goto on c will lead to two different sets.
(Multiple Choice)
4.8/5
(36)
An LALR(1) parser for a grammar G can have shift-reduce (S-R) conflicts if and only if
(Multiple Choice)
4.8/5
(35)
Consider the following two statements:
P: Every regular grammar is LL(1)
Q: Every regular set has a LR(1) grammar
Which of the following is TRUE?
(Multiple Choice)
4.8/5
(41)
Showing 1 - 20 of 24
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)