logo
  • Home
  • Test & Rank
  • About
  • Training
  • Programming
  • CS
  • IT
  • IS
  • ECE
  • EEE
  • EE
  • Civil
  • Mechanical
  • Chemical
  • Metallurgy
  • Instrumentation
  • Aeronautical
  • Aerospace
  • Biotechnology
  • Mining
  • Marine
  • Agriculture
  • MCA
  • BCA
  • Internship
  • Jobs
  • Contact

Compiler Multiple Choice Questions | MCQs | Quiz

Compilers Interview Questions and Answers
Practice Compilers questions and answers for interviews, campus placements, online tests, aptitude tests, quizzes and competitive exams.

Get Started

Compiler - Expressions - 1
Compiler - Expressions - 2
Compiler - Cross Compiler - 1
Compiler - Cross Compiler - 2
Compiler - Lexical Analysis-1
Compiler - Lexical Analysis-2
Compiler - Regex - 1
Compiler - Regex - 2
Compiler - Relations - 1
Compiler - Relations - 2
Compiler - Finite Automata-1
Compiler - Finite Automata-2
Compiler - Non DFA - 1
Compiler - Non DFA - 2
Compiler - NFA to DFA - 1
Compiler - NFA to DFA - 2
Compiler - Epsilon-Moves - 1
Compiler - Epsilon-Moves - 2
Compiler - DFA - 1
Compiler - DFA - 2
Compiler - DFA Minimization-1
Compiler - DFA Minimization-2
Compiler - Regexp Automata-1
Compiler - Regexp Automata-2
Compiler - Lexical Analyser - 1
Compiler - Lexical Analyser - 2
Compiler - Syntax Analyser - 1
Compiler - Syntax Analyser - 2
Compiler - Context Grammar-1
Compiler - Context Grammar-2
Compiler - Regular Grammar-1
Compiler - Regular Grammar-2
Compiler - Linear Grammar-1
Compiler - Top-Down Parsing1
Compiler - Top-Down Parsing2
Compiler - Predictive Parsing
Compiler - BottomUp Parsing1
Compiler - BottomUp Parsing2
Compiler - Sentinel Grammar1
Compiler - Sentinel Grammar2
Compiler - LR Parser - 1
Compiler - LR Parser - 2
Compiler - Parsing Table - 1
Compiler - Parsing Table - 2
Compiler - Definitions - 1
Compiler - Definitions - 2
Compiler - Translation Syntax1
Compiler - Translation Syntax2
Compiler - L - Definition - 1
Compiler - L - Definition - 2
Compiler - Generation - 1
Compiler - Generation - 2
Compiler - Statements - 1
Compiler - Statements - 2
Compiler - Programming - 2
Compiler - Programming - 1
Compiler - Increment - 1
Compiler - Increment - 2
Compiler - Array Reference-1
Compiler - Array Reference-2
Compiler - Switch Case - 1
Compiler - Switch Case - 2
Compiler - Management - 1
Compiler - Management - 2
Compiler - Storage Location-1
Compiler - Storage Location-2
Compiler - Symbol Table - 1
Compiler - Symbol Table - 2
Compiler - Storage Allocation1
Compiler - Storage Allocation2
Compiler - Activation Record1
Compiler - Activation Record2
Compiler - Static Allocation-1
Compiler - Static Allocation-2
Compiler - Stack Allocation-1
Compiler - Stack Allocation-2
Compiler - Error Handling - 1
Compiler - Error Handling - 2
Compiler - Lexical Errors - 1
Compiler - Lexical Errors - 2
Compiler - Syntactic Errors-1
Compiler - Syntactic Errors-2
Compiler - LR Phase - 1
Compiler - LR Phase - 2
Compiler - Yacc - 1
Compiler - Yacc - 2
Compiler - Parsing Error -1
Compiler - Parsing Error -2
Compiler - Semantic Errors-1
Compiler - Semantic Errors-2
Compiler - Code Optimization1
Compiler - Code Optimization2
Compiler - Loop Optimization1
Compiler - Loop Optimization2
Compiler - Variables - 1
Compiler - Variables - 2
Compiler - local expressions
Compiler - Subexpressions-1
Compiler - Subexpressions-2
Compiler - Loop Unrolling - 1
Compiler - Loop Unrolling - 2
Compiler - Loop Jamming - 1
Compiler - Loop Jamming - 2
Compiler - Loop Jamming - 3
Compiler - Code Generation-1
Compiler - Code Generation-2
Compiler - Machine Model - 1
Compiler - Machine Model - 2
Compiler - Dag Generation - 1
Compiler - Dag Generation - 2
Compiler - Peephole - 1
Compiler - Peephole - 2

