ENGR 102 Exam 2 Questions and
Answers 100% Solved
One of the ways to import a module is to use the import command, followed by the module name, for
example:
import math - ✔✔True
We cannot import individual functions from a module. - ✔✔False
We can import all the functions from a module by using the "from <module_name> import *"
command. - ✔✔True
Python allows us to rename or alias functions to shorter names, using the as keyword when we import
them. - ✔✔True
numpy.linspace(start, stop, num=50)
Returns num evenly spaced samples, calculated over the interval [start, stop]. The endpoint of the
interval can optionally be excluded. - ✔✔True
In top-down design, we take some complex task and break it into a sequence of simpler tasks. -
✔✔True
In the top-down hierarchy, the leaf nodes can be individual functions that don't call any other functions.
And, the higher levels in the hierarchy are functions that do call other functions. -
✔✔True
A function should have a single clear purpose and goal. - ✔✔True
Each function should be easy to understand on its own. When we have a function, it should just do its
job with whatever parameters are passed in, and not worry about the bigger world around it. - ✔✔True
,In code, the higher-level parts of the hierarchy come AFTER the lower-level parts of the
hierarchy. The reason for this is that we need the children functions to be defined first, so that their
parent can call them. - ✔✔True
The idea of bottom-up design is that you take existing pieces of code, or existing techniques, and
combine them to do something new. - ✔✔True
Bottom-up programs still result in a hierarchy of functions. But, the lower-level functions are designed
first, and then gradually built to the higher ones. - ✔✔True
Top-down and bottom-up designs will always result in very different programs. - ✔✔False
In practice, top-down approaches are always used to develop modules. - ✔✔False
Both top-down and bottom-up designs end up creating a hierarchy of functions. - ✔✔True
Top-down functions can only be tested after everything below them in the hierarchy has been
implemented in some way. - ✔✔True
With top-down design, code can become too specialized, and it's easier to miss chances to reuse code
and ideas. - ✔✔True
Botton-up design process does not have any drawbacks. - ✔✔False
Programmers rarely use a strict top-down or bottom-up approach, but rather they use different aspects
of each one, or other approaches like object-oriented design, depending on the
problem and goals. - ✔✔True
The key to why top-down design, bottom-up design, and functions are useful is that we can ignore the
details of how other parts of the program work, while we focus on one particular part. This is called
abstraction. - ✔✔True
We'll use top-down design as a way of organizing many of our programs. Which of the following
steps is included in the top-down design process? A. Break the problem into individual "large"
steps
Break individual "large" steps into smaller steps
Stop the design process when the code should be "obvious" from the description - ✔✔A,B,C
, A hierarchy helps manage complexity. - ✔✔True
Top-down design refers to taking a problem and creating a hierarchy by breaking it down from
the top-most level of the hierarchy downward. - ✔✔True
You can use the top-down design method to approach many problems, including engineering
challenges. - ✔✔True
Example: University -> Academic/Non-Academic -> Colleges/Offices -> Departments ->
Individuals
Question to answer (T/F): When we encounter a hierarchy like this in computing, we usually call
it a "Branch". - ✔✔False
A hierarchical tree structure will have a "root" at the base. - ✔✔True
In a hierarchical tree structure, any one "leaf" node will have a "parent" (the node just above). -
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller TheeGrades. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $12.99. You're not tied to anything after your purchase.