Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Tests  >  Predictive Top Down Parsing - Computer Science Engineering (CSE) MCQ

Predictive Top Down Parsing - Computer Science Engineering (CSE) MCQ


Test Description

10 Questions MCQ Test - Predictive Top Down Parsing

Predictive Top Down Parsing for Computer Science Engineering (CSE) 2024 is part of Computer Science Engineering (CSE) preparation. The Predictive Top Down Parsing questions and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus.The Predictive Top Down Parsing MCQs are made for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, notes, meanings, examples, exercises, MCQs and online tests for Predictive Top Down Parsing below.
Solutions of Predictive Top Down Parsing questions in English are available as part of our course for Computer Science Engineering (CSE) & Predictive Top Down Parsing solutions in Hindi for Computer Science Engineering (CSE) course. Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free. Attempt Predictive Top Down Parsing | 10 questions in 10 minutes | Mock test for Computer Science Engineering (CSE) preparation | Free important questions MCQ to study for Computer Science Engineering (CSE) Exam | Download free PDF with solutions
Predictive Top Down Parsing - Question 1

S → C C
C → c C | d
The grammar is 

Detailed Solution for Predictive Top Down Parsing - Question 1

Explanation: Since there is no conflict, the grammar is LL (1) hence a predictive parse table with no conflicts can be constructed.

Predictive Top Down Parsing - Question 2

Which one of the following statements is TRUE?

Detailed Solution for Predictive Top Down Parsing - Question 2

Concept:

Option 1: The LALR(1) parser for a grammar G cannot have a reduce-reduce conflict if the LR(1) parser for G does not have a reduce-reduce conflict. 

False, If there is no S-R conflict in LR(1) state, it will never be reflected in the LALR(1) state obtained by combining LR(1) states; but, this merging method may create R-R conflict, and the Grammar will not be LALR (1).

Option 2: Symbol table is accessed only during the lexical analysis phase

False, The information in the symbol table is provided during the lexical and syntax analysis phases, but it is needed in subsequent stages of the compiler (semantic analysis, intermediate code generation, code optimization, and code generation).

Option 3:Data flow analysis is necessary for run-time memory management.

False, Data flow analysis is used in control flow graphs for code optimization. It is the analysis of data flow in a control flow graph, that is, the analysis that determines information about data definition and usage in a program. Optimization can be achieved with the use of this analysis.

Option 4: LR(1) parsing is sufficient for deterministic context-free languages

True, LR(k) grammars (also known as deterministic context-free grammars) allow parsing (string recognition) with deterministic pushdown automata (PDA), they can only define deterministic context-free languages.

Hence the correct answer is LR(1) parsing is sufficient for deterministic context-free languages.

1 Crore+ students have signed up on EduRev. Have you? Download the App
Predictive Top Down Parsing - Question 3

Which of the following derivations does a top-down parser use while parsing an input string?

Detailed Solution for Predictive Top Down Parsing - Question 3

Explanation: Left to right constructing leftmost derivation of the sentence.

Predictive Top Down Parsing - Question 4

Given the following expression grammar:E -> E * F | F + E | FF -> F – F | idWhich of the following is true?

Detailed Solution for Predictive Top Down Parsing - Question 4

CONCEPT:

Consider the expession "id-id+id*id" :

Option 1: False

'+' has higher precedence than '⋆ ', since '+' will execute before '*'.

Option 3: False

'-' has higher precedence than '+ ', since '-' will execute before '+'.

Option 4: False

'*' & '+' have same precedence.

Predictive Top Down Parsing - Question 5

Which one of the following is true at any valid state in shift-reduce parsing?

Detailed Solution for Predictive Top Down Parsing - Question 5

Explanation: The prefixes on the stack of a shift-reduce parser are called viable prefixes.

Predictive Top Down Parsing - Question 6

In the context of abstract-syntax-tree and control-flow-graph.Which one of the following is true?

Detailed Solution for Predictive Top Down Parsing - Question 6

Explanation: Successors depends on input .

Predictive Top Down Parsing - Question 7

List-I                                List-II
A. Lexical analysis           1. Graph coloring
B. Parsing                         2. DFA minimization
C. Register allocation       3. Post-order traversal
D. Expression evaluation  4. Production tree

A B C D

Detailed Solution for Predictive Top Down Parsing - Question 7

Explanation: The entire column an items matches the Column B items in a certain way.

Predictive Top Down Parsing - Question 8

Which of the following statements is/are correct?

A. SLR parser is more powerful than LALR parser.

B. Canonical LR parser is more powerful than LALR parser.

C. LALR parser is more powerful than Canonical LR parser.

Detailed Solution for Predictive Top Down Parsing - Question 8

Concept:

Statement A: SLR parser is more powerful than LALR parser.

False, LALR(1) parser is more powerful than SLR(1) and LR(0) parser. LALR offers a good solution, because LALR(1) grammars are more powerful than SLR(1), and can parse most practical LL(1) grammars. LR(1) grammars are more powerful than LALR(1).


Statement B: Canonical LR parser is more powerful than LALR parser.

True, Canonical LR parser is more powerful than LALR parser. The number of states in the parsing automaton differs between the CLR and LALR algorithms. CLR parsers have a much larger number of states than LALR parsers.

Statement C: LALR parser is more powerful than Canonical LR parser.

False, Canonical LR parser is more powerful than LALR parser. Canonical (CLR) is the most powerful Parsers among all the LR(k) Parsers or SLR.

Hence the correct answer is Only B.

Predictive Top Down Parsing - Question 9

 Consider the following grammar G.
S → F ⎪ H
F → p ⎪ c
H → d ⎪ c
Which one is true?
S1: All strings generated by G can be parsed with help of LL (1).

S2: All strings generated by G can be parsed with help of LR (1).

Detailed Solution for Predictive Top Down Parsing - Question 9

Explanation: There is ambiguity as the string can be derived in 2 possible ways.
First Leftmost Derivation
S → F
F → c
Second Leftmost Derivation
S → H
H → c 

Predictive Top Down Parsing - Question 10

 What is the maximum number of reduce moves that can be taken by a bottom-up parser for a grammar with no epsilon- and unit-production to parse a string with n tokens?

Detailed Solution for Predictive Top Down Parsing - Question 10

Explanation: the moves are n-1.

Information about Predictive Top Down Parsing Page
In this test you can find the Exam questions for Predictive Top Down Parsing solved & explained in the simplest way possible. Besides giving Questions and answers for Predictive Top Down Parsing, EduRev gives you an ample number of Online tests for practice

Top Courses for Computer Science Engineering (CSE)

Download as PDF

Top Courses for Computer Science Engineering (CSE)