Question 1 (5 points) Which of the following is not a kind of model for dynamic
ID: 3853760 • Letter: Q
Question
Question 1 (5 points)
Which of the following is not a kind of model for dynamic semantics?
Question 1 options:
Operational semantics
Axiomatic semantics
Static semantics
Denotational semantics
Save
Question 2 (5 points)
When it is possible to produce two different parse trees for the same sentence using a particular grammar, what kind of grammar is that?
Question 2 options:
A BNF grammar
A left linear grammar
A context free grammar
An ambiguous grammar
Save
Question 3 (5 points)
When a program violates a type checking rule of a language, its compiler will most likely generate which of the following kinds of error?
Question 3 options:
Linker error
Static semantic error
Lexical error
Syntax error
Save
Question 4 (5 points)
Which of the following is required to verify that a sentence is in a language defined by a grammar?
Question 4 options:
Creating a parse tree or a derivation
Creating a derivation only
Creating a parse tree only
Creating a new grammar
Save
Question 5 (5 points)
Which of the following types of productions will cause problems for a recursive descent parser?
Question 5 options:
Any nonrecursive production
Left recursive productions
Any recursive production
Right recursive productions
Save
Question 6 (5 points)
Which of the following dynamic semantic models defines the meaning of a program by stating pre and postconditions?
Question 6 options:
Axiomatic semantics
Static semantics
Operational semantics
Denotational semantics
Save
Question 7 (5 points)
What language rules does an attribute grammar incorporate beyond what an ordinary context-free grammar provides?
Question 7 options:
Dynamic semantic rules
Static semantic rules
Lexical rules
Syntax rules
Save
Question 8 (5 points)
A recursive descent parser is which of the following kinds of parser?
Question 8 options:
Top down parser
Shift-reduce parser
Bottom up parser
LR parser
Save
Question 9 (5 points)
Which of the following is output of the lexical analyzer?
Question 9 options:
Symbols and phrases
Terminals and nonterminals
Tokens and lexemes
Productions and rules
Save
Question 10 (5 points)
Which semantic model is based on lambda calculus?
Question 10 options:
Denotational semantics
Axiomatic semantics
Static semantics
Operational semantics
Save
Question 11 (5 points)
Which semantic model uses inference rules to define the meaning of statements?
Question 11 options:
Denotational semantics
Static semantics
Operational semantics
Axiomatic semantics
Save
Question 12 (5 points)
Inference rules are used to define the meaning of statements in which of the following models for dynamic semantics?
Question 12 options:
Operational semantics
Denotational semantics
Axiomatic semantics
Static semantics
Save
Question 13 (5 points)
In the rule or production of a context-free grammar, what appears on the left side of every production?
Question 13 options:
A lexeme
A terminal symbol
A token
A nonterminal symbol
Save
Question 14 (5 points)
Given the following grammar, which of the following sentences is in the language it generates? S -> aB, B -> bB | b
Question 14 options:
ab
abba
aabbb
ba
Save
Question 15 (5 points)
How many sentences are in the language generated by the following grammar? S -> aB, B -> bB | b
Question 15 options:
An infinite number
0
1
8
Save
Question 16 (5 points)
Which of the following is a correct English description of the language defined by the following grammar? S -> Ba, B -> Bb | b
Question 16 options:
Any number of b's followed by one a
Any number of a's followed by one b
Any number of b's followed by any number of a's
One b followed by any number of a's
Save
Question 17 (5 points)
Which dynamic semantic model involves translating a program into a language that contains conditional and unconditional gotos?
Question 17 options:
Axiomatic semantics
Operational semantics
Static semantics
Denotational semantics
Save
Question 18 (5 points)
In recursive descent parsing, what is the relationship between the parser and the lexical analyzer?
Question 18 options:
The lexical analyzer repeatedly calls the parser
The lexical analyzer calls the parser only once
The parser repeatedly calls the lexical analyzer
The parser calls the lexical analyzer only once
Save
Question 19 (5 points)
What type of production has the symbol on the left side of a production as the last symbol on the right side?
Question 19 options:
Any recursive production
A left recursive production
Any nonrecursive production
A right recursive production
Save
Question 20 (5 points)
Given the following grammar for an expression: exp -> exp op factor | factor, the parse trees generated by this grammar reflect what type of operator associativity?
Question 20 options:
Center associative
Nonassociative
Left associative
Right associative
Operational semantics
Axiomatic semantics
Static semantics
Denotational semantics
Explanation / Answer
1.answer is static semantics
explanation: static semantics are differ from dynamic semantics
2.answer is An ambiguous grammar
explanation:Two parse trees for same strin
3. static semantic error
explanation:semantic analysis, where we delve evendeeper to check whether they form a sensible set of instructions in the programming language.
explanation:to verify that a sentence is in a language defined by a grammar we need pares tree
5.any non recursive productions
explanation: while using non recursive productions they causes recursion problems
6. Axiomatic Semantics
explanation:• The logical expressions used in axiomatic semantics are called assertions. • Precondition: an assertion immediately preceding a statement that describes the constraints on the program variables at that point. • Postcondition: an assertion immediately following a statement that describes the new constraints on some variables after the execution of the statement.
7.static semantic rule
explanation:
8.top down parser:
explanation: top-down parsing technique parses the input, and starts constructing a parse tree from the root node gradually moving down to the leaf nodes
9.tokens and lexemes
explanation:lexical analyzer breaks these syntaxes into a series of tokens, by removing any whitespace or comments in the source code
10.static semantics
explanation: these are possess lambda calculus
11.axiomic semantics
explanation: Axiom: logical statement that is assumed to be true.
Inference rule: method of inferring the truth of one assertion on the basis of the values of other assertions.
12.axiomic semantics
explanation: Axiom: logical statement that is assumed to be true.
Inference rule: method of inferring the truth of one assertion on the basis of the values of other assertions.
13.correct answer is non terminal symbol
explanation:The left-hand side of the production rule is also always a nonterminal symbol
14.option ab is correct answer
explanation: the language has single a at starting of setence
15. it generate an infinite number of setences
explanation: ab,abb,abbb....
16.any number of b's followed by one a
17.operational semantics
explanation:dynamic semantic model involves translating a program into a language that contains conditional and unconditional gotos
18.The parser repeatedly calls the lexical analyzer
explanatiom:the parser will repeatedly call the scanner to read all the tokens from the input stream
19.a right recursive production
explanation:production has the symbol on the left side of a production as the last symbol on the right side
20. Left associative
explanation:production has the symbol on the left side of a production as the first symbol on the right side
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.