wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

321 quiz 03 -- Grammars - BNF - syntax

Total questions: 24

Worksheet time: 13mins

Name
Class
Date
1.

<program> --> begin <stmt_list> end

a)

A Java programming statement

b)

A C++ programming statement

c)

A javascript programming statement

d)

is an example of a grammar rule , also called a production

2.

A context-free grammar is a

a)

formal grammar w/ production rules for all possible strings

b)

formal grammar in which context is irrelevant

c)

informal grammar

d)

really not a grammar at all

3.

John Backus is important to us because

a)

he argued against the idea of context-free grammars

b)

he introducing a formal language description notation, BNF

c)

he describing ALGOL 58

d)

he invented Fortran the first programming language

4.

Noam Chomsky, a linguist, philosopher, social critic, and political activist,

a)

Wrote the first compiler for Fortran

b)

Wrote the first compiler for COBOL

c)

Described 2 grammar classes known as context-free & regular

d)

Worked @ MIT since 1955 and joined Univ of Arizona in 2018

5.

A grammar is a

a)

Set of rules for elementary or grammar school children

b)

Formal language generation mechanism used to describe syntax

c)

Often used in place of semantics

d)

Only relevant to certain computer languages

6.

Semantics is

a)

The study of rhetoric

b)

A form of argument

c)

Includes the meaning of the expressions of software programs

d)

An anti-virus company

7.

formal language-genmeration mechanisms used to describe syntax of programming languages

a)

Grammar

b)

Context-Free Grammars

c)

Backus-Naur Form

d)

Metalanguage

8.

used to describe the syntax of all programming languages, with minor exceptions

a)

Grammar

b)

Context-Free Grammars

c)

Backus-Naur Form

d)

Metalanguage

9.

a natural notation for describing syntax - the most popular method of concisely describing programming language syntax today

a)

Grammar

b)

Context-Free Grammars

c)

Backus-Naur Form

d)

Metalanguage

10.

a language that is used to describe another language. BNF = metalanguage for programming languages

a)

Grammar

b)

Context-Free Grammars

c)

Backus-Naur Form

d)

Metalanguage

11.

each of the strings within a derivation

a)

Sentential Form

b)

Leftmost Derivations

c)

Ambiguity

d)

EBNF

12.

a grammar that may generate more than one distinct parse trees for the same expression is ambiguous

a)

Sentential Form

b)

Leftmost Derivations

c)

Ambiguity

d)

EBNF

13.

a specific order of symbol replacement in senential forms - the replaced nonterminal is always the left-most non-terminal in the previous sentential form

a)

Sentential Form

b)

Leftmost Derivations

c)

Ambiguity

d)

EBNF

14.

extended BNF, designed to enhance readability for humans - no other benefit

a)

Sentential Form

b)

Leftmost Derivations

c)

Ambiguity

d)

EBNF

15.

the abstraction being defined

a)

In BNF: left-hand side

b)

In BNF: right-hand side

c)

In BNF: LHS and RHS

d)

Nonterminal

e)

Terminal

16.

consists of some mixture of tokens, lexemes, and references to other abstractions

a)

In BNF: left-hand side

b)

In BNF: right-hand side

c)

In BNF: LHS and RHS

d)

Nonterminal

e)

Terminal

17.

a rule or production

a)

In BNF: left-hand side

b)

In BNF: right-hand side

c)

In BNF: LHS and RHS

d)

Nonterminal

e)

Terminal

18.

abstractions (left-hand side) of rules

a)

In BNF: left-hand side

b)

In BNF: right-hand side

c)

In BNF: LHS and RHS

d)

Nonterminal

e)

Terminal

19.

lexems and tokens (right-hand side) of rules

a)

In BNF: left-hand side

b)

In BNF: right-hand side

c)

In BNF: LHS and RHS

d)

Nonterminal

e)

Terminal

20.

pattern matcher for character strings, "front-end". identifies substrings of the source program (lexemes) that belong together

a)

Lexical Analyzer

b)

Syntax Analyzer

c)

Top-down Parser

d)

Bottom-up Parsing

21.

analyze structure of a program through lexical units

a)

Lexical Analyzer

b)

Syntax Analyzer

c)

Top-down Parser

d)

Bottom-up Parsing

22.

invented by John Buckus to describe syntax of Algol 58, is equivalent to cfg

a)

Backus- Naur Form

b)

Context-free grammar

c)

Parse Tree

d)

Attribute Grammars

23.

developed by Noam Chomsky, language generators, used to describe the syntax of natural language

a)

Backus- Naur Form

b)

Context-free grammar

c)

Parse Tree

d)

Attribute Grammars

24.

Regular Grammars

a)

are used to describe tokens

b)

equivalate in power to finite state machines

c)

equivalate in power regular expression

d)

more powerful in cfg