CS4337 Quiz #3

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Sentence

1. [Sebesta03] A(n) _____ is a string of characters over some alphabet.

A. {b > 0}

12. [Sebesta03] Consider the following analysis of a program, as discussed in the class. {...} a = b + 1 {a > 1} Looking at post-condition of { a > 1} after execution of (a=b+1). Its weakest precondition is ___.

D. b > 3 / 2

13. [Sebesta03] Compute the weakest precondition for each of the following assignment statement and postcondition: a = 2 * (b - 1) - 1 {a > 0}

E. c > 8

14. [Sebesta03] Compute the weakest precondition for each of the following assignment statement and postcondition: b = (c + 10) / 3 {b > 6}

E. b > 1 - a / 2

15. [Sebesta03] Compute the weakest precondition for each of the following assignment statement and postcondition: a = a + 2 * b - 1 {a > 1}

D. 2 * y + x > 12

16. [Sebesta03] Compute the weakest precondition for each of the following assignment statement and postcondition: x = 2 * y + x - 1 {x > 11}

A. ambiguous

17. [Sebesta03] A grammar is ____ if and only if it generates a sentential form that has two or more distinct parse trees

B. denotational semantics

18. [Sebesta03] The meaning of language constructs are defined by only the values of the program's variables. That is, the state of a program is the values of all its current variables.

A. operational semantics

19. [Sebesta03]. ____ describes the meaning of a program by executing its statements on a machine, either simulated or actual.

Language

2. [Sebesta03] A(n) ____ is a set of sentences

assertion

20. [Sebesta03].. _____ is a logic expression in Axiomatic Semantics

A. precondition

21. [Sebesta03] _____ is an assertion before a statement stating the relationships and constraints among variables that are true at that point in execution

B. postcondition

22. [Sebesta03]. _____ is an assertion following a statement which states the relationships and constraints among variables that are true after that point in execution

B. terminal

23. [Sebesta03]. _____ is lexeme or token, and shows only in right-hand side of a grammar rule.

A. weakest precondition

24. [Sebesta03]. _____ is the least restrictive precondition that will guarantee the postcondition.

D. semantics

25. [Sebesta03]. _____ is the meaning of the expressions, statements, and program units.

C. axiomatic

26. [Sebesta03].. _____ semantics is based on formal logic (predicate calculus)

B. denotational

27. [Sebesta03].. _____ semantics is the semantics based on recursive function theory

B. context-free grammar

28. [Sebesta03] _____, which is also called (or in) BNF, is the most common approach for describing syntax.

A. Terminal symbols

29. [Sebesta03] Consider the formal definition of context free grammars by Noam Chomsky where a grammar <Σ, N, P, S> consists of four parts where the first component is a finite set Σ of ________, the alphabet of the language, which are assembled to make up the sentences in the language.

D. Lexeme

3. [Sebesta03] A(n) _____ is the lowest level syntactic unit of a language (e.g., +, *, 123, ...).

B. Nonterminal symbols

30. [Sebesta03] Consider the formal definition of context free grammars by Noam Chomsky where a grammar <Σ, N, P, S> consists of four parts where the second component is a finite set N of ________, each of which represents some collection of subphrases of the sentences.

C. Production rules

31. [Sebesta03] Consider the formal definition of context free grammars by Noam Chomsky where a grammar <Σ, N, P, S> consists of four parts where the third component is a finite set P of _______ that describe how each nonterminal is defined in terms of terminal symbols and nonterminals.

B. Nonterminals

32. [Sebesta03] Consider the formal definition of context free grammars by Noam Chomsky where a grammar <Σ, N, P, S> consists of four parts. The choice of _______ determines the phrases of the language to which we ascribe meaning.

D. Starting symbol

33. [Sebesta03] Consider the formal definition of context free grammars by Noam Chomsky where a grammar <Σ, N, P, S> consists of four parts where the fourth component is a distinguished nonterminal S, the _____, that specifies the principal category being defined—for example, sentence or program.

C. The symbol ("<variable list>") is a terminal symbol.

34. [Sebesta03] Consider the following the notation for a grammar rule: <declaration> ::= int <variable list> ;Which one of the following choices is NOT CORRECT?

A. ambiguous

35. [Sebesta03] The following expr grammar is ____. <expr> → <expr> + <expr> | const

A. attribute grammar

36. [Sebesta03] The following grammar is an example of _____. <var>[1].actual_type ← lookup (A) <var>[2].actual_type ← lookup (B) <var>[1].actual_type =? <var>[2].actual_type

LHS appears in its RHS

37. [Sebesta03] Define a left recursive grammar rule

generates sentences of a language

38. [Sebesta03] Descibe the operation of a genral language language generator

reads input strings over the alphabet of the language and decides whether the input strings belong to the language

39. [Sebesta03] Descibe the operation of a genral language language recognizer

I. Token

4. [Sebesta03] A(n) _____ is a category of lexemes (e.g., identifier)

•Optional parts are placed in brackets [ ] •Deals with multiple choice options. The options are placed in parentheses and separated by OR operator •Repetitions (0 or more) are placed inside braces { }

40. [Sebesta03] what are three extensions to most EBNF?

to state the static semantic rules of the language; associated with grammar rule

41. [Sebesta03] What is a prediate transformer function?

An assertion before a statement (a precondition) states the relationships and constraints among variables that are true at that point in execution

42. [Sebesta03] what is the precondition of a given statement in aximatic semantic?

An assertion following a statement is a postcondition describes a new condition of those variables after execution of statement

43. [Sebesta03] what is the postcondition of a given statement in aximatic semantic?

Static sematics is only indirectly related to the meaning of the program; rather, it has to deal with the legal forms of programs. Static semantic is so named because the nalyisis can be done during compile time.

44. [Sebesta03] what is statis semantic?

Meaning of expression, statements and program units

45. [Sebesta03] what is dynamic semantic?

+, -, *, /, [0,..,9]+

46. [Sebesta03] What are the terminal symbols?

C. Noam Chomsky

5. [Sebesta03] Context-Free Grammars is developed by ____ in the mid-1950s.

A. nonterminal

6. [Sebesta03] In BNF, a rule has a left-hand side (LHS), which is/are _____

G. Sentence

7. [Sebesta03] A(n) ____ is a sentential form that has only terminal symbols

LL

8. [Sebesta03] Leftmost derivation is used in ____ parsing.

C. operational

The "disassemble" Lisp function provides an ____ semantics of a program.

B. <expr> <expr> + <term> | <term> <term> <term> * const | const

[Sebesta03] The following grammar is ambiguous. <expr> <expr> <op> <expr> | const <op> * | + Which one of the following grammar is equivalent to this grammar but not ambiguous?

E. An attribute can be inherited but not synthesized.

[Sebesta03] Which one of the following statements is NOT correct? For an attribute grammar, ___

No, because LHS doesn't appear at RHS

[Sebesta03] is the grammar recursive? Why?


संबंधित स्टडी सेट्स

Os parietale + os lacrimale + os nasale + vomer

View Set

Chapter 1 : Radiation Basics and Dental Image Characteristics

View Set

Overview of Current Use - Health informatics

View Set

Chapter 9: Biotechnology and Recombinant DNA

View Set

12.10 Firewalls & Network Appliances

View Set