Professional Documents
Culture Documents
Compiler MCQ (MCA 504A)
Compiler MCQ (MCA 504A)
4. The _______ uses the parse tree and symbol table checking the semantic
consistency of the source program. [1]
A. Lexical analyser
B Intermediate Code Generator
C. Syntax translator
D. Semantic analyser
1
5. The ________ phase converts an intermediate code into an optimized code
that takes lesser space and lesser time to execute. [2]
A. Code optimization
B. Syntax directed translation
C. Code generation
D. Intermediate code generation
6. _________ is invoked whenever any fault occurs in the compilation process
of source program. [2]
A. Syntax analyser
B. Code generator
C. Error handler
D. Lexical analyser
9. A compiler that runs on one machine and produces the target code for
another machine is known as ________. [1]
A. Cross Compiler
B. Linker
C. Preprocessor
D. Assembler
2
10.A _________ acts as an interface between the source program and the rest
of the compiler phase of the compiler. [1]
A. Semantic Analyzer
B. Parser
C. Lexical analyser
D. Syntax analyser
11. Which of the tasks are performed by the lexical analyser? [2]
A. Stripping out comments and whitespace
B. Correlating error messages with the source program
C. Performing the expansion of macros
D. All of these
12.A ________ is any finite set of strings over some specific alphabet. [1]
A. Sentence
B. Word
C. Language
D. Character class
13. If zero or more symbols are removed from the end of any string s, a new
string is obtained known as a __________of string s. [2]
A. Prefix
B. Suffix
C. Substring
D. Subsequence
14. If we have more than one possible transition on the same input symbol
from some state, then the recognizer is said to be [2]
A. Non-deterministic finite automata
B. Deterministic finite automata
C. Finite automata
D. None of these
3
15. A tool for automatically generating a lexical analyser for a language
is defined as _______. [1]
A. Lex
B. YACC
C. Handler
D. All of these
16. for a=10 to 50, in the given code, a is defined as a/an [1]
A. Constant
B. Identifier
C. Keyword
D. Operator
4
20. In a compiler, keywords of a language are recognized during [1]
A. parsing of the program
B. the code generation
C. the lexical analysis of the program
D. dataflow analysis
21. Consider the following statements: [1]
(I) The output of a lexical analyser 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?
A.Only (I)
B.Only (II) and (III)
C.All (I), (II), and (III)
D.None of these
5
24. Consider the following statements related to compiler construction: [1]
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?
A. Only I
B. Only II
C. Both I and II
D. Neither I nor II
A. Only I
B. Only II
C. Both I and II
D. Neither I nor II
26.The number of tokens in the following C statement is [1]
printf("i=%d, &i=%x", i&i);
A.13
B.6
C.10
D.9
27. A language L from a grammar G = { V N, Σ, P, S} is? [1]
A. Set of symbols over VN
B. Set of symbols over Σ
C. Set of symbols over P
D. Set of symbols over S
6
28. What is the transitional function of a DFA? [1]
A. Q X Σ→Q
B. Q X Σ→2Q
C. Q X Σ→2n
D. Q X Σ→Qn
A. It can generate stand-alone programs that often take less time for
execution
D. that runs on one machine but produces object code for another machine
7
33. Whether a given pattern constitutes a token or not [1]
A. depends on the source language
B. depends on the target language
C. depends on the compiler
D. none of the above comment is true
8
38. The regular expression for the language of all strings that have zero
or more a’s followed by zero or more b’s is [2]
A. ( a + b )
B. abc
C. a*b*
D. (ab)+
9
41. Which one of the following is CORRECT? [2]
I. If all states of an NFA are accepting
states then the language accepted by
the NFA is Σ∗.
II. There exists a regular language A such that it is also CFG
A.I is true
B.II is true
C.Both of them
D.None Of the Above
A. 1
B. 2
C. 3
D. 4
A.I is true
B.II is true
C.Both of them
D.None Of the Above
44.How many DFA's exist with two states over the input alphabet {0,1}? [2]
A. 128
B .64
C. 2
D. 4
10
45.How many DFA's exist with two states over the input alphabet {0,1} with
Designated Initial State? [2]
A. 128
B . 64
C. 2
D. 4
A. P-III,Q-I,R-II,S-IV
B. P-II,Q-III,R-I,S-IV
C. P-III,Q-I,R-II,S-III
D. None of the Above
47. Which of the following have not performed during Compilation? [1]
A. memory allocation in Heap
B. type casting.
C. Symbol Table Updation
D. mismatching the syntax
11
49.Consider P is a Program having two modules m1,m2
m1 uses m2 extensively but they are belonging from different files. At which
Step this Problems can be solved? [1]
A. Linking Time
B. Loading Time
C. Semantic Analysis time
D. None Of the Above
50. Lexeme is--> [1]
A. a sequence of characters in the source program that is matched by the
pattern of a token
B. always same as token
C. terminal of a grammar
D. non-terminal of a grammar
51.Symbol table can be made through for optimal look up? [1]
B. Min Heap
C. Hash Table
A. r* = r(*)
C. (r*)* = { }
D. r* - {} = {}
A. L(L+D)^*
B. L(L+D)
C. L(L)
D. D(L)
12
54. [1]
fi(i<=0){
some instructions
}
Which error will occur?
A. Lexical Error
B. Syntax Error
C. Linking Error
D. Loading Error
55. [1]
fi(i<=0);
Which Error will Occur?
A. Lexical Error
B. Syntax Error
C. Linking Error
D. Loading Error
56. [1]
while(i>=0);
this error can occur in which state?
A. Linking error
B. Syntax Error
C. No error
A. epsilon NFA
B. Lexical analysis
C. Dynamic way
13
58.Given for all Regular Languages [2]
1. "DFA is a Proper Subset of NFA"
2. " DFA is a Subset of NFA "
Which one is Correct?
A. 1 is True, 2 is False
B. 1 is True, 2 is True
C. 1 is False, 2 is True
D. None
A. Byte Code
B. .class file
C. .exe file
A. Semantic analysis
B. ICG
C. Run time
D. Code Optimization
61. [1]
int _=1;
For this Statement the error will generate where?
A. No error
B. Lexical error
C. Syntax error
14
62.McNaughton-Yamada-Thompson is an Algorithm used for which purpose? [2]
A. Parser
B. Lex
C. Synthesizer
D. None
A. Syntax Analysis
B. Lexical Analysis
C. Code optimization
B. Turing Machine
C. Both
A. Identifiers
B. Constants
C. Keywords
15
67.Linear analysis is called ____ in a compiler. [1]
A. Lexical analysis
B. Scanning
C. Testing
D. Both a and b
68. [2]
A. 1 is true
B. 2 is true
69. [1]
int a,b;
a = 1,2,3;
the error is generated in which state?
A. No error is there
B. Syntax Analysis
C Run Time
D. Lexical Analysis
16
70. [1]
int a,b=1,2,3,4,5;
the error is generated in which state?
A. No error is there
B. Syntax Analysis
C. Run Time
D. Lexical Analysis
A. Compilation
B. Linking
C. Loading
D. Pre-processing state
A. Preprocessing
B. Lexical Analysis
C. Syntax Analysis
D. None
73.
Which of the Following Language uses Interpreter only? [1]
A. Java
B. C
C. C++
D. Ruby
17
74.A compiler capable of creating executable code for a platform other than
the one on which the compiler is running. [1]
This type of Compiler is said as =>
A. Cross Compiler
D. Compiled compiler
C. Compiled Compiler
D. Interpreter
A. Syntax Analysis
B. Semantic Analysis
C. Lexical Analysis
77.The process of finding the Parse tree for a String of tokens is called?
[2]
A. Parsing
B. Lexing
C. Finding
18
78.Compiler can Check which type of error? [1]
A. Logical
B. Syntactical
C. Essential
79. Who converts the High-Level Language to Lower Level Language [2]
A. Compiler
B. SUPER editor
C. Editor
D. None
81.A program that translates from a low-level language to a higher level one
is a [1]
A. Decompiler
B. Recomipler
C. Reverse Compiler
D. Redo Compiler
A. Front End
B. Back End
C. Intermediate
19
83.A software development tool used mainly in the construction of compilers,
translators, and interpreters for other programming languages.is known as
[2]
A. Meta Compiler
B. Beta Compiler
C. Source
D. src
A. Lexical Analysis
B. Syntax Analysis
C. Pre-processing
D. None
A. Lexical Analysis
B. Syntax Analysis
C. Pre-processing
D. None
A. After Compilation
B. Before Compilation
D. Error
87. The Language in which the Programming structures are written? [2]
A. BNF
B. CNF
C. FA
D. LBA
20
88. "Lex" is a tool for [1]
A. Lexical Analysis
B. Syntax Analysis
C. Semantic Analysis
D. None.
A. Semantic analysis
B. Syntax Analysis
A. Platform Dependent
B. Platform Independent
C. Both
A. Platform Dependent
B. Platform Independent
C. Both
A. Platform Dependent
B. Platform Independent
C. Both
21
93.Lexical Analysis [1]
A. Platform Dependent
B. Platform Independent
C. Both
A. Platform Dependent
B. Platform Independent
C. Both
A. k ≤ 2n
B. k ≥ 2^n
C. K =n
D. none
96. [2]
Language L1 is defined by the grammar: S1 → aS1b|ε
P:L1 is regular
Q: L2 is regular
Which one of the following is TRUE?
A. P is true , Q is false
B. P is False , Q is True
22
97.NFA is a Proper Subset of [1]
A. PDA
B. DFA
C. both
A. DFA
B. NFA
C. PDA
A. Regular
B. Irregular
A. Regular
B. accepted by DFA
C. accepted by NFA
***---***
23