Compiler Design (2170701) MCQs

MCQs of Parsing Theory

Showing 1 to 10 out of 19 Questions
1.

A grammar that produces more than one parse tree for some sentence is called __________

(a)

Ambiguous

(b)

Unambiguous

(c)

Regular

(d)

None of the mentioned

Answer:

Option (a)

2.

Is given grammar is Ambiguous?

S-> SS+ | SS* | a 

(a)

Yes

(b)

No

(c)

Can't say

(d)

None of these

Answer:

Option (b)

3.

Which of the following derivations does a top-down parser use while parsing an input string? The input is assumed to be scanned in left to right order.

(a)

 Leftmost derivation

(b)

 Leftmost derivation traced out in reverse

(c)

 Rightmost derivation

(d)

 Rightmost derivation traced out in reverse

Answer:

Option (a)

4.

The process of assigning load addresses to the various parts of the program and adjusting the code and data in the program to reflect the assigned addresses is called

(a)

Assembly

(b)

Parsing

(c)

Relocation

(d)

Symbol resolution

Answer:

Option (c)

5.

Which of the following statements is false?

(a)

An unambiguous grammar has the same leftmost and rightmost derivation

(b)

An LL(1) parser is a top-down parser

(c)

LALR is more powerful than SLR

(d)

An ambiguous grammar can never be LR(k) for any k

Answer:

Option (a)

6.

What are the stages in the compilation process? Select one: 

(a)

Feasibility study system design and testing 

(b)

Implementation and documentation 

(c)

Lexical analysis, syntax analysis and code generation

(d)

All of the above

Answer:

Option (c)

7.

YACC is a: 

(a)

Lexical analyzer generator Parser generator 

(b)

Parser generator 

(c)

Semantic analyzer 

(d)

None of the above

Answer:

Option (b)

8.

Given grammar 

S –> (L) | a 

L –> L, S | S 

Which of the input recognized by the grammar: 

(a)

 ((a, a), a) 

(b)

 (a,a) 

(c)

 ((a, a,a),a) 

(d)

 All of the above

Answer:

Option (d)

9.

The bottom-up parsing method is also called

(a)

Shift reduce parsing

(b)

Predictive parsing

(c)

 Recursive descent parsing

(d)

 None of these

Answer:

Option (a)

10.

The most general phrase structured grammar

(a)

 Context-sensitive

(b)

 Context-free

(c)

 Regular

(d)

 None of these

Answer:

Option (a)

Showing 1 to 10 out of 19 Questions