wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

syntax Analysis

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

A grammar for a programming language is a formal description of

a)

Syntax

b)

Semantics

c)

Structure

d)

Library

2.

A compiler can check?

a)

Logical Error

b)


Syntax Error

c)

Both Logical and Syntax Error

d)


Not Logical and Syntax Error

3.

Which of the following is a system program that integrates a program’s individually compiled modules into a form that can be executed?

a)

Interpreter

b)


Assembler

c)

Compiler

d)

Linking Loader

4.

Which of the following error can Compiler diagnose?

a)

Logical errors only

b)

Grammatical and logical errors

c)


Grammatical errors only

d)


All of the mentioned

5.

A grammar that produce more than one Parse tree for same sentence is

a)

Ambiguous

b)

Unambiguous

c)

Complementation

d)


Concatenation

6.

Grammars that can be translated to DFAs is

a)

Left linear grammar

b)

Right linear grammar

c)


Generic grammar

d)


All of the mentioned

7.

The context free grammar S → A111|S1, A → A0 | 00 is equivalent to

a)

{0n1m | n=2, m=3}

b)

{0n1m | n=1, m=5}

c)

{0n1m | n should be greater than two and m should be greater than four}

d)

None of the mentioned

8.

Which of the following statement is false?

a)

In derivation tree, the label of each leaf node is terminal

b)

In derivation tree, the label of all nodes except leaf nodes is a variable

c)

In derivation tree, if the root of a sub tree is X then it is called –tree

d)

None of the mentioned

9.


For A-> e , A can be erased. So whenever it appears on the left side of a production, replace with another production without the A.
State true or false:

a)

true

b)

false

10.

Simplify the given grammar:

S->aXb
X->aXb | e

a)

S->aXb | ab, X-> aXb | ab

b)

S->X | ab, X-> aXb | ab

c)


S->aXb | ab, X-> S | ab

d)


None of the mentioned