wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Lexical and Syntax Analysis

Total questions: 11

Worksheet time: 6mins

Name
Class
Date
1.

In Top-Down parsers, the tree is built from the root downward to the leaves

a)

True

b)

False

2.

Which of these can NOT be a terminal

a)

W

b)

A

c)

w

d)

a

3.

A Recursive-Descent Parser is a finite automaton

a)

True

b)

False

4.

A recursive descent parser can parse this grammar without problems:

A→BaA

B→Ab

a)

True

b)

False

5.

A recursive descent parser can parse this grammar without problems:

A → aB | bAb | bB

a)

True

b)

False

6.

How many simple phrases this Parsing Tree has

a)

1

b)

2

c)

3

d)

4

7.

What is the handle of this tree

a)

E + T

b)

F

c)

id

d)

E

8.

Moves the next input token onto the parser’s stack

a)

pop

b)

parse

c)

reduce

d)

shift

9.

Which is/are not correct for a LR parser

a)

They can be built for all programming languages

b)

They can detect syntax errors as soon as it is possible in a right-to-left scan.

c)

The LR class of grammars is a proper superset of the class parsable by LL parsers

d)

the parsing table for a given grammar are easy to produce by hand

10.

We need to do some modifications to the grammar to be an acceptable grammar for bottom-Up parser

E → E+T | T

T → T*F | F

F →(E)| id

a)

True

b)

False

11.

In bottom-Up parser, we reduce what we have in the Left hand Side of the grammar with the right hand side

a)

True

b)

False