Quiz on Parsing and Context-Free Grammar

Quiz on Parsing and Context-Free Grammar

12th Grade

9 Qs

quiz-placeholder

Similar activities

Scratch Programming

Scratch Programming

1st - 12th Grade

13 Qs

Restapi

Restapi

12th Grade

10 Qs

Rainbow Six Siege

Rainbow Six Siege

5th Grade - University

10 Qs

Quiz - 6 on Relational & Logical Operators

Quiz - 6 on Relational & Logical Operators

12th Grade

10 Qs

Python Fundamentals

Python Fundamentals

11th - 12th Grade

12 Qs

Intro to Scratch 2

Intro to Scratch 2

KG - University

12 Qs

Quiz - 3 Assignment, Increment & Decrement Operators in C

Quiz - 3 Assignment, Increment & Decrement Operators in C

12th Grade

10 Qs

BIM1014 Quiz4

BIM1014 Quiz4

KG - University

10 Qs

Quiz on Parsing and Context-Free Grammar

Quiz on Parsing and Context-Free Grammar

Assessment

Quiz

Computers

12th Grade

Hard

Created by

Aima Zahoor

FREE Resource

9 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

Which of the following is a characteristic of context-free grammar?

It can generate all possible strings in a language

It requires context to understand the syntax

It is only applicable to programming languages

It cannot define recursive structures

2.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Which of the following is an example of a nonterminal symbol?

2

expr

print

if

3.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What does it mean for a grammar to be ambiguous?

It has multiple valid parse trees for the same string

It cannot generate any strings

It has a single parse tree for every string

It is too complex to analyze

4.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What is left recursion in grammar?

A way to eliminate ambiguity

A type of operator precedence

A method of parsing from the left side of the string

A situation where a nonterminal refers to itself on the left

5.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Which of the following describes left associativity?

Operators have equal precedence

Operators are evaluated from left to right

Operators are evaluated based on their type

Operators are evaluated from right to left

6.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

What is a predictive parser?

A parser that generates random outputs

A parser that predicts the output of a program

A parser that does not require backtracking

A parser that uses backtracking

7.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

Which of the following is NOT a type of parser?

Top-down parser

Bottom-up parser

Left-right parser

Universal parser

8.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

What is the first step in top-down parsing?

Construct the parse tree

Scan the input string

Begin with the start symbol

Select a production for a nonterminal

9.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

What is the significance of the lookahead symbol in predictive parsing?

It determines the next production to use

It indicates the end of the input

It is used to backtrack in parsing

It is irrelevant to the parsing process