Functional Programming Skills
- 36Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
How does the content most usefully characterize functional programming?
How does the content most usefully characterize functional programming?
36 questions
- 1
How does the content most usefully characterize functional programming?
- A
As a programming language that supports only mathematical functions
- B
As a fixed architecture that every software system must follow
- C
As a strict rule that prohibits all mutable memory
- D
As a set of skills that functional programmers use frequently
Correct answer
DAs a set of skills that functional programmers use frequently
Explanation
The content presents functional programming as a set of skills rather than relying on a single definition of what is or is not functional programming.
- A
- 2
How can functional programming skills relate to object-oriented programming skills?
- A
They must be learned separately because the paradigms cannot coexist
- B
They are identical because both paradigms use exactly the same design skills
- C
They are alternatives because using one automatically prevents using the other
- D
They can be mixed and used together because the paradigms are not incompatible
Correct answer
DThey can be mixed and used together because the paradigms are not incompatible
Explanation
The content explains that functional programming and object-oriented programming have different skills that can be combined, such as functional skills with encapsulation and object-oriented modeling.
- A
- 3
Which set lists the five major functional programming skills presented in the content?
- A
Managing threads, compiling code, testing interfaces, normalizing tables, and deploying services
- B
Writing classes, using inheritance, optimizing hardware, modeling objects, and designing databases
- C
Parsing input, allocating memory, designing networks, writing documentation, and debugging syntax
- D
Separating actions, using immutable values, using higher-order behavior, modeling data, and designing architecture
Correct answer
DSeparating actions, using immutable values, using higher-order behavior, modeling data, and designing architecture
Explanation
The five skills are discriminating actions, calculations, and data; working with immutable values; using and creating higher-order calculations and actions; data modeling; and functional architecture.
- A
- 4
Why are the five skills described as a progression in difficulty or abstraction?
- A
Higher-order behavior must always be learned before understanding calculations
- B
Data modeling is presented as simpler than every other functional programming skill
- C
Identifying actions, calculations, and data is foundational, while architecture is presented as a later skill
- D
Architecture is foundational, while identifying data is presented as the most advanced skill
Correct answer
CIdentifying actions, calculations, and data is foundational, while architecture is presented as a later skill
Explanation
The content describes identifying actions, calculations, and data as the beginning of functional programming and places data modeling and architecture farther up the chain.
- A
- 5
What is the central purpose of treating functional programming as a set of skills?
- A
It allows programmers to focus on useful practices without resolving every definitional disagreement
- B
It limits functional programming to skills that can be used only in one language
- C
It makes definitions unnecessary because functional programming has no recognizable practices
- D
It requires programmers to reject all practices associated with other programming paradigms
Correct answer
AIt allows programmers to focus on useful practices without resolving every definitional disagreement
Explanation
The content recommends bypassing contradictory definitions and instead examining the skills functional programmers tend to use more often.
- A
- 6
What distinguishes a calculation from an action?
- A
A calculation can run only once, while an action must be repeated several times
- B
A calculation must be an operator, while an action must always be a named function
- C
A calculation gives the same result for the same inputs, while an action can depend on when it runs
- D
A calculation always changes stored data, while an action never produces an observable effect
Correct answer
CA calculation gives the same result for the same inputs, while an action can depend on when it runs
Explanation
Calculations compute outputs from inputs consistently, whereas actions may produce different results or effects depending on when they are run.
- A
- 7
Which example correctly classifies the operators described in the content?
- A
Both operators are data because operators cannot produce computational results
- B
The addition operator is a calculation, whereas the increment operator is an action
- C
The addition operator is an action, whereas the increment operator is always a calculation
- D
Both operators are actions because every operator depends on the time of execution
Correct answer
BThe addition operator is a calculation, whereas the increment operator is an action
Explanation
The content uses addition as an example of a calculation and increment as an example of an action, noting that these categories are not limited to functions.
- A
- 8
Why are calculations and data generally easier to test and reuse than actions?
- A
Their behavior does not depend on when they are run
- B
They always contain fewer lines of code than actions
- C
They automatically prevent every possible programming error
- D
They can be used only inside the function that created them
Correct answer
ATheir behavior does not depend on when they are run
Explanation
Calculations and data are easier to work with because their behavior is not affected by execution timing, making them easier to test and reuse.
- A
- 9
What is a recommended way to reduce the difficulty of working with actions?
- A
Avoid testing actions because their timing cannot be controlled
- B
Move as much logic as possible from actions into calculations
- C
Move all calculations into actions so timing is centralized
- D
Duplicate each action so that it can run in several places
Correct answer
BMove as much logic as possible from actions into calculations
Explanation
The content recommends keeping fewer lines of code in actions by moving logic into calculations, while giving extra attention to the remaining actions.
- A
- 10
Why must functional programmers pay special attention to how actions are called?
- A
Actions cannot be called more than once without causing a syntax error
- B
The timing, frequency, and manner of calling an action can affect its behavior
- C
Actions are always slower than calculations regardless of how they are called
- D
The number of arguments determines whether an action becomes immutable data
Correct answer
BThe timing, frequency, and manner of calling an action can affect its behavior
Explanation
The content emphasizes that it matters how actions are called, when they are called, and how many times they are called.
- A
- 11
Why does software need a deliberate discipline for immutable data?
- A
Computer memory is mutable, so permanence must be enforced by a team, language, or database
- B
Immutable data is required only when software stores paper documents electronically
- C
Mutable memory automatically preserves historical records without additional design
- D
Computer memory is naturally permanent, so software must deliberately introduce changes
Correct answer
AComputer memory is mutable, so permanence must be enforced by a team, language, or database
Explanation
The content contrasts real-world practices for preserving records with mutable computer memory and says immutability must be rebuilt through programming, language, or database mechanisms.
- A
- 12
What is the basic operational strategy for working with immutable values?
- A
Prevent all transformations so that values remain unchanged forever
- B
Create copies rather than overwriting existing values
- C
Store every value in a global variable and mutate it centrally
- D
Overwrite values freely but record only the final result
Correct answer
BCreate copies rather than overwriting existing values
Explanation
The content summarizes working with immutable data as making copies instead of changing existing values in place.
- A
- 13
Why is nested immutable data especially challenging to update?
- A
Deeply nested values can be changed directly without copying because immutability applies only to top-level data
- B
A nested update always requires changing every value in memory, including unrelated structures
- C
Changing a deeply nested value may require deciding which parts of the surrounding structure to copy
- D
Nested data cannot contain immutable values because only flat structures can be permanent
Correct answer
CChanging a deeply nested value may require deciding which parts of the surrounding structure to copy
Explanation
The content identifies nested data as challenging because updating a value deep in a structure requires determining how to copy the relevant parts of the whole data tree.
- A
- 14
In the company example, what must be considered when giving employees a raise in an immutable structure?
- A
How to construct an updated copy of the company, employee, and salary structure
- B
How to remove the company record before assigning new mutable salaries
- C
How to overwrite every employee's salary directly in the original structure
- D
How to convert all salaries into actions so they can change in place
Correct answer
AHow to construct an updated copy of the company, employee, and salary structure
Explanation
Because the company, employees, and salaries are immutable, the programmer must determine how to create the necessary updated copies, whether for one employee or everyone.
- A
- 15
What does it mean for an action or calculation to be higher-order?
- A
It must be written inside a class with several inheritance levels
- B
It can be treated like a value, such as being passed, returned, or stored
- C
It must execute at a higher speed than every ordinary function
- D
It can operate only on numerical data rather than on behavior
Correct answer
BIt can be treated like a value, such as being passed, returned, or stored
Explanation
Higher-order actions and calculations can be passed as arguments, returned from functions, and stored in variables like other values.
- A
- 16
What capability does higher-order programming provide when behavior is passed to another function?
- A
It allows a function to manipulate or extend behavior in a regular, reusable way
- B
It eliminates the need to define inputs and outputs for calculations
- C
It converts every action into immutable data without requiring any additional logic
- D
It prevents the receiving function from being reused with different behavior
Correct answer
AIt allows a function to manipulate or extend behavior in a regular, reusable way
Explanation
Treating behavior as a value lets functions receive, manipulate, and extend that behavior systematically.
- A
- 17
How can a higher-order operation make an action retry automatically?
- A
It can change the action into a data record that cannot be executed
- B
It can take the action and return or use behavior that retries it a specified number of times
- C
It can guarantee that the action will never fail during its first execution
- D
It can remove all error handling because higher-order actions cannot produce failures
Correct answer
BIt can take the action and return or use behavior that retries it a specified number of times
Explanation
The content gives the example of taking an action and automatically making it retry three times if it fails.
- A
- 18
What is the advantage of defining retry behavior at a higher-order level?
- A
The program can retry only one action because higher-order behavior is not compositional
- B
The retry behavior can be defined once and reused instead of rewritten as bespoke code
- C
Retry behavior becomes dependent on the exact data values processed by the action
- D
Each action must receive a separate custom implementation, preventing shared behavior
Correct answer
BThe retry behavior can be defined once and reused instead of rewritten as bespoke code
Explanation
Higher-order behavior turns common boilerplate, such as retry logic, into reusable behavior that can work consistently in multiple places.
- A
- 19
Why are
map,filter, andreduceconsidered examples of higher-order functions?- A
They are operators that can be used only for arithmetic calculations
- B
They modify every input directly and therefore eliminate the need for functions
- C
They store data permanently without applying any computational behavior
- D
They take functions as inputs and support the construction of data-transformation pipelines
Correct answer
DThey take functions as inputs and support the construction of data-transformation pipelines
Explanation
The content identifies
map,filter, andreduceas higher-order functions because they take functions and help build sequences of data transformations. - A
- 20
What kind of function is produced by the derivative example?
- A
A function that calculates only the derivative of one predetermined mathematical function
- B
A function that converts every mathematical function into a data structure
- C
A function that accepts a number and returns the original function unchanged
- D
A function that accepts a function and returns a new function representing its derivative
Correct answer
DA function that accepts a function and returns a new function representing its derivative
Explanation
The example describes a function that takes an unknown function F as an argument and returns a new function that calculates the derivative of F.
- A
- 21
What is the main purpose of data modeling?
- A
To organize source code according to the order in which functions are executed
- B
To replace all calculations with stored data that never changes
- C
To ensure that every real-world process is represented by a single global variable
- D
To structure facts and measurements so software can use them effectively
Correct answer
DTo structure facts and measurements so software can use them effectively
Explanation
Data modeling concerns how to combine facts about the world into concrete structures that software can use effectively.
- A
- 22
What is a key design constraint for public-facing data that forms part of an API?
- A
It should expose internal search structures even when they are difficult to interpret
- B
It should be designed only for the server's internal calculations
- C
It should prioritize compactness over clarity because users never inspect API data
- D
It should be human-readable and understandable to developers using the API
Correct answer
DIt should be human-readable and understandable to developers using the API
Explanation
Public-facing data must be understandable to the developers or programs on the other side of the library or server, so human readability is important.
- A
- 23
What is a primary concern when modeling data internally for a search process?
- A
Making every internal representation human-readable for external API users
- B
Using the same representation required by a public API regardless of search needs
- C
Hiding all information from the search so that only the final result is stored
- D
Representing the data so the search is efficient and all required information is available
Correct answer
DRepresenting the data so the search is efficient and all required information is available
Explanation
Internal data modeling is shaped by operational needs, such as efficient searching and having all necessary data available.
- A
- 24
Why may public-facing and internal data models need different designs?
- A
Public data must always be mutable, while internal data must always be represented as functions
- B
Internal data is intended for humans, while public data is intended only for machine memory
- C
Public data emphasizes understandability, while internal data may emphasize efficient computation
- D
Public data has no design constraints, while internal data must follow one universal structure
Correct answer
CPublic data emphasizes understandability, while internal data may emphasize efficient computation
Explanation
The content distinguishes the constraints of external API data from those of internal representations used for tasks such as efficient search.
- A
- 25
Why are data-modeling skills described as relatively advanced in the progression?
- A
They are simpler than identifying actions, calculations, and data because they require no abstraction
- B
They concern only database storage and therefore are unrelated to functional programming
- C
They must be learned before a programmer can distinguish calculations from actions
- D
They address how to structure domain information effectively after more basic functional distinctions are understood
Correct answer
DThey address how to structure domain information effectively after more basic functional distinctions are understood
Explanation
The content places data modeling near the end of the progression, after the foundational skill of distinguishing actions, calculations, and data.
- A
- 26
Why does a growing software system require architectural principles?
- A
Architectural principles are needed primarily to make all code fit into one file
- B
Without design principles, increasing code size can make the system unmanageable
- C
A system becomes manageable by adding code without considering its organization
- D
Architecture matters only for tiny programs because large systems organize themselves automatically
Correct answer
BWithout design principles, increasing code size can make the system unmanageable
Explanation
The content explains that architecture becomes important as software scales because simply adding code can cause the system to become unmanageable.
- A
- 27
What is the central flow in a reactive data architecture?
- A
A fixed interface generates no events because reactive systems avoid feedback cycles
- B
Events are consumed, state is modified, and a resulting view is projected to an interface
- C
Calculations are run once, after which events and state changes are ignored
- D
A user interface directly modifies every database record without passing through state
Correct answer
BEvents are consumed, state is modified, and a resulting view is projected to an interface
Explanation
Reactive architectures involve generated events, consumption of those events, modification of centralized state, and projection of the resulting world view onto a GUI or other interface.
- A
- 28
What makes reactive architecture a reaction-based architectural pattern?
- A
The system requires every event to be processed by a separate unrelated application
- B
The system's behavior is organized around changes to data and the reactions those changes produce
- C
The system responds only to user-interface rendering and not to underlying events
- D
The system avoids state and instead relies exclusively on independently timed actions
Correct answer
BThe system's behavior is organized around changes to data and the reactions those changes produce
Explanation
The content describes the reactive cycle as being based on reactions to events and changes in data.
- A
- 29
What are the three principal layers of the Onion Architecture?
- A
The interaction layer, the business rule layer, and the domain layer
- B
The user layer, the testing layer, and the optimization layer
- C
The input layer, the inheritance layer, and the deployment layer
- D
The database layer, the networking layer, and the presentation layer
Correct answer
AThe interaction layer, the business rule layer, and the domain layer
Explanation
The Onion Architecture is described as having an outer interaction layer, a middle business rule layer, and an inner domain layer.
- A
- 30
What belongs primarily in the interaction layer of the Onion Architecture?
- A
Actions that communicate with the outside world and receive external messages
- B
Timeless domain concepts that change very rarely
- C
Pure business calculations that contain no actions
- D
Internal search structures optimized for data retrieval
Correct answer
AActions that communicate with the outside world and receive external messages
Explanation
The outer interaction layer contains actions and handles communication with the outside world.
- A
- 31
What characterizes the business rule layer in the Onion Architecture?
- A
It contains only external communication actions and API adapters
- B
It contains graphical projections generated directly from centralized state
- C
It contains calculations representing changing business requirements
- D
It contains timeless facts that are independent of business policies
Correct answer
CIt contains calculations representing changing business requirements
Explanation
The business rule layer is a calculation-only layer containing changing requirements such as payroll calculations and vacation policies.
- A
- 32
What characterizes the domain layer in the Onion Architecture?
- A
It contains a relatively timeless domain model that business rules call into
- B
It contains rapidly changing code for communicating with external APIs
- C
It contains only temporary data structures used during a search
- D
It contains all actions required to receive messages from users
Correct answer
AIt contains a relatively timeless domain model that business rules call into
Explanation
The inner domain layer contains the timeless domain model, such as the idea that employees receive salaries or vacation.
- A
- 33
Which statement best distinguishes a business rule from a domain concept in the employee example?
- A
Neither the fact nor the amount belongs in the model because employee policies are external events
- B
The fact that employees receive vacation is a business rule, while the amount is always timeless
- C
Both the fact and the amount are interaction-layer actions because they involve employees
- D
The amount of vacation is a business rule, while the fact that employees receive vacation is a domain concept
Correct answer
DThe amount of vacation is a business rule, while the fact that employees receive vacation is a domain concept
Explanation
The content treats the specific vacation policy as a changeable business rule, while employees receiving vacation is a more timeless domain idea.
- A
- 34
How does the Onion Architecture organize change?
- A
Frequently changing interactions are placed outside, while less frequently changing domain concepts are placed inside
- B
All layers are designed to change at the same rate so no separation is needed
- C
Frequently changing domain concepts are placed inside, while stable interactions are placed outside
- D
The architecture places actions and timeless concepts together to simplify dependencies
Correct answer
AFrequently changing interactions are placed outside, while less frequently changing domain concepts are placed inside
Explanation
The outer interaction layer changes rapidly because APIs and external connections change, business rules change less rapidly, and the domain model changes least frequently.
- A
- 35
Why might a change in an external API primarily affect the interaction layer?
- A
The business rule layer must store all network protocols as immutable values
- B
The domain layer defines every external API message and therefore changes first
- C
The API change affects only calculations because interactions never depend on external systems
- D
The interaction layer contains the code that communicates with external systems
Correct answer
DThe interaction layer contains the code that communicates with external systems
Explanation
The interaction layer connects the system to external APIs, so changes in those APIs generally require modifications there.
- A
- 36
How can an unusual situation such as employees receiving no vacation fit into the domain model?
- A
It must be moved to the interaction layer because unusual values are external actions
- B
It must be excluded because domain models can represent only common situations
- C
It requires replacing the domain model because timeless models cannot contain numeric values
- D
It can still be represented as a valid value, such as zero, within the model
Correct answer
DIt can still be represented as a valid value, such as zero, within the model
Explanation
The content notes that even an unusual case such as zero vacation can still be modeled as a valid value within the domain model.
- A

Ask anything
We've read this whole study set, so questions about it get the best answers.