CSCI 316: Quiz 3 - Syntax and Semantics
Sign in to Google
to save your progress.
Learn more
* Indicates required question
Email
*
Your email
Last Name
*
Your answer
First Name
*
Your answer
Student Id
*
Your answer
The primary purpose of a formal syntax description is to:
*
1 point
Improve execution efficiency
Define the legal structure of programs
Specify run-time behavior
Describe program meaning
Enforce type safety
Backus–Naur Form (BNF) is used to describe:
*
1 point
Program syntax
Dynamic semantics
Program execution order
Memory allocation
Static semantics
In BNF, the symbol ::= means:
*
1 point
Is equivalent to
Is derived from
Is defined as
Is equal to
Is evaluated as
In BNF, angle brackets (< >) are used to denote:
*
1 point
Terminals
Keywords
Nonterminals
Operators
Literals
A terminal symbol in a grammar is one that:
*
1 point
Appears only on the left-hand side
Is optional
Can be expanded further
Represents semantic rules
Represents actual program tokens
A nonterminal symbol is best described as:
*
1 point
Run-time entity
Placeholder for language construct
Literal token
Semantic rule
Reserved word
Which of the following is true of a context-free grammar?
*
1 point
Each production has a single nonterminal on the left
It cannot describe programming languages
It defines execution behavior
Right-hand sides must contain terminals only
Left-hand sides may have multiple symbols
A parse tree represents:
*
1 point
Type checking results
A hierarchical syntactic structure
Compiler optimizations
Program execution order
Memory layout
Two different parse trees for the same string indicate:
*
1 point
A. Left recursion
C. Grammar ambiguity
B. Operator precedence
E. Lexical ambiguity
D. Static semantic error
Ambiguity in a grammar is undesirable primarily because it:
*
1 point
Prevents compilation
Requires dynamic typing
Reduces readability
Makes parsing inefficient
Leads to multiple meanings for the same program
Which technique is commonly used to eliminate ambiguity in expressions?
*
1 point
Adding semantic rules
Removing recursion
Using denotational semantics
Defining operator precedence and associativity
Using attribute grammars
Extended BNF (EBNF)
*
1 point
Improve grammar readability
Replace BNF completely
Eliminate parse trees
Describe semantics
Increase expressive power
In EBNF, { X } means:
*
1 point
X must appear once
X is optional
One or more repetitions of X
X is a terminal
Zero or more repetitions of X
In EBNF, [ X ] indicates that X:
*
1 point
Is optional
Is ambiguous
Is required
Is recursive
Is repeated
Static semantics primarily concerns:
*
1 point
Meaning of program output
Run-time errors
Program execution order
Memory management
Context-sensitive constraints
Which of the following is a static semantic rule?
*
1 point
Division by zero is illegal
Stack overflow detection
Variables must be declared before use
Instructions are fetched sequentially
Loops must terminate
An attribute in an attribute grammar is used to:
*
1 point
Allocate memory
Replace parse trees
Store semantic information
Define syntax rules
Control execution flow
Which of the following is an example of an attribute?
*
1 point
<expression>
If keyword
{ } repetition
::=
Type of an identifier
Semantics deals primarily with:
*
1 point
Program parsing
Program structure
Program meaning
Program formatting
Program size
Which semantic approach describes meaning by simulating execution?
*
1 point
Attribute grammars
Denotational semantics
Axiomatic semantics
Operational semantics
Static semantics
The primary advantage of denotational semantics is that it is:
*
1 point
Informal and intuitive
Execution-based
Easy for beginners
Mathematically rigorous
Implementation-specific
Axiomatic semantics is based on:
*
1 point
Assertions about program states
State machines
Mathematical functions
Grammar rules
Attribute propagation
In axiomatic semantics, a postcondition specifies:
*
1 point
Grammar derivation
Execution order
Parsing success
Final program state
Initial variable bindings
Which semantic method is most useful for proving program correctness?
*
1 point
Static
Axiomatic
Operational
Denotational
Dynamic
Which semantic method most closely resembles how interpreters work?
*
1 point
Static
Operational
Axiomatic
Denotational
Attribute-based
Static semantics are usually enforced:
*
1 point
During linking
During execution
By the operating system
At compile time
By the programmer manually
Which of the following is NOT typically part of syntax description?
*
1 point
Operator precedence
Program structure
Expression formation rules
Variable type compatibility
Valid statement forms
Which approach to semantics is most abstract and implementation-independent?
*
1 point
Axiomatic
Attribute grammars
Denotational
Parsing-based
Operational
Attribute grammars help bridge the gap between:
*
1 point
Lexical analysis and parsing
Programs and machines
Syntax and semantics
Static and dynamic typing
Compilation and execution
The main role this chapter topic is to:
*
1 point
Teach a programming language
Describe language history
Provide formal tools for language description
Explain compiler construction in detail
Compare programming paradigms
A copy of your responses will be emailed to the address you provided.
Submit
Clear form
Never submit passwords through Google Forms.
reCAPTCHA
Privacy
Terms
This content is neither created nor endorsed by Google. -
Terms of Service
-
Privacy Policy
Does this form look suspicious?
Report
Forms
Help and feedback