Quiz
CS4337 Exam 1
This quiz has question types that open in the usual player.
Questions in this quiz (151)
1In the context of a programming language, an examples of ____ in C is a function can return a value of any type, except for an array type or a function type.
- Anon-readability
- Bnon-writability
- Cnon-expressibility
- Dnon-maintainability
- Enon-orthogonality
2In the context of a programming language, this is about the existence of multiple ways of doing the same operation. Examples: incrementing a variable in C-based syntax, looping constructs (while, do while, for), Java's conditional ternary operator (?:).
- Amultiple aliasing
- Bmultiple operator
- Cfeature multiplicity
- Doperator overloading
- Eorthogonal multiplicity
3In the context of a programming language, the degree of orthogonality is ____ if particular combinations are forbidden (as exceptional cases) or the meaning of a particular combination is not evident from the meanings of its component parts, each one considered without regard to context.
- Alessened
- Bincreased
- Cminimized
- Dmaximized
- Eoptimized
4In the context of a programming language for its cost, which of the following is not one of the primary concerns?
- ATraining programmers as cost is a function of simplicity of language
- BWriting and maintaining programs as cost is a function of readability and writability.
- CCompiling programs, for very large systems, can take a significant amount of time.
- DArray index can or should begin with 0 or 1, or any number.
- EExecuting programs at run-time with various features can be very expensive.
5In the context of a programming language, this can aid readability if used with discretion, but can lessen readability if used unwisely (e.g., by using + as a comparison operator).
- Afunctional closure
- Boperator overloading
- Cparametric polymorphism
- Dvirtual inheritance
- Eoperator inheritance
6In the context of a programming language, a language that allows you to express computations/algorithms very concisely (such as APL, with its collection of powerful array and matrix operators) also tends to be difficult to read.
- AReliability vs cost (of execution)
- BWritability vs. readability
- CWritability vs. reliability
- DPortability vs. Generality
7In the context of a programming language, this is enhanced by the presence of powerful operators that make it possible to accomplish a lot in a few lines of code. The classic example is APL.
- Areadability
- Bwritability
- Cexpressibility
- Dmaintainability
- Eorthogonality
8In the context of a programming language, functional languages tend to be very ____, in part because functions are "first-class" entities which can be passed as parameters.
- Areadable
- Bwritable
- Cexpressible
- Dmaintainable
- Ereliable
9In the context of a programming language, this is a measure of how easily a language can be used to develop programs for a chosen problem domain.
- Areadability
- Bwritability
- Creliability
- Dcost
- Eorthogonality
10In the context of a programming language, this refers to the ease with which programs (in the language under consideration) can be understood. This is especially important for software maintenance.
- Areadability
- Bwritability
- Creliability
- Dcost
- Eorthogonality
11In the context of a programming language, ___ is the property of performing to specifications under all conditions.
- Areadability
- Bwritability
- Cexpressibility
- Dmaintainability
- Ereliability
12In the context of a programming language, this is the ease with which programs that work on one platform can be modified to work on another. This is strongly influenced by to what degree a language is standardized.
- Areadability
- Bexpressibility
- Cportability
- Dwell-definedness
- Egenerality
13In the context of a programming language, which one is not a primary concern influencing its reliability?
- Atype-checking
- Baliasing
- Creadability
- Dwritability
- Eexecutable
14In the context of a programming language, typically assembly/machine languages lack ___ in that each operation does something relatively simple, which is why a single instruction in a high-level language could translate into several instructions in assembly language.
- Areadability
- Bwritability
- Cexpressibility
- Dmaintainability
- Ereliability
15In the context of a programming language, a set of features/constructs is said to be _____ if those features can be used freely in combination with each other.
- Areadable
- Bwritable
- Corthogonal
- Dflexible
- Edynamic
16______ is the most popular server-side programming language
- AC#
- BJava
- CPHP
- DHTML
17______ was developed as a systems programming language for the development of UNIX.
- AC
- BPascal
- CAlgol
- DJava
18_____ is invented to describe the syntax of Algol 58
- ABNF
- BFORTRAN
- CLisp
- Dalgorithm
19One of the Functional programming languages is _______
- AFortran
- BCobol
- CLisp
- DProlog
20_____ is for the evaluation criteria for the conformance to specifications (i.e., performs to its specifications).
- AReadability
- BWritability
- CReliability
- DOrthogonality
21______ is the evaluation criteria for the ease with which programs can be understood
- AReadability
- BWritability
- CReliability
- DOrthogonality
22_____ is for the evaluation criteria for the ease with which a language can be used to create programs
- AReadability
- BWritability
- CReliability
- DOrthogonality
23____ is a set of technologies by Sun/Oracle that allows programmers to develop and deploy Web services for a company.
- AJIT
- BJavaScript
- CJava EE
- DJavaBooster
24John Backus was instrumental in the development of the first 3rd generation programming language called ____
- AFortran
- BCobol
- CLisp
- DBasic
25The major AI language for the period 1960 through the 1990s was ______.
- AFortran
- BCobol
- CLisp
- DBasic
26The major commercial language for the period 1960 through the 1990s was ____.
- AFortran
- BCobol
- CLisp
- DBasic
27This ______ feature or criteria is about a relatively small set of primitive constructs which can be combined in a rela-tively small number of ways, and every possible combination is legal.
- AReadability
- BWritability
- CReliability
- DOrthogonality
28One of the logic programming languages is ______
- AJava
- BLogos
- CLisp
- DProlog
29What is the result of: (eval (list 'eval nil))
- A(t nil)
- B(t)
- Ct
- Dnil
30What is the result of the following Lisp function?
(length '(1 2 3 4))- A0
- B1
- C3
- D4
- E(1 2 3 4)
31What is the result of the following Lisp function?
(length '((ONE) FOR ALL (AND (TWO (FOR ME)))))- A1
- B3
- C4
- Dundefined
- E( 3 3 3 3)
32What is the result of the following Lisp function?
(length '((OPEN) (THE POD BAY DOORS) HAL))- A1
- B3
- C6
- Dundefined
- E( (1) (4) 1 )
33What is the result of (mapcar #'try '(1 3 5)) for the following program try: (defun try (n) (+ 2 n))
- A(1 3 5)
- B(2 4 6)
- C(3 5 7)
- D(5 3 1)
34Given
(setf line ’(roses are red))
What is the result of:
(nth 1 line)- Arose
- Bare
- Croses
- DT
- ENIL
35What is the result of (+ 1 2 3)
- A0
- B1
- C2
- D3
- E6
36What is the parenthesis notation for this cons cell structure?

- ARED GREEN BLUE
- B(RED GREEN BLUE)
- C(RED) (GREEN) (BLUE)
- D((RED) (GREEN) (BLUE))
- E(RED GREEN BLUE NIL)
37What is the result of: (mapcar #'zerop '(2 0 -5))
- A(nil t nil)
- B(nil nil nil)
- C(t nil t)
- Dnil
38What is the result of the following Lisp function?
(length '((1 2 3) (4 5 6) (7 8 9) (10 11 12)))- A1
- B3
- C4
- Dundefined
- E( 3 3 3 3)
39What is the result of: (+ (- 5 2) 3)
- A2
- B3
- C5
- D6
- E0
40What is the result of the following expression: (eq '(a b) '(a b))
- At
- Bnil
- C(t t)
- D(nil nil)
41Given
(setf line ’(roses are red))
What is the result of:
(append line (list (first line)))- A(roses are red)
- B(roses are red (roses))
- C(roses are red roses)
- D(roses roses are red)
- Eroses are red roses
42Given
(setf line ’(roses are red))
What is the result of:
(first (last line))- Aroses
- B(red are roses)
- Cred
- D(red)
43What is CADR of the following expression? ((BLUE CUBE) (RED PYRAMID))
- A(RED)
- B(PYRAMID)
- C(RED PYRAMID)
- D((RED PYRAMID))
44What is a lambda expression to subtract 7 from a number.
- A(lambda (n) (return (- n 7)))
- B(lambda f(n) (- n 7))
- C(lambda n (- n 7))
- D(lambda (n) (- n 7))
45What is the result of: (+ 1 2)
- A1
- B2
- C3
- D0
- E(+ 1 2)
46What is the result of: (eval nil)
- A(nil)
- B(t)
- Ct
- Dnil
47What is the result of the following expression: (equal '(a b) '(a b))
- At
- Bnil
- C(t t)
- DNone of the above
48What is the result of: (apply #'cons '(t nil))
- A(cons t nil)
- B(t)
- Ct
- Dnil
49What is the length of the following list? ((OPEN) (THE POD BAY DOORS) HAL)
- A2
- B3
- C4
- D6
50What is the parenthesis notation for this cons cell structure?

- A(BOWS ARROWS FLOWERS CHOCOLATES)
- B(BOWS ARROWS) (FLOWERS CHOCOLATES)
- C((BOWS ARROWS) NIL)
- D((BOWS ARROWS) (FLOWERS CHOCOLATES))
- E((BOWS ARROWS NIL) (FLOWERS CHOCOLATES NIL) NIL)
51What is the result of: (eval (list 'cons t nil))
- A(t nil)
- B(t)
- Ct
- Dnil
52Given
(setf line ’(roses are red))
What is the result of:
(list (first line) (last line))- A(red roses are red)
- B(roses are red (roses))
- C(roses are red roses)
- D(roses (red))
- ENIL
53What is the parenthesis notation for this cons cell structure?

- A(BRAIN SURGEONS NEVER SAY OOPS)
- B((BRAIN SURGEONS) (NEVER) (SAY OOPS))
- C((BRAIN SURGEONS) NEVER (SAY OOPS))
- D((BRAIN SURGEONS) (NEVER) (SAY OOPS)))
- E((BRAIN SURGEONS NIL) NEVER (SAY OOPS NIL) NIL)
54What is the result of: (list 'cons t nil)
- A(cons t nil)
- B(t)
- Ct
- Dnil
55Using the list
( ( A B) (C D) (E F) )
Match the result for each Lisp expression.
For example, "car" is for the result of: (car ( ( A B) (C D) (E F) ) )
Question My Answer All Answer Choices
CAR: ___[blank_start]A[blank_end]___
CAAR: ___[blank_start]N[blank_end]___
CADR: ___[blank_start]I[blank_end]___
CADAR: ___[blank_start]O[blank_end]___
CDAR: ___[blank_start]E[blank_end]___
CDDAR: ___[blank_start]C[blank_end]___
CDADDR: ___[blank_start]F[blank_end]___
CADADDR: ___[blank_start]M[blank_end]___
CDR: ___[blank_start]G[blank_end]___
CDADR: ___[blank_start]J[blank_end]___
All Answer Choices
A. (A B)
B. (E F)
C. NIL
D. C
E. (B)
F. (F)
G. ( (C D) (E F) )
H. (C)
I. (C D)
J. (D)
K. ( (A B) )
L. D
M. F
N. A
O. B- AA
- BN
- CI
- DO
- EE
- FC
- GF
- HM
- IG
- JJ
56What is the result of the following expression: (eql 3 3.0)
- At
- Bnil
- C(t t)
- D(nil nil)
57Given
(setf line ’(roses are red))
What is the result of:
(cons (last line) line)- A(red roses are red)
- B(roses are red (roses))
- C(roses are red roses)
- D((red) roses are red)
- ENIL
58Given
(setf line ’(roses are red))
What is the result of:
(reverse line)- A(roses are red)
- B(red are roses)
- Ct
- Dnil
59Java is ____ typed.
- Astrongly
- Bweakly
- Cdynamically
- Dstatically
- Enone of the above
60Which is not one of three concepts which are the basis for object-oriented programming?
- Aclasses
- Bobjects
- Cmethods
- Devent
61What language was designed to describe the syntax of ALGOL 60?
- ABNF
- BFORTAN
- CLOGIC
- DFLOWCHART
- EDIAGRAM
62What was the primary application area of computers at the time Fortran was designed?
- AScientific computing
- BBusiness Data Processing
- CAI Development
- DPedagogical Programming
63Which programming language provided recursive function in 1959.
- AFORTRAN
- BCOBOL
- CLISP
- DBASIC
- EALGOL 59
64Today's popular server-side programming with Java is with ___.
- Aservlet
- BJSP
- CJSF
- DPHP
- EJavaScript
65How does the typing system of PHP and JavaScript differ from that of Java?
- Astrongly
- Bweakly
- Cdynamically
- Dstatically
- Enone of the above
66One of the professional organization or institute designed ALGOL 60 is ___.
- AACM
- BIEEE
- CINFORM
- DStanford University
- EMIT
67Which language is influenced by ALGOL 60?
- APL/I
- BC/C++
- CJava
- DC#
- EProlog
- FAda
68The primary feature of Smalltalk is __.
- Afunctional
- Blogical
- Cprocedural
- Dobject-oriented
- Eexception-handling
69What characteristic of Java is most evident in JavaScript?
- Asimilar syntax
- Bsimilar semantics
- Csimilar type system
- Dsimilar scoping mechanism
70What feature of Java makes it safer than C++?
- Aeliminate many assignment coercions of C++
- Bindex range checking of array accesses
- Cenhancing the scope of applications with the concurrency
- Dplatform-independency
- EAll of the above
71Which is a nonprocedural language?
- AFORTRAN
- BC/C++
- CJava
- DC#
- EProlog
- FALGOL 60
72What was the most significant feature added to Fortran I to get Fortran II?
- AIF statement for selection
- BIF statement with ELSE clause
- Cuser-defined subroutine
- Dindependent compilation of subroutine
- Edynamic array
73What are the two kinds of statements that populate a Prolog database?
- Afacts and rules
- Binduction and deduction
- Crecursion and concurrency
- Dobject and method
- Elogic and case
74Pure Lisp has/provides only the data structure(s) of ___.
- Aatom
- Blist
- Catom and list
- Dfunction
- Eatom, list, function
75What is a language feature or construct supported by ALGOL 60?
- AThe concept of block structure
- Bpass by value and pass by name for parameter passing
- Crecursive procedure
- Dstack-dynamic array
- Eall of the above
76What was not a language feature or construct of Fortran I?
- AIF statement for selection
- BDo statement for loop
- CIO formatting
- Duser-defined subroutine
- EIF statement with ELSE clause
77In Lisp, a nested list structure is specified by ___.
- Abrace
- Bbracket
- Cparenthesis
- Dpointer
- Elinked list
78____ describes the meaning of a program by executing its statements on a machine, either simulated or actual.
- Aoperational semantics
- Bdenotational semantics
- Caxiomatic semantics
- Dfunctional semantics
79_____ is lexeme or token, and shows only in right-hand side of a grammar rule.
- ACFG
- BTerminal
- Cderivation
- Dparsing
80_____ form is the string of symbols (nonterminals and terminals) in a derivation
- Asentential
- BBackus Nauer
- Clexical
- DObject Oriented
81_____ is the meaning of the expressions, statements, and program units.
- Asource program
- Bparsing
- Csyntax
- Dsemantics
82_____ semantics is the semantics based on recursive function theory
- Aoperational
- Bdenotational
- Caxiomatic
- Dad-hoc
83_____ semantics is based on formal logic (predicate calculus)
- Arule-based
- Bdenotational
- Caxiomatic
- DOperational
84_____ is an assertion before a statement stating the relationships and constraints among variables that are true at that point in execution
- Aprecondition
- Bpostcondition
- Cincondition
- Dinvariant
85The change in the state of the machine (memory, registers, etc.) defines the meaning of the statement.
- Aoperational semantics
- Bdenotational semantics
- Caxiomatic semantics
- Dfunctional semantics
86_____ is the semantics originally developed by Scott and Strachey (1970)
- Arule-based
- Bdenotational
- Caxiomatic
- DOperational
87_____ is an assertion following a statement which states the relationships and constraints among variables that are true after that point in execution
- Aprecondition
- Bpostcondition
- Cincondition
- Dinvariant
88_____ is the least restrictive precondition that will guarantee the postcondition.
- Aweakest precondition
- Bstrongest assertion
- Cweakest assertion
- Daxiomatic precondition
89_____ is invented to describe the syntax of Algol 58
- ABNF
- BFORTRAN
- CLisp
- Dalgorithm
90_____ is equivalent to context-free grammars developed by John Backus
- ABNF
- BSemantics
- CCOBOL
- Dcompiler
91{I} is a(n) _____ in the following rule in a while-statement in axiomatic semantics: {I} while B do S {I and (not B)}
- Aloop invariant
- Bpostcondition
- Cstrongest condition
- Dwhile condition
92A grammar is ____ if and only if it generates a sentential form that has two or more distinct parse trees
- Aambiguous
- Battributed
- Cindefinite
- Ddistinctive
93The 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- Aattribute grammar
- Bfunctional grammar
- Cabstract grammar
- Dtype grammar
94The 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.
- Aoperational semantics
- Bdenotational semantics
- Caxiomatic semantics
- Dfunctional semantics
95_____ is a logic expression in Axiomatic Semantics
- Aassertion
- Bif-then
- Cdo-while
- Dconditional
96The following expr grammar is ____.
<expr> → <expr> + <expr> | const- Aambiguous
- Battributed
- Cindefinite
- Ddistinctive
97The ____ part in LR parser specifies what the parser should do, given the state symbol on top of the parse stack and the next token of input.
- Aaction
- Bgoto
- Cstate
- Dreduce
- Eshift
98_____, which is also called (or in) BNF, is the most common approach for describing syntax.
- Alexical analyzer
- Bcontext-free grammar
- Cshift-reduce grammar
- Dattribute grammar
- Estate transition
99_____ is normally based on a formal syntax description of the language being implemented.
- Astate analysis
- Bsyntax analysis
- Csemantic analysis
- Doptimization
- Ecode generation
100Every parser for a context-free programming language is a ____, because this is a recognizer for a context-free language.
- Afinite-state automaton
- Bpush-down automaton
- Ccontext-free grammar
- Dstate-table
- Ebottom-up parser
101Two goals of syntax analyzers are: (1) to detect syntax errors in a given program and (2) to produce a/an _____.
- Aexecutable
- Bparse tree
- Cinterpreter
- Dtokenizer
- Eobject
102Most compiler uses an efficient parser to implement syntax analyzers for programming language, working on subclasses of unambiguous grammars, and having complexity ___.
- AO(n)
- BO(n^2)
- CO(n^3)
- DO(n!)
- EO(2^n)
103The top symbol on the LR parse stack is always a ____ symbol that represents all of the information in the parse stack that is relevant to the parsing process.
- Astate
- Bsentential
- Ctransition
- Dshift-reduce
- Ego-to
104The original LR algorithm was designed by ____ in 1960’s.
- AKnuth
- BParr
- CBackus
- DTuring
- EMcCarthy
105Two distinct grammar characteristics prevent the construction of a recursive-descent parser based on the grammar. One is _____.
- Astate reduction
- Bparse stack
- Coptimization
- Dloop
- Eleft recursion
106For CFG, parsers that work for all unambiguous grammars have complexity ____ in gerenal.
- AO(n)
- BO(n^2)
- CO(n^3)
- DO(n!)
- EO(2^n)
107_____ parser is an LL parser that is implemented by writing code directly from the grammar of the source language. EBNF is ideal as the basis for this type of parsers and much easier and simpler to implement.
- Abottom-up
- BLALR
- CContext-Free
- Drecursive-descent
- EProlog
108_____ is a pattern matcher that isolates the small-scale parts (of a program) which are called lexemes.
- Abison
- Blexical analyzer
- Ccontext-free grammar
- Dsemantic analyzer
- Eparser
109The ____ table in LR parser is used to determine which state symbol should be placed on the parse stack after a reduction has been done.
- Aaction
- Bgoto
- Cstate
- Dtop-down
- Ebottom-up
110Syntax analyzers are either ____, meaning they construct leftmost derivations and a parse tree in top-down order, or ____, in which case they construct the reverse of a rightmost derivation and a parse tree in bottom-up order.
- Atop-down, bottom-up
- Bbottom-up, top-down
- Cleft to right, right to left
- Dtable-driven, grammar-driven
- Estack-oriented, tree-oriented
111Some grammars that fail the pairwise disjointness test often can be modified to pass it, using ____.
- Aoptimization
- Bminimization
- Cright-factoring
- Dleft-ording
- Eleft-factoring
112A ____ parser is called a shift-reduce algorithm, because in most cases it either shifts the next lexeme of input onto the parse stack or reduces the handle that is on top of the stack.
- ALR
- BLL
- CTop-down
- DRecursive-Descent
- ECFG
113LR parsers use two parsing tables: action and ____.
- Astate
- Bgoto
- Creduce
- Dshift
- Eerror
114Which one is correct?

- AThere are four phrases
- BThere are two simple phrases
- CThere is one handle
- DThere are two simple phrases.
- ENone of the above
115Current Stack: $ exp' term
Current Input: $
The next stack-content and input-string will be:
- AStack: $ exp'
Input: $ - BStack: $ exp' term'
Input: $ - CStack: $ exp' factor term'
Input: $ - DStack: $ exp' term' factor
Input: $ - ENone of the above
- AStack: $ exp'
116Current Stack: $ exp' term'
Current Input: + n $
The next stack-content and input-string will be:
- AStack: $ exp’ addop
Input: + n $ - BStack: $ exp'
Input: + n $ - CStack: $ exp’ +
Input: + n $ - DStack: $ exp’ +
Input: n $ - ENone of the above
- AStack: $ exp’ addop
117Some grammars that fail the pairwise disjointness test often can be modified to pass it, using ____.
- Aoptimization
- Bminimization
- Cright-factoring
- Dleft-ording
- Eleft-factoring
118Current Stack Content: 0
Current Input: id + id * id $
The Next stack-content and input-string will be:
- AStack: 0id
Input: + id * id $ - BStack: 0id5
Input: id + id * id $ - CStack: id5
Input: + id * id $ - DStack: 0id5
Input: + id * id $ - EStack: 0id5
Input: id + id * id $.
- AStack: 0id
119Current Stack: $ exp' term
Current Input: n $
The next stack-content and input-string will be:
- AStack: $ exp' term n
Input: $ - BStack: $ exp'
Input: n $ - CStack: $ exp' factor term'
Input: n $ - DStack: $ exp' term' factor
Input: n $ - EStack: $ exp' term'
Input: n $
- AStack: $ exp' term n
120Current Stack: $ exp' term' )
Current Input: ) $
The next stack-content and input-string will be:
- AStack: $ exp' term'
Input: $ - BStack: $ exp' term' )
Input: ) $ - CStack: $ exp' term' (
Input: $ - DStack: $ exp' )
Input: $ - ENone of the above
- AStack: $ exp' term'
121The ____ part in LR parser specifies what the parser should do, given the state symbol on top of the parse stack and the next token of input.
- Aaction
- Bgoto
- Cstate
- Dreduce
- Eshift
122Current Stack Content: 0F3
Current Input: + id * id $
The Next stack-content and input-string will be:
- AStack: 0T2
Input: + id * id $ - BStack: 0T4
Input: + id * id $ - CStack: 0R4
Input: + id * id $ - DStack: 0id5
Input: + id * id $ - EStack: 0F3T2
Input: + id * id $
- AStack: 0T2
123The top symbol on the LR parse stack is always a ____ symbol that represents all of the information in the parse stack that is relevant to the parsing process.
- Astate
- Bsentential
- Ctransition
- Dshift-reduce
- Ego-to
124Which one is correct?

- A"ab" is a complex phrase
- B"bBab" is a simple phrase
- C"bBab" is a simple phrase but not a handle
- D"ab" is a handle
- ENone of the above
125LR parsers use two parsing tables: action and ____.
- Astate
- Bgoto
- Creduce
- Dshift
- Eerror
126Current Stack Content: 0E1+6T9*7
Current Input: ) $
The Next stack-content and input-string will be:
- AStack: 0E1+6T9
Input: ) $ - BStack: 0E1+6T9*7F10
Input: ) $ - CStack: 0E1+6T9*7(4
Input: $ - DStack: 0E1+6T9
Input: $ - ENone of the above
- AStack: 0E1+6T9
127[Sebesta03] Consider the following parse tree, as discussed in the class. There is/are ___ phrases.

- A0
- B1
- C2
- D3
- E4
- F5
- G6
128[Sebesta03] Compute the weakest precondition for each of the following assignment statement and postcondition: a = a + 2 * b - 1 {a > 1}
- Aa > 1
- Ba > 2 * b
- Cb > 1
- Db > 2 + a
- Eb > 1 – a / 2
129[Sebesta03] Which one of the following statements is NOT correct? For an attribute grammar, ___
- AAn attribute grammar is a context-free grammar G = (S, N, T, P) with additional features.
- BFor each symbol x, there is a set A(x) of attribute values.
- CEach rule has a set of functions that define certain attributes of the nonterminals in the rule
- DEach rule has a (possibly empty) set of predicates to check for attribute consistency
- EAn attribute can be inherited but not synthesized.
130[Sebesta03] Compute the weakest precondition for each of the following assignment statement and postcondition: x = 2 * y + x - 1 {x > 11}
- Ax > 11
- Bx > 2 * y
- Cy > 1 / 2
- D2 * y + x > 12
- Ex > 11 – 2 * y
131[Sebesta03] In BNF, a rule has a left-hand side (LHS), which is/are _____
- Anonterminal
- Bterminal
- Ca string of terminals and/or nonterminals
- Dnull string (or lambda symbol)
- Esentential form
132[Sebesta03] Leftmost derivation is used in ____ parsing.
- ALL
- BLR
- CCYK
- Dstack-based
- ECFG
133[Sebesta03] Compute the weakest precondition for each of the following assignment statement and postcondition: a = 2 * (b - 1) - 1 {a > 0}
- Aa > 0
- Ba > 1
- Cb > 0
- Db > 3 / 2
- Eb > 1
134[Sebesta03] Consider the following parse tree, as discussed in the class. There is/are ___ simple phrases.

- A0
- B1
- C2
- D3
- E4
- F6
135[Sebesta03] Consider the following parse tree, as discussed in the class. Which one of the following selections is the handle?

- Aa
- Bb
- Cc
- Da + b
- E<A>
136[Sebesta03] The "disassemble" Lisp function provides an ____ semantics of a program.
- Aaxiomatic
- Bdenotational
- Coperational
- Dprimitive
- Eassembled
137[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 ___.- A{b > 0}
- B{b > 1}
- C{a > 0}
- D{a > 1}
- EIt cannot be determined
138[Sebesta03] A(n) ____ is a set of sentences
- AGrammar
- BHandle
- CLanguage
- DLexeme
- EPhrase
- FSentential Form
- GSentence
- HSimple Phrase
- IToken
139[Sebesta03] Compute the weakest precondition for each of the following assignment statement and postcondition: b = (c + 10) / 3 {b > 6}
- Ab > 6
- Bb > 8
- Cc > 0
- Dc > 10
- Ec > 8
140[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?- A<expr> → <expr> <op> <expr> | const
<op> → + - B<expr> → <expr> + <term> | <term>
<term> → <term> * const | const - C<expr> → <term> <op> <term> | <term>
<term> → <term> * const | const
<op> → * | + - D<expr> →
<expr> + <term> | <exp>
<term> → const * const | const - E<expr> → <expr> <op> <term> | const
<term> → <term> * const | const
<op> → + | *
- A<expr> → <expr> <op> <expr> | const
141[Sebesta03] A(n) _____ is the lowest level syntactic unit of a language (e.g., +, *, 123, …).
- AGrammar
- BHandle
- CLanguage
- DLexeme
- EPhrase
- FSentential Form
- GSentence
- HSimple Phrase
- IToken
142[Sebesta03] Consider the following parse tree, as discussed in the class. There is/are ___ phrases.

- A0
- B1
- C2
- D3
- E4
- F6
143[Sebesta03] A(n) _____ is a category of lexemes (e.g., identifier)
- AGrammar
- BHandle
- CLanguage
- DLexeme
- EPhrase
- FSentential Form
- GSentence
- HSimple Phrase
- IToken
144[Sebesta03] A(n) _____ is a string of characters over some alphabet.
- AGrammar
- BHandle
- CLanguage
- DLexeme
- EPhrase
- FSentential Form
- GSentence
- HSimple Phrase
- IToken
145[Sebesta03] A(n) ____ is a sentential form that has only terminal symbols
- AGrammar
- BHandle
- CLanguage
- DLexeme
- EPhrase
- FSentential Form
- GSentence
- HSimple Phrase
- IToken
146[Sebesta03] Context-Free Grammars is developed by ____ in the mid-1950s.
- ABackus-Naur
- BKurt Godel
- CNoam Chomsky
- DJohn McCarthy
- EAlain Colmerauer
147Write the expression X for which you obtain the following evaluation:
(my-func x (list x)) => (0 1 2 3 4 5 6 7 7)
when my-func is defined by:
(defun my-func (a l)
(cond ((= a 0) (cons a l))
(T (my-func (- a 1) (cons a l)))))- Ax is (7)
- Bx is 7
- Cx is (0 1 2 3 4 5 6 7)
- Dx is 8
148Write the expression X for which you obtain the following evaluation:
(equal x (cons (append '((a b)) (list 'b 'a)) (reverse (cons 'a (list 'b 'c)))))
=> T- Ax is ((A B) B A (C B A))
- Bx is ((A B) (B A) C B A))
- Cx is (((A B) B A) C B A)
- Dx is (((A B) B A) (C B A))
149Write a Lisp function DUP? that takes a list and returns true if it contains a duplicate entry (an atom), and false otherwise. Be sure to handle nested lists properly, e.g.
> (dup? '(a b a c d))
T
>(dup? '(a b (a) c d))
NIL
>(dup? '((a b) b c (a b)) ;;; (a b) is a list, not an atom. Use :test #'equal
T- A(defun dup? (x)
(cond
((<= (length xlist) 1) NIL)
((member (car xlist) (cdr xlist) ) T )
(T (dup? (cdr xlist)))
)) - B(defun dup? (xlist)
(cond
((<= (length xlist) 1) NIL)
((member (car xlist) (list xlist)) T)
(T (dup? (cdr xlist)))
)) - C(defun dup? (xlist)
(cond
((<= (length xlist) 1) NIL)
((member (car xlist) (cdr xlist) ) T )
(T (dup? (car xlist)))
)) - D(defun dup? (xlist)
(cond
((<= (length xlist) 1) NIL)
((member (car xlist) (cdr xlist) :test #'equal) T)
(T (dup? (cdr xlist)))
))
- A(defun dup? (x)
150Write the expression X for which you obtain the following evaluation:
(cons '(d c a) x) => ((D C A) A B (C))- Ax is (a b (c))
- Bx is ((a b (c)))
- Cx is (a b c)
- Dx is ((d c a) a b (c))
151Write the expression X for which you obtain the following evaluation:
(first x) => (GIRL BOY)
and
(second x) => MOTHER
and
(nth 2 x) => ((TEACHERS DRIVERS (COUSINS)))- Ax is (girl boy mother (teachers drivers (cousins)))
- Bx is ((girl boy) mother (teachers drivers (cousins)))
- Cx is ((girl boy) (mother) (teachers drivers (cousins)))
- Dx is ((girl boy) mother ((teachers drivers (cousins))))
Information
- Description
- Computer Science Quiz on CS4337 Exam 1, created by Tracey Powell on 27/09/2016.
- Author
- Tracey Powell
- Language
- English
- Views
- 4
- Tags
- Rating
- No ratings yet Rate this quiz