ENGR 200 EXAM 3 QUESTIONS WITH ANSWERS
AND EXPLANATIONS
| American Public University
1. Compare these cases: A loop adds all temperature readings and divides by the number of readings. Separately, A
loop uses const string& label when it only needs to inspect long strings. Which paired explanation is most
accurate?
A. Both are best explained by running sum over a collection.
B. The first reflects const element reference; the second reflects running sum over a collection.
C. Neither observation can be classified using an engineering or computing concept.
D. The first reflects running sum over a collection; the second reflects const element reference.
Correct Answer: D. The first reflects running sum over a collection; the second reflects const element reference.
Explanation: The first observation matches running sum over a collection, whereas the second matches const element
reference. The two should not be collapsed into one concept.
2. What is the best description of side effect?
A. a parameter that refers directly to the caller's object and can be used to modify it when non-const
B. the condition that stops further self-calls in a recursive function
C. an observable change to program state other than returning a value
D. the code that specifies a function's return type, name, parameters, and body
Correct Answer: C. an observable change to program state other than returning a value
Explanation: side effect is an observable change to program state other than returning a value.
3. Which result is the best applied example of two-dimensional array?
A. A 3 by 4 table of measurements is addressed by row and column indices.
B. Measurements are appended as they arrive without choosing the final count in advance.
C. A loop adds all temperature readings and divides by the number of readings.
D. Ten calibration values are stored in double readings[10].
Correct Answer: A. A 3 by 4 table of measurements is addressed by row and column indices.
Explanation: The selected observation most specifically demonstrates two-dimensional array: an array organized with
two indices such as rows and columns.
4. A concise label is needed for the process defined as the C++ rule that struct members are public by default while
class members are private by default. Which concept is correct?
A. object
B. struct versus class default access
C. class
D. member function
Correct Answer: B. struct versus class default access
Explanation: The result should be classified as struct versus class default access because that concept means the C++
rule that struct members are public by default while class members are private by default.
,5. What is the standard term for the amount of storage a vector has allocated, which may exceed its current element
count?
A. vector capacity concept
B. container pass by const reference
C. array initialization
D. linear search
Correct Answer: A. vector capacity concept
Explanation: vector capacity concept refers to the amount of storage a vector has allocated, which may exceed its
current element count.
6. A review is focused on member function. Which observation best matches the target concept?
A. Two otherwise similar definitions differ in accessibility when no explicit access specifier is written.
B. A caller invokes a public getValue() function on an object.
C. Two Sensor objects store different readings even though both were created from the same class definition.
D. A setReading function checks and updates the object's current measurement.
Correct Answer: D. A setReading function checks and updates the object's current measurement.
Explanation: The selected observation most specifically demonstrates member function: a function declared as part of a
class that operates in the context of an object.
7. What is the standard term for loss of access to dynamically allocated storage without releasing it?
A. pointer safety check
B. pointer
C. double delete
D. memory leak
Correct Answer: D. memory leak
Explanation: memory leak refers to loss of access to dynamically allocated storage without releasing it.
8. A review produces two observations: (1) Measurements are appended as they arrive without choosing the final
count in advance. (2) The first value initializes maxValue and each later element replaces it only if larger. Which
interpretation keeps the underlying concepts distinct?
A. The first reflects vector; the second reflects maximum scan.
B. Neither observation can be classified using an engineering or computing concept.
C. Both are best explained by vector.
D. The first reflects maximum scan; the second reflects vector.
Correct Answer: A. The first reflects vector; the second reflects maximum scan.
Explanation: The first observation matches vector, whereas the second matches maximum scan. The two should not be
collapsed into one concept.
, 9. Which option repairs the conceptual error in defining recursion as 'an expression supplied by the caller for a
corresponding function parameter'?
A. breaking a program into smaller functions with focused responsibilities
B. an expression supplied by the caller for a corresponding function parameter
C. a parameter value supplied automatically when the caller omits the corresponding trailing argument
D. a technique in which a function solves a problem by calling itself on a smaller instance
Correct Answer: D. a technique in which a function solves a problem by calling itself on a smaller instance
Explanation: The correction is that recursion is a technique in which a function solves a problem by calling itself on a
smaller instance. The mistaken wording instead describes argument.
10. A student defines substring as 'a search operation that reports the position of a matching character sequence or
a not-found value'. Which revision corrects the error?
A. adding characters to the end of an existing string
B. a contiguous part of a string extracted from a specified position and length
C. a search operation that reports the position of a matching character sequence or a not-found value
D. accessing an individual character by its zero-based position
Correct Answer: B. a contiguous part of a string extracted from a specified position and length
Explanation: The correction is that substring is a contiguous part of a string extracted from a specified position and
length. The mistaken wording instead describes string find.
11. Which construct appropriately labels a result showing visiting array elements systematically, typically with an
index loop?
A. parallel arrays
B. maximum scan
C. running sum over a collection
D. array traversal
Correct Answer: D. array traversal
Explanation: The result should be classified as array traversal because that concept means visiting array elements
systematically, typically with an index loop.
12. External code tries to assign directly to a data member declared private. What is the expected result?
A. The member becomes public automatically
B. The assignment always succeeds
C. The access is rejected by the compiler
D. The assignment becomes a constructor call
Correct Answer: C. The access is rejected by the compiler
Explanation: Ordinary external code cannot directly access a private data member.
13. Which statement most accurately characterizes null pointer?
A. a function parameter that receives an address and can access the pointed-to object
B. the common conversion of an array expression to a pointer to its first element in many expressions
C. the unary * operator that accesses the object designated by a pointer
D. a pointer value that does not point to a valid object or function
Correct Answer: D. a pointer value that does not point to a valid object or function
Explanation: null pointer is a pointer value that does not point to a valid object or function.
AND EXPLANATIONS
| American Public University
1. Compare these cases: A loop adds all temperature readings and divides by the number of readings. Separately, A
loop uses const string& label when it only needs to inspect long strings. Which paired explanation is most
accurate?
A. Both are best explained by running sum over a collection.
B. The first reflects const element reference; the second reflects running sum over a collection.
C. Neither observation can be classified using an engineering or computing concept.
D. The first reflects running sum over a collection; the second reflects const element reference.
Correct Answer: D. The first reflects running sum over a collection; the second reflects const element reference.
Explanation: The first observation matches running sum over a collection, whereas the second matches const element
reference. The two should not be collapsed into one concept.
2. What is the best description of side effect?
A. a parameter that refers directly to the caller's object and can be used to modify it when non-const
B. the condition that stops further self-calls in a recursive function
C. an observable change to program state other than returning a value
D. the code that specifies a function's return type, name, parameters, and body
Correct Answer: C. an observable change to program state other than returning a value
Explanation: side effect is an observable change to program state other than returning a value.
3. Which result is the best applied example of two-dimensional array?
A. A 3 by 4 table of measurements is addressed by row and column indices.
B. Measurements are appended as they arrive without choosing the final count in advance.
C. A loop adds all temperature readings and divides by the number of readings.
D. Ten calibration values are stored in double readings[10].
Correct Answer: A. A 3 by 4 table of measurements is addressed by row and column indices.
Explanation: The selected observation most specifically demonstrates two-dimensional array: an array organized with
two indices such as rows and columns.
4. A concise label is needed for the process defined as the C++ rule that struct members are public by default while
class members are private by default. Which concept is correct?
A. object
B. struct versus class default access
C. class
D. member function
Correct Answer: B. struct versus class default access
Explanation: The result should be classified as struct versus class default access because that concept means the C++
rule that struct members are public by default while class members are private by default.
,5. What is the standard term for the amount of storage a vector has allocated, which may exceed its current element
count?
A. vector capacity concept
B. container pass by const reference
C. array initialization
D. linear search
Correct Answer: A. vector capacity concept
Explanation: vector capacity concept refers to the amount of storage a vector has allocated, which may exceed its
current element count.
6. A review is focused on member function. Which observation best matches the target concept?
A. Two otherwise similar definitions differ in accessibility when no explicit access specifier is written.
B. A caller invokes a public getValue() function on an object.
C. Two Sensor objects store different readings even though both were created from the same class definition.
D. A setReading function checks and updates the object's current measurement.
Correct Answer: D. A setReading function checks and updates the object's current measurement.
Explanation: The selected observation most specifically demonstrates member function: a function declared as part of a
class that operates in the context of an object.
7. What is the standard term for loss of access to dynamically allocated storage without releasing it?
A. pointer safety check
B. pointer
C. double delete
D. memory leak
Correct Answer: D. memory leak
Explanation: memory leak refers to loss of access to dynamically allocated storage without releasing it.
8. A review produces two observations: (1) Measurements are appended as they arrive without choosing the final
count in advance. (2) The first value initializes maxValue and each later element replaces it only if larger. Which
interpretation keeps the underlying concepts distinct?
A. The first reflects vector; the second reflects maximum scan.
B. Neither observation can be classified using an engineering or computing concept.
C. Both are best explained by vector.
D. The first reflects maximum scan; the second reflects vector.
Correct Answer: A. The first reflects vector; the second reflects maximum scan.
Explanation: The first observation matches vector, whereas the second matches maximum scan. The two should not be
collapsed into one concept.
, 9. Which option repairs the conceptual error in defining recursion as 'an expression supplied by the caller for a
corresponding function parameter'?
A. breaking a program into smaller functions with focused responsibilities
B. an expression supplied by the caller for a corresponding function parameter
C. a parameter value supplied automatically when the caller omits the corresponding trailing argument
D. a technique in which a function solves a problem by calling itself on a smaller instance
Correct Answer: D. a technique in which a function solves a problem by calling itself on a smaller instance
Explanation: The correction is that recursion is a technique in which a function solves a problem by calling itself on a
smaller instance. The mistaken wording instead describes argument.
10. A student defines substring as 'a search operation that reports the position of a matching character sequence or
a not-found value'. Which revision corrects the error?
A. adding characters to the end of an existing string
B. a contiguous part of a string extracted from a specified position and length
C. a search operation that reports the position of a matching character sequence or a not-found value
D. accessing an individual character by its zero-based position
Correct Answer: B. a contiguous part of a string extracted from a specified position and length
Explanation: The correction is that substring is a contiguous part of a string extracted from a specified position and
length. The mistaken wording instead describes string find.
11. Which construct appropriately labels a result showing visiting array elements systematically, typically with an
index loop?
A. parallel arrays
B. maximum scan
C. running sum over a collection
D. array traversal
Correct Answer: D. array traversal
Explanation: The result should be classified as array traversal because that concept means visiting array elements
systematically, typically with an index loop.
12. External code tries to assign directly to a data member declared private. What is the expected result?
A. The member becomes public automatically
B. The assignment always succeeds
C. The access is rejected by the compiler
D. The assignment becomes a constructor call
Correct Answer: C. The access is rejected by the compiler
Explanation: Ordinary external code cannot directly access a private data member.
13. Which statement most accurately characterizes null pointer?
A. a function parameter that receives an address and can access the pointed-to object
B. the common conversion of an array expression to a pointer to its first element in many expressions
C. the unary * operator that accesses the object designated by a pointer
D. a pointer value that does not point to a valid object or function
Correct Answer: D. a pointer value that does not point to a valid object or function
Explanation: null pointer is a pointer value that does not point to a valid object or function.