100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.6 TrustPilot
logo-home
Exam (elaborations)

CSE 110 EXAM 2 QUESTIONS AND ANSWERS

Rating
-
Sold
-
Pages
7
Grade
A+
Uploaded on
09-01-2026
Written in
2025/2026

CSE 110 EXAM 2 QUESTIONS AND ANSWERS

Institution
CSE 110
Course
CSE 110









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
CSE 110
Course
CSE 110

Document information

Uploaded on
January 9, 2026
Number of pages
7
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

CSE 110 EXAM 2 QUESTIONS AND
ANSWERS

In an accounting application, you discover several places where the total profit, a double
value, is calculated. Which of the following should be done to improve the program
design?

I. The next time the total profit is calculated, use copy and paste to avoid making coding
errors.
II. Provide the same comment every time you repeat the total profit calculation.
III. Consider writing a method that returns the total profit as a double value. - Answer- III

What can be used as an argument in a method call?

I. A variable
II. An expression
III. Another method call that returns a value
IV. Another method call that has no return value - Answer- I, II and III

A programmer notices that the following code snippet uses the same algorithm for
computing interest earned, but with different variables, in the two places shown below
and in several other places in the program. What could be done to improve the
program?

final double RATE1 = 10;
final double RATE2 = 5.5;
double interest = investment * RATE;
...
balance = balance + balance * RATE; - Answer- Define a method that computes
the interest earned from an amount and a rate of interest.

You need to write a method that calculates the volume for a shape, which depends on
the shape's length, width, and height. What should be the parameter variables and their
data types for this method? - Answer- double width, double length, double height

Which of the following is true about method return statements?

a) A method can hold multiple return statements, but only one return statement
executes in one method call.
b) A method can hold only one return statement.

, c) A method can hold multiple return statements, and multiple return statements can
execute in one method call.
d) A method can have maximum of two return statements. - Answer- a) A method can
hold multiple return statements, but only one return statement executes in one method
call.

A programmer notices that the following code snippet uses the same algorithm for
computing cost after taxes, but with different variables, in the two places as shown
below, and in several other places in the program. What could be done to improve the
program?

final double TAXRATE1 = 10;
final double TAXRATE2 = 5.5;
double subtotal = price * (1 + TAXRATE1) / 100;
double total = subtotal + shipping * (1 + TAXRATE2) / 100;

a) Declare the tax rates as variables, not constants.
b) Define a method that looks up tax rates for goods and shipping charges.
c) Define a method that prompts the user for an amount and a tax rate, then returns the
total amount including the tax.
d) Define a method that computes the cost after taxes from arguments for the cost
before taxes and the tax rate. - Answer- Define a method that computes the cost after
taxes from arguments for the cost before taxes and the tax rate.



What process helps with identifying the methods that make up a computer program? -
Answer- Stepwise refinement

The term "Black Box" is used with methods because - Answer- Only the specification
matters; the implementation is not important.

One advantage of designing methods as black boxes is that - Answer- many
programmers can work on the same project without knowing the internal implementation
details of methods.

After the keywords "public static", what are the names (in order) of the parts of this
method header? - Answer- Return type, method name, parameter variable type,
parameter variable name

Parameter variables should not be changed within the body of a method because -
Answer- It is confusing because it mixes the concept of a parameter with that of a
variable

What statement about the steps for implementing a method is true? - Answer- Unit
testing (testing in isolation) of the implemented method is an important final step

Get to know the seller

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.
Scholarsstudyguide nursing
View profile
Follow You need to be logged in order to follow users or courses
Sold
793
Member since
3 year
Number of followers
475
Documents
15430
Last sold
2 days ago
NURSING

Here you will find everything you need in nursing Assignments, EXAMS AND TESTBANKS. For students who want to see results twice as fast. I strive for my content to be of the highest quality. Always leave a review after purchasing any document so as to make sure our customers are 100% satisfied.

3.9

164 reviews

5
87
4
21
3
26
2
6
1
24

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

Frequently asked questions