• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 3 out of 26 pages
Exam (elaborations)

Cse 340 Exam 3 Questions With Answers And Explanations

Document preview thumbnail
Preview 3 out of 26 pages

Cse 340 Exam 3 Questions With Answers And Explanations

Content preview

CSE 340 EXAM 3 QUESTIONS WITH
ANSWERS AND EXPLANATIONS

Question 1. Consider this functional-programming requirement: A general function should be specialized
by fixing some arguments now and supplying the rest later. Which choice best captures the intended
semantics?
A. Treat functions as first-class values that can flow through parameters and return positions.
B. Apply the function to a subset of its arguments to obtain a new function of the remaining parameters.
C. Transform it so each application supplies one argument and returns a function expecting the next.
D. Construct new values for updates rather than mutating existing values in place.

Correct Answer: B. Apply the function to a subset of its arguments to obtain a new function of the remaining
parameters.

Explanation: Apply the function to a subset of its arguments to obtain a new function of the remaining parameters. Reusable
specialized behavior can be created without duplicating the original implementation.

Question 2. Which small experiment best demonstrates the intended behavior of Alpha conversion?
A. Compare the binding relationships before and after renaming and verify they are unchanged.
B. Reduce a small application and verify substitution corresponds to the function parameter.
C. Reduce a redex by one step and verify every substituted occurrence corresponds to the bound parameter.
D. Search all subterms and verify no beta redex remains.

Correct Answer: A. Compare the binding relationships before and after renaming and verify they are unchanged.

Explanation: Compare the binding relationships before and after renaming and verify they are unchanged. This directly
validates Alpha conversion; the alternatives test different language properties.

Question 3. Why is Filter especially useful in this functional-language situation: A collection should retain
only elements satisfying a predicate while preserving the remaining values.
A. Element-wise transformation is expressed declaratively without explicit mutation of an output loop index.
B. Selection logic is separated from iteration mechanics and does not transform retained elements.
C. Reasoning about aliases and historical states becomes simpler because prior values do not change.
D. Equational reasoning and local substitution become valid tools for understanding programs.

Correct Answer: B. Selection logic is separated from iteration mechanics and does not transform retained
elements.

Explanation: Selection logic is separated from iteration mechanics and does not transform retained elements. This is the
central value of Filter in the stated situation.

,Question 4. A language-theory implementation is being extended because A lambda term should be
recognized as fully reduced under beta reduction. Which approach is most defensible?
A. Substitute the argument for the abstraction parameter in the body using capture-avoiding substitution.
B. Rename the binder and all occurrences bound by it to a fresh variable name.
C. Write a lambda abstraction that binds the formal variable in the function body.
D. Confirm that the term contains no subexpression of the form (lambda x. body) argument.

Correct Answer: D. Confirm that the term contains no subexpression of the form (lambda x. body) argument.

Explanation: Confirm that the term contains no subexpression of the form (lambda x. body) argument. No further
beta-reduction step is available anywhere in the term.

Question 5. A language-theory reviewer wants evidence that Currying is applied correctly. Which test is
strongest?
A. Pass a function value into a combinator and verify the supplied behavior is invoked.
B. Compute a small fold manually and verify accumulator order and initial value.
C. Evaluate the expression in several contexts and verify replacing it with its value preserves behavior.
D. Apply the curried function one argument at a time and verify the final result matches the uncurried behavior.

Correct Answer: D. Apply the curried function one argument at a time and verify the final result matches the
uncurried behavior.

Explanation: Apply the curried function one argument at a time and verify the final result matches the uncurried behavior. This
directly validates Currying; the alternatives test different language properties.

Question 6. Why is Beta normal form especially useful in this functional-language situation: A lambda
term should be recognized as fully reduced under beta reduction.
A. No further beta-reduction step is available anywhere in the term.
B. Function application is given its fundamental reduction rule.
C. Substitution preserves lexical binding structure rather than silently changing program meaning.
D. Functions become first-class syntactic values without requiring a separate named declaration.

Correct Answer: A. No further beta-reduction step is available anywhere in the term.

Explanation: No further beta-reduction step is available anywhere in the term. This is the central value of Beta normal form in
the stated situation.

Question 7. A functional evaluator has this defect: Use a selection operation that removes elements based
on a predicate instead of transforming them. Which concept most directly addresses it?
A. Currying
B. Referential transparency
C. Map
D. Partial application

Correct Answer: C. Map

Explanation: Map is the direct match. Use map to produce a collection containing the function result for each input element.

, Question 8. Why is Function application in lambda calculus especially useful in this functional-language
situation: A function expression should be applied to an argument expression using the core
lambda-calculus construct.
A. The term remains equivalent because only bound-variable names change, not binding structure.
B. No further beta-reduction step is available anywhere in the term.
C. Function application is given its fundamental reduction rule.
D. Computation can be expressed through function application without needing special-purpose statement forms.

Correct Answer: D. Computation can be expressed through function application without needing special-purpose
statement forms.

Explanation: Computation can be expressed through function application without needing special-purpose statement forms.
This is the central value of Function application in lambda calculus in the stated situation.

Question 9. A language-theory implementation is being extended because An expression may be replaced
by its value without changing observable program behavior. Which approach is most defensible?
A. Transform it so each application supplies one argument and returns a function expecting the next.
B. Use filter with the predicate to select qualifying elements.
C. Preserve purity and avoid hidden side effects that make identical expressions context-dependent.
D. Use map to produce a collection containing the function result for each input element.

Correct Answer: C. Preserve purity and avoid hidden side effects that make identical expressions
context-dependent.

Explanation: Preserve purity and avoid hidden side effects that make identical expressions context-dependent. Equational
reasoning and local substitution become valid tools for understanding programs.

Question 10. Which small experiment best demonstrates the intended behavior of Lambda abstraction?
A. Inspect free and bound occurrences in the abstraction and verify the parameter binds the intended occurrences.
B. Use a substitution case with a name conflict and verify free-variable sets are preserved appropriately.
C. Reduce a small application and verify substitution corresponds to the function parameter.
D. Reduce a redex by one step and verify every substituted occurrence corresponds to the bound parameter.

Correct Answer: A. Inspect free and bound occurrences in the abstraction and verify the parameter binds the
intended occurrences.

Explanation: Inspect free and bound occurrences in the abstraction and verify the parameter binds the intended occurrences.
This directly validates Lambda abstraction; the alternatives test different language properties.

Question 11. A lambda-calculus derivation goes wrong because Apply a mapping operation that changes
every element regardless of whether it satisfies the predicate. Which named idea is missing?
A. Referential transparency
B. Map
C. Filter
D. Fold/reduce

Correct Answer: C. Filter

Explanation: Filter is the direct match. Use filter with the predicate to select qualifying elements.

Document information

Uploaded on
October 10, 2026
Number of pages
26
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$15.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Favorgrades
3.8
(199)
Sold
854
Followers
377
Items
57829
Last sold
6 days ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions