Assignment 0 Compiler Design
Assignment 0 Compiler Design
Compiler Design
Assignment - Week 0
TYPE OF QUESTION:MCQ
Number ofquestions:11 Total mark: 11 X 1 = 11
Q1.
Task of a compiler is to
Explanation: A compiler is a program that translates the entire source code of a program
written in a high-level programming language into machine code or an intermediate language
in one go. The resulting code can then be executed by the machine.
Q2.
In a computer system, number of compilers for a particular programming language may
Be
a) Two
b) Three
c) Four
d) Many
ANS: d)
Explanation:
There can be many compilers for a particular programming language in a computer system.
This is because:
Platform-specific compilers: Different compilers are designed for different hardware
architectures or operating systems. For example, compilers like GCC, Clang, and Microsoft
C++ Compiler all support the C++ language but are optimized for different platforms.
Optimization and feature differences: Some compilers offer specific optimizations or
additional features that others do not. Developers may choose a compiler based on their
project's needs.
Open-source vs. proprietary: Both open-source compilers (like GCC or LLVM) and
proprietary compilers (like Intel C++ Compiler or Oracle's Java Compiler) exist for many
languages.
Specialized use cases: Some compilers are tailored for education, embedded systems, or
research purposes.
Thus, for a single programming language, there can be many compilers available.
Q3.
Natural language constructs are
a) Ambiguous
b) Unambiguous
c) May be Unambiguous or ambiguous
d) None of the other options
ANS: c)
Explanation:
Q4.
Suppose there is a compiler for C language that can generate code for Computer A. Which of
the following statements is true
ANS: c)
a) Array
b) Link List
c) Tree
d) Hash Table
ANS: d)
Explanation: A Hash Table is efficient for frequent searches, insertions, and deletions
because it provides O(1) average time complexity for all these operations. Data is quickly
accessed, inserted, or deleted using a key and a hash function, making it highly efficient for
dynamic data handling.
Q6.
Task of an interpreter is to
ANS: b)
Q7.
If an Infinite language is passed to Machine M, the subsidiary which gives a finite
solution to the infinite input tape is ______________
a) Compiler
b) Interpreter
c) Loader and linkers
d) None of the mentioned
ANS : a)
Q8.
Languages of a automata is
a) If it is accepted by automata
b) If it halts
c) If automata touch final state in its life time
d) All language are language of automata
ANS: a)
Q9.
Finite automata requires minimum _______ number of stacks.
a) 1
b) 0
c) 2
d) None of the mentioned
ANS: b)
Explanation: Finite automata doesn’t require any stack operation .
Q10.
The basic limitation of finite automata is that
ANS: a)
a) Regular languages
b) Context-free languages
c) Context-sensitive languages
d) None of the mentioned
ANS: a)
Explanation: Finite automata are limited to recognizing regular languages, which are defined
by regular expressions. They cannot handle languages requiring memory, such as context-
free or context-sensitive languages.
END of Assignment