• 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 25 pages
Exam (elaborations)

ENGR 200 EXAM 2 QUESTIONS WITH ANSWERS AND EXPLANATIONS | American Public University

Document preview thumbnail
Preview 3 out of 25 pages

ENGR 200 EXAM 2 QUESTIONS WITH ANSWERS AND EXPLANATIONS | American Public University

Content preview

ENGR 200 EXAM 2 QUESTIONS WITH ANSWERS
AND EXPLANATIONS
| American Public University
1. Which result is the best applied example of recursion?
A. A swap routine exchanges two caller variables through parameters declared with &.
B. A function computes n! by multiplying n by the factorial of n - 1.
C. A display routine prints a report but has no result value used in an expression.
D. Two functions named magnitude accept different parameter types but are selected by the argument list.
Correct Answer: B. A function computes n! by multiplying n by the factorial of n - 1.
Explanation: The selected observation most specifically demonstrates recursion: a technique in which a function solves
a problem by calling itself on a smaller instance.

2. While tracing a repeated computation: The body runs once before the first decision about repeating. Which
concept is most directly illustrated?
A. continue statement
B. posttest loop
C. nested loops
D. sentinel-controlled loop
Correct Answer: B. posttest loop
Explanation: The situation is a direct example of posttest loop, which is a loop that checks its continuation condition
after the body executes.

3. Which option repairs the conceptual error in defining De Morgan transformation as 'continued execution from
one switch case into the next when no terminating jump intervenes'?
A. the use of == to test whether two values are equal
B. continued execution from one switch case into the next when no terminating jump intervenes
C. an operator such as <, <=, >, >=, ==, or != that compares values
D. the equivalence that negating a conjunction becomes a disjunction of negations and vice versa
Correct Answer: D. the equivalence that negating a conjunction becomes a disjunction of negations and vice versa
Explanation: The correction is that De Morgan transformation is the equivalence that negating a conjunction becomes a
disjunction of negations and vice versa. The mistaken wording instead describes fall-through.

4. Which observation is most diagnostic of accumulator?
A. Readings are accepted until the user enters -1 to indicate there are no more values.
B. A running total is updated with each measurement before an average is computed.
C. Invalid negative readings are ignored without ending processing of later inputs.
D. Input is processed until the user enters a sentinel value that makes the condition false.
Correct Answer: B. A running total is updated with each measurement before an average is computed.
Explanation: The selected case illustrates accumulator because it reflects a variable that combines successive values,
often by addition or multiplication.

,5. void addOne(int& n) { ++n; } is called with int x = 11; addOne(x);. What is x afterward?
A. 12
B. 1
C. The call is illegal
D. 11
Correct Answer: A. 12
Explanation: The reference parameter aliases the caller's variable, so the caller's x is incremented.

6. Consider two independent findings. Finding A: A variable stores one menu command such as Y or N. Finding
B: A program computes power from voltage and current using multiplication. Which conclusion correctly assigns
a concept to each?
A. Both are best explained by char type.
B. Neither observation can be classified using an engineering or computing concept.
C. The first reflects char type; the second reflects arithmetic operators.
D. The first reflects arithmetic operators; the second reflects char type.
Correct Answer: C. The first reflects char type; the second reflects arithmetic operators.
Explanation: The first observation matches char type, whereas the second matches arithmetic operators. The two
should not be collapsed into one concept.

7. Given the case 'Two functions named magnitude accept different parameter types but are selected by the
argument list.', which concept is more appropriate than function decomposition?
A. the code that specifies a function's return type, name, parameters, and body
B. breaking a program into smaller functions with focused responsibilities
C. using the same function name for multiple functions distinguished by parameter lists
D. the condition that stops further self-calls in a recursive function
Correct Answer: C. using the same function name for multiple functions distinguished by parameter lists
Explanation: The case follows function overloading (using the same function name for multiple functions distinguished
by parameter lists) rather than function decomposition (breaking a program into smaller functions with focused
responsibilities).

8. A team observes the following: The variable i increases from zero to nine while ten samples are processed.
Which principle is the best match?
A. pretest loop
B. continue statement
C. iteration variable
D. loop counter
Correct Answer: D. loop counter
Explanation: The situation is a direct example of loop counter, which is a variable used to track the number or position
of iterations.

, 9. Which case best represents function prototype rather than a related concept?
A. Input validation, calculation, and report formatting are placed in separate routines.
B. A call appears before the function definition, so a matching declaration is placed above main.
C. A formatting function uses a default precision unless the caller specifies another one.
D. A display routine prints a report but has no result value used in an expression.
Correct Answer: B. A call appears before the function definition, so a matching declaration is placed above main.
Explanation: The selected case illustrates function prototype because it reflects a declaration that tells the compiler a
function name, return type, and parameter types before use.

10. Which account best explains this outcome while ruling out while loop as the primary concept? A matrix is
processed by iterating over rows and, within each row, over columns.
A. a repetition structure in which one loop is contained inside another
B. a pretest repetition statement that repeats while its condition remains true
C. a repetition statement that commonly groups initialization, test, and update for counted iteration
D. a posttest repetition statement that executes its body at least once before checking the continuation condition
Correct Answer: A. a repetition structure in which one loop is contained inside another
Explanation: The case follows nested loops (a repetition structure in which one loop is contained inside another) rather
than while loop (a pretest repetition statement that repeats while its condition remains true).

11. Which paired description of function definition and function overloading is defensible?
A. function definition is the code that specifies a function's return type, name, parameters, and body; function
overloading is using the same function name for multiple functions distinguished by parameter lists.
B. function definition is using the same function name for multiple functions distinguished by parameter lists;
function overloading is the code that specifies a function's return type, name, parameters, and body.
C. Both terms refer to using the same function name for multiple functions distinguished by parameter lists.
D. Both terms refer to the code that specifies a function's return type, name, parameters, and body.
Correct Answer: A. function definition is the code that specifies a function's return type, name, parameters, and
body; function overloading is using the same function name for multiple functions distinguished by parameter lists.
Explanation: The concepts differ: function definition is the code that specifies a function's return type, name,
parameters, and body, whereas function overloading is using the same function name for multiple functions
distinguished by parameter lists.

12. A review produces two observations: (1) The expression pressure >= limit evaluates to a boolean result. (2) A
pointer-null check on the left of && prevents dereferencing when the pointer is null. Which interpretation keeps
the underlying concepts distinct?
A. The first reflects short-circuit evaluation; the second reflects relational operator.
B. The first reflects relational operator; the second reflects short-circuit evaluation.
C. Both are best explained by relational operator.
D. Neither observation can be classified using an engineering or computing concept.
Correct Answer: B. The first reflects relational operator; the second reflects short-circuit evaluation.
Explanation: The first observation matches relational operator, whereas the second matches short-circuit evaluation.
The two should not be collapsed into one concept.

Document information

Uploaded on
September 29, 2026
Number of pages
25
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$14.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
(197)
Sold
843
Followers
377
Items
57675
Last sold
3 hours 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