Exam 3: Implementing Classes

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

What is the purpose of a clean and concise design for an object's public interface?

Free
(Multiple Choice)
4.7/5
(46)
Correct Answer:
Verified

C

Which of the following denotes the implicit parameter?

Free
(Multiple Choice)
5.0/5
(39)
Correct Answer:
Verified

B

When a method exits, its ____ are removed.

Free
(Multiple Choice)
4.9/5
(35)
Correct Answer:
Verified

A

When using index cards to help with the tracing of the execution of an object by hand, what is written on the back of the card?

(Multiple Choice)
4.8/5
(40)

Which of the following is a valid constructor header for the Player class that accepts the player name as a parameter?

(Multiple Choice)
4.8/5
(35)

Consider the following method header for an Employee class: Consider the following method header for an Employee class:   Fill in the blank in the method body with the implementation that will change the instance variable salary to reflect the employee's new salary after applying the raise: Fill in the blank in the method body with the implementation that will change the instance variable salary to reflect the employee's new salary after applying the raise:

(Multiple Choice)
4.9/5
(35)

We want the toString method to return strings like 3/16/2014.Give the body of the toString method.

(Multiple Choice)
4.8/5
(31)

When are local variables initialized?

(Multiple Choice)
4.8/5
(33)

What is a parameter variable?

(Multiple Choice)
4.7/5
(42)

We want to create a class that represents a geometric sequence.A geometric sequence is a sequence of numbers that begin at some value and then multiplies each value by some constant to get the next value.For example, the geometric sequence 1, 2, 4, 8, 16 starts at 1 and multiplies each term by 2 to get the next.The geometric sequence 10.8, 5.4, 2.7, 1.35 starts at 10.8 and multiplies each term by 0.5 to get the next.The basic framework of a geometric sequence class is below: public class Geometricsequence { private double currentValue; private double multiplier; } Assume that the parameters to the constructor are initial and mult. What should the body of the constructor be?

(Multiple Choice)
4.9/5
(29)

Why is it a good idea for a programmer to write comments about a method first, before implementing it?

(Multiple Choice)
4.9/5
(36)

Which lines would need to be added to CarComponent to put car3 at the middle of the left side of the window?

(Multiple Choice)
4.8/5
(35)

You should provide documentation comments for ___.

(Multiple Choice)
4.8/5
(42)

Assuming the following code is the body of the deposit method, what output is generated by the valid call myAccount.deposit(1000) for an account with an initial balance of 500? Assuming the following code is the body of the deposit method, what output is generated by the valid call myAccount.deposit(1000) for an account with an initial balance of 500?

(Multiple Choice)
4.8/5
(33)

Choose the method header that goes with this method comment. Choose the method header that goes with this method comment.

(Multiple Choice)
4.8/5
(32)

Choose the method header that goes with this method comment. Choose the method header that goes with this method comment.

(Multiple Choice)
4.8/5
(34)

Which line of code is part of the public implementation of the BankAccount class?

(Multiple Choice)
4.8/5
(47)

What is the return type of the println method of the PrintStream class?

(Multiple Choice)
4.8/5
(41)

Given this method comment, fill in the blank in the method implementation. Given this method comment, fill in the blank in the method implementation.

(Multiple Choice)
4.8/5
(39)

What is the name of the constructor for the BankAccount class?

(Multiple Choice)
5.0/5
(33)
Showing 1 - 20 of 108
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)