Best Reference Books

Compilers Books

« Prev Page
Next Page »

Compilers Questions and Answers – Recovery from Syntactic Phase Errors – 2

Posted on May 16, 2017 by Manish

This set of Compilers Multiple Choice Questions & Answers (MCQs) focuses on “Recovery from Syntactic Phase Errors –
2”.

1. Find the TRUE statement?
I. There exist parsing algorithms for some programming languages which has O (3) complexities
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 intermediate code level and source Language.
a) I and II
b) I and IV
c) III and IV
d) I III and IV
View Answer

Answer: b
Explanation: In recursion, space used but recursive call can’t be calculated by the compiler.

advertisement

2. Which of the following describes a handle (as applicable to LR-parsing) appropriately?
a) Position where next reduce or shift operation will occur
b) The next step has use of Non-terminal for reduction
c) Used for reduction in a coming-up step along with a position in the sentential form where the next shift or reduce operation will occur
d) Used in the next step for reduction along with a position in the sentential form where the right hand side of the production may be found
View Answer

Answer: d
Explanation: The next step in LR parsing shall have Reduction.

3. Which one of the following is a top-down parser?
a) Recursive descent parser
b) Operator precedence parser
c) An LR(k) parser
d) An LALR(k) parser
View Answer

Answer: a
Explanation: Recursive Descent also known as top down parsing also known to be LL(1).

4.Consider the following two statements:
P: Every regular grammar is LL(1)
Q:Regular is LR(1) grammar
Which of the following is TRUE?
a) Both P and Q are true
b) P is true and Q is false
c) P is false and Q is true
d) Both P and Q are false
View Answer

Answer: c
Explanation: Ambiguity can be seen in regular grammar
S → aA/a
A → aA/ε
In above grammar, string ‘a’ has two leftmost
derivations.
S → aA
S → a
S->a (using A->ε).

5. Consider the grammar defined by the following production rules

 S --> T * P 
    T --> U | T * U
    P --> Q + P | Q
    Q --> Id
    U --> Id
advertisement

Which one of the following is TRUE?
a) + is left associative, while ∗ is right associative
b) + is right associative, while ∗ is left associative
c) Both + and ∗ are right associative
d) Both + and ∗ are left associative
View Answer

Answer: b
Explanation: It is associative we can see and tell.Second productions latter part shows left recursion and is left associative.

6. The grammar A → AA | (A) | e is not suitable for predictive-parsing because the grammar is
a) Ambiguous
b) Left recursive
c) Right recursive
d) An operator grammar
View Answer

Answer: b
Explanation:
A ::= A a
| b is the left recursive language.

7. Consider the grammar
E → E + n | E × n | n
For a sentence n + n × n, the handles in the right-sentential form of the reduction are
a) n, E + n and E + n × n
b) n, E + n and E + n × n
c) n, n + n and n + n × n
d) n, E + n and E × n
View Answer

Answer: d
Explanation: E → E + n {Applying E → E + n }
→ E + E * n {Applying E → E * n }
→ E + n * n {Applying E → n }
→ n + n * n {Applying E → n }.

8. Which grammar rules violate the requirements of an operator grammar ?
1.P → Q R
2.P → Q s R
3.P → ε
4.P → Q t R r
a) 1 only
b) 1 and 3 only
c) 2 and 3 only
d) 3 and 4 only
View Answer

Answer: b
Explanation: Top down parsing: We begin with the start symbol and compare the right side of the different productions against the first piece of input to see which of the productions should be used.

9. Which of the following suffices to convert an arbitrary CFG to an LL(1) grammar?
a) Removing left Recursive alone
b) Factoring the grammar alone
c) Along with removing left recursion we also perform the factoring of the grammar
d) None of the mentioned
View Answer

Answer: d
Explanation: Removing left recursion and factoring the grammar do not suffice to convert an arbitrary CFG to LL(1) grammar.
advertisement

10. In a bottom-up evaluation of a syntax directed definition its inherited attributes can do which of the following?
a) Always evaluated
b) Can be evaluated if the definition is L attributed
c) Can be evaluated if the definition has synthesized attributes
d) Never be evaluated
View Answer

Answer: b
Explanation: A Syntax Directed Definition (SDD) is called S Attributed if it has only synthesized attributes. Also the-Attributed Definitions contain both synthesized and inherited attributes but do not need to build a dependency graph to evaluate them.

Sanfoundry Global Education & Learning Series – Compilers.
To practice all areas of Compilers, here is complete set of 1000+ Multiple Choice Questions and Answers.

« Prev Page - Compilers Questions and Answers – Recovery from Syntactic Phase Errors – 1
» Next Page - Compilers Questions and Answers – Error Recovery in LR phase – 1

« Geotechnical Engineering Questions and Answers – Group Action in Piles
Geotechnical Engineering Questions and Answers – Under-Reamed Pile Foundations »
advertisement

Deep Dive @ Sanfoundry:

  1. C Programming Examples on Searching and Sorting
  2. C++ Programming Examples on Graph Problems & Algorithms
  3. C++ Programming Examples on Numerical Problems & Algorithms
  4. C Programming Examples on Graph Problems & Algorithms
  5. Simple C Programs
  6. Automata Theory Questions and Answers
  7. C Programming Examples using Recursion
  8. C Programming Examples on Puzzles & Games
  9. C Programming Examples without using Recursion
  10. Compilers Questions and Answers
Manish Bhojasia
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn | Facebook | Twitter

Best Careers

Developer Tracks
SAN Developer
Linux Kernel Developer
Linux Driver Developer
Linux Network Developer

Live Training Photos
Mentoring
Software Productivity
GDB Assignment
Sanfoundry is No. 1 choice for Deep Hands-ON Trainings in SAN, Linux & C, Kernel Programming. Our Founder has trained employees of almost all Top Companies in India such as VMware, Citrix, Oracle, Motorola, Ericsson, Aricent, HP, Intuit, Microsoft, Cisco, SAP Labs, Siemens, Symantec, Redhat, Chelsio, Cavium, ST-Micro, Samsung, LG-Soft, Wipro, TCS, HCL, IBM, Accenture, HSBC, Mphasis, Tata-Elxsi, Tata VSNL, Mindtree, Cognizant and Startups.

Best Trainings

SAN I - Technology
SAN II - Admin
Linux Fundamentals
Advanced C Training
Linux-C Debugging
System Programming
Network Programming
Linux Threads
Kernel Programming
Kernel Debugging
Linux Device Drivers

Best Reference Books

Computer Science Books
Algorithm & Programming Books
Electronics Engineering Books
Electrical Engineering Books
Chemical Engineering Books
Civil Engineering Books
Mechanical Engineering Books
Industrial Engineering Books
Instrumentation Engg Books
Metallurgical Engineering Books
All Stream Best Books

Questions and Answers

1000 C Questions & Answers
1000 C++ Questions & Answers
1000 C# Questions & Answers
1000 Java Questions & Answers
1000 Linux Questions & Answers
1000 Python Questions
1000 PHP Questions & Answers
1000 Hadoop Questions
Cloud Computing Questions
Computer Science Questions
All Stream Questions & Answers

India Internships

Computer Science Internships
Instrumentation Internships
Electronics Internships
Electrical Internships
Mechanical Internships
Industrial Internships
Systems Internships
Chemical Internships
Civil Internships
IT Internships
All Stream Internships

About Sanfoundry

About Us
Copyright
Terms
Privacy Policy
Jobs
Bangalore Training
Online Training
Developers Track
Mentoring Sessions
Contact Us
Sitemap
© 2011 Sanfoundry. All Rights Reserved.