MCQGeeks
0 : 0 : 1
CBSE
JEE
NTSE
NEET
English
UK Quiz
Quiz
Driving Test
Practice
Games
Quiz
Computer Science
Compiler Construction
Quiz 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Q.1
Which of the following pairs have DIFFERENT expressive power?
Deterministic finite automata (DFA) and Non-Deterministic finite automata(NFA)
Deterministic push down automata (DPDA) and Non-deterministic pushdown automata
Deterministic single-tape Turing machine and Non-deterministic single-tape Turing Machine
Single-tape Turing machine and multi-tape Turing machine
Q.2
In multi-programmed systems, it is advantageous if some programs such as editors and compilers can be shared by several users. Which of the following must be true of multi-programmed systems in order that a single copy of a program can be shared by several users? I. The program is a macro II. The program is recursive III.The program is reentrant
I only
II only
Ill only
I, II and III
Q.3
Consider the following expressionu*v+a-b*c Which one of the following corresponds to a static single assignment from the above expressions
x1 = a - b y1 = p * c x2 = u * v y2 = p + q
x 1 = a - b y1 = x2 * c x3 = u * v y2 = x4 + y3
x1 = a - b y2 = x1 * c x2 = u * v y3 = x2 + y2
p = a - b q = p * c p = u * v q = p + q
Q.4
Which of the following macros can put a micro assembler into an infinite loop?(i) .MACRO M1 X.IF EQ, X ;if X=0 thenM1 X + 1.ENDC.IF NE X ;IF X≠0 then.WORD X ;address (X) is storedhere.ENDC.ENDM(ii).MACRO M2 X.IF EQ XM2 X.ENDC.IF NE, X.WORD X+1.ENDC.ENDM
(ii) only
(i) only
Both (i) and (ii)
None of the above
Q.5
The expression (a*b)* c op........ where 'op' is one of '+', '*' and '↑' (exponentiation) can be evaluated on a CPU with a single register without storing the value of (a * b) if
‘op’ is ‘+’ or ‘*’
'op’ is ‘↑’ or ‘*’
'op’ is ‘↑’ or ‘+’
not possible to evaluate without storing
Q.6
A language L allows declaration of arrays whose sizes are not known during compilation. It is required to make efficient use of memory. Which of the following is true?
A compiler using static memory allocation can be written for L
A compiler cannot be written for L, an interpreter must be used
A compiler using dynamic memory allocation can be written for L
None of the above
Q.7
A linker reads four modules whose lengths areandwords respectively. If they are loaded in that order, what are the relocation constants?
0, 200, 500, 600
0, 200, 1000, 1600
200, 500, 600, 800
200, 700, 1300, 2100
Q.8
Consider the following C code segment.for (i =i
The code contains loop invariant computation
There is scope of common sub-expression elimination in this code
There is scope of strength reduction in this code
There is scope of dead code elimination in this code
Q.9
Incremental-Compiler is a compiler
which is written in a language that is different from the source language
compiles the whole source code to generate object code afresh
compiles only those portion of source code that have been modifie
that runs on one machine but produces object code for another machine
Q.10
Shift-Reduce parsers perform the following:
Shift step that advances in the input stream by K(K > 1) symbols and Reduce step that applies a completed grammar rule to some recent parse trees, joining them together as one tree with a new root symbol.
Shift step that advances in the input stream by one symbol and Reduce step that applies a completed grammar rule to some recent parse trees, joining them together as one tree with a new root symbol.
Shift step that advances in the input stream by K(K = 2) symbols and Reduce step that applies a completed grammar rule to form a single tree
Shift step that does not advance in the input stream and Reduce step that applies a completed grammar rule to form a single tre
Q.11
Which is True about SR and RR-conflict:
If there is no SR-conflict in CLR(1) then definitely there will be no SR-conflict in LALR(1).
RR-conflict might occur if lookahead for final items(reduce-moves) is sam
Known that CLR(1) has no RR-conflict, still RR-conflict might occur in LALR(1).
All of the abov
Q.12
Consider the following grammars(S:A --> aBCDB --> bc|cC --> d|∈D -> b(S:A --> aBCDB --> bc|∈C --> d|cD -> b(S:A --> aBCDB --> bc|∈C --> d|∈D -> b(S:A --> aBCDB --> bc|cC --> d|cD -> bWhich of the following grammar has same follow set for variable B?
Only (S1), (S2) and (S3), (S4)
Only (S1), (S3) and (S2), (S4)
Only (S2), (S3) and (S1), (S4)
None of the above
Q.13
The grammar whose productions are → if id then → if id then else → id := idis ambiguous becausea) the sentence if a then if b then c:= d has two parse treesb) the left most and right most derivations of the sentence if a then if b then c:= d give rise to different parse treesc) the sentence if a then if b then c:= d else c:= f has more than two parse treesd) the sentence if a then if b then c:= d else c:= f has two parse trees
a
b
c
d
Q.14
Which of the following is essential for converting an infix expression to the postfix from efficiently?
An operator stack
An operand stack
An operand stack and an operator stack
A parse tree
Q.15
Consider the following expression grammar. The seman-tic rules for expressioncalculation are stated next to each grammar production.E → number E.val = number. val | E '+' E E(1).val = E(2).val + E(3).val | E '×' E E(1).val = E(2).val × E(3).valThe above grammar and the semantic rules are fed to a yacc tool (which is an LALR (1)parser generator) for parsing and evaluating arithmetic expressions. Which one of thefollowing is true about the action of yacc for the given grammar?
It detects recursion and eliminates recursion
It detects reduce-reduce conflict, and resolves
It detects shift-reduce conflict, and resolves the conflict in favor of a shift over a reduce action
It detects shift-reduce conflict, and resolves the conflict in favor of a reduce over a shift action
Q.16
Consider the grammar S → (S) | a Let the number of states in SLR(1), LR(and LALR(parsers for the grammar be nn2 and n3 respectively. The following relationship holds good
n1 < n2 < n3
n1 = n3 < n2
n1 = n2 = n3
n1 ≥ n3 ≥ n2
Q.17
Debugger is a program that
allows to examine and modify the contents of registers
does not allow execution of a segment of program
allows to set breakpoints, execute a segment of program and display contents of register
All of the above
Q.18
From the given data below : a b b a a b b a a b which one of the following is not aword in the dictionary created by LZ-coding (the initial words are a, b)?
a b
b b
b a
b a a b
Q.19
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?
Only I
Only II
Both I and II
Neither I nor II
Q.20
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?
Only (I)
Only (II) and (III)
All (I), (II), and (III)
None of these
0 h : 0 m : 1 s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Report Question
×
What's an issue?
Question is wrong
Answer is wrong
Other Reason
Want to elaborate a bit more? (optional)
Support mcqgeeks.com by disabling your adblocker.
×
Please disable the adBlock and continue.
Thank you.
Reload page