1
engr 102 exam 2 Questions with Correct
Answers | Updated (100% Correct Answers)
Top Down Design Answer: Starting with a broad concept and
breaking it down into smaller and smaller pieces.
end result of top down design Answer: hierarchy
2 things a unit of design should be Answer: coherent and constant
parts of a hierarchy Answer: tree, root, node, parent, child, leaves
tree Answer: A hierarchy of data in which data are organized into
nodes, each of which have exactly one parent node. The exception
is the root node, which has no parents.
root Answer: at the base of hierarchy (highest level)
node Answer: an individual element of hierachy
2 parts of a node Answer: a parent and a child (breakdown of
parent)
leaves Answer: a node without children (lowest level)
advantages of hierarchy Answer: provides coherency, provides
conceptual separation, helps manage complexity
© 2025 All rights reserved
,2
disadvantages of hierarchy Answer: can create artifical boundaries,
not always clear how things are separated, they dont capture all
relationships
attributes of a balanced hierarchy Answer: useful way to organize
ideas and processes
console Answer: default interactive window
files Answer: a way of storing information outside of main memory
file extensions Answer: the endings of file names that indicate to
the computer the format for how the underlying bits are organized.
2 things to designate how to open a file Answer: variable and file
identifier
how to open files Answer: <file ID> = open("filename",
"designator")
do when finished with file Answer: <file ID>.close()
alternative form of opening files Answer: with <open command> as
<file ID>:
file designators and their function Answer: r = read
w = write
a = append
© 2025 All rights reserved
, 3
rb or wb = read/write binary
r+ = read and write
<null> = read when none given
when to use separate open and close statements Answer: using
multiple files at once or for a long time
when open / close are not nested
when to use formulation to open and close Answer: ensuring your
file closes correctly
clearly delineating which part of the code is doing the operation
how to write in a file Answer: <file ID>.write("string to write")
when using 'write' (not print) Answer: only 1 string, only writes in
strings, no carriage function/ new line
reading from files Answer: <string variable> = <file ID>.readline()
for reading multiple lines Answer: for <line ID> in <file ID>:
do something with string ID
( * loops through file like a list *)
most useful string processing Answer: "split" method
© 2025 All rights reserved
engr 102 exam 2 Questions with Correct
Answers | Updated (100% Correct Answers)
Top Down Design Answer: Starting with a broad concept and
breaking it down into smaller and smaller pieces.
end result of top down design Answer: hierarchy
2 things a unit of design should be Answer: coherent and constant
parts of a hierarchy Answer: tree, root, node, parent, child, leaves
tree Answer: A hierarchy of data in which data are organized into
nodes, each of which have exactly one parent node. The exception
is the root node, which has no parents.
root Answer: at the base of hierarchy (highest level)
node Answer: an individual element of hierachy
2 parts of a node Answer: a parent and a child (breakdown of
parent)
leaves Answer: a node without children (lowest level)
advantages of hierarchy Answer: provides coherency, provides
conceptual separation, helps manage complexity
© 2025 All rights reserved
,2
disadvantages of hierarchy Answer: can create artifical boundaries,
not always clear how things are separated, they dont capture all
relationships
attributes of a balanced hierarchy Answer: useful way to organize
ideas and processes
console Answer: default interactive window
files Answer: a way of storing information outside of main memory
file extensions Answer: the endings of file names that indicate to
the computer the format for how the underlying bits are organized.
2 things to designate how to open a file Answer: variable and file
identifier
how to open files Answer: <file ID> = open("filename",
"designator")
do when finished with file Answer: <file ID>.close()
alternative form of opening files Answer: with <open command> as
<file ID>:
file designators and their function Answer: r = read
w = write
a = append
© 2025 All rights reserved
, 3
rb or wb = read/write binary
r+ = read and write
<null> = read when none given
when to use separate open and close statements Answer: using
multiple files at once or for a long time
when open / close are not nested
when to use formulation to open and close Answer: ensuring your
file closes correctly
clearly delineating which part of the code is doing the operation
how to write in a file Answer: <file ID>.write("string to write")
when using 'write' (not print) Answer: only 1 string, only writes in
strings, no carriage function/ new line
reading from files Answer: <string variable> = <file ID>.readline()
for reading multiple lines Answer: for <line ID> in <file ID>:
do something with string ID
( * loops through file like a list *)
most useful string processing Answer: "split" method
© 2025 All rights reserved