Exam 8: Objects and Classes

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

An instance variable declaration consists of ____.

Free
(Multiple Choice)
4.8/5
(43)
Correct Answer:
Verified

B

Which of the following lists the correct order of items in an instance method declaration?

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

D

Which of the following declares a sideLength instance variable for a Square class that stores an integer value?

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

B

Insert the missing code in the following code fragment. This fragment is intended to implement a method to get the value stored in an instance variable. Public class Vehicle { Private String model; Private double rpm; ) . . _______ { Return model; } }

(Multiple Choice)
4.8/5
(30)

You have created a Coin class and a Purse class. Which of the following methods will correctly add a Coin object to an array list named coins in the Purse class?

(Multiple Choice)
4.9/5
(49)

Consider the following code snippet: Public class Vehicle { ) . . Public void setVehicleAttributes(String attributes) {) . . } Public String getVehicleAtrributes() {) . . } Public String getModelName() {) . . } } Assuming that the names of the methods reflect their action, which of the following statements about this class is correct?

(Multiple Choice)
4.9/5
(34)

Given the following class definition, which of the following are NOT considered part of the class's public interface? Public class Motorcycle { Public static final int WHEEL_COUNT = 2; Private int rpmRating; Public void updatePrice(double increase) {…} Private String designCode() {…} }

(Multiple Choice)
4.7/5
(35)

The utility that formats program comments into a set of documents that you can view in a Web browser is called ____.

(Multiple Choice)
4.9/5
(38)

Which of the following statements about classes is correct?

(Multiple Choice)
4.7/5
(35)

Consider the following code snippet: Coin coin1 = new Coin("dime", 0.10); Coin coin2 = new Coin("dime", 0.10); Which of the following statements is correct?

(Multiple Choice)
4.9/5
(41)

You should declare all instance variables as ___.

(Multiple Choice)
4.8/5
(44)

Which of the following statements about testing a class is correct?

(Multiple Choice)
4.8/5
(45)

The public constructors and methods of a class form the public _____ of the class.

(Multiple Choice)
4.9/5
(36)

Insert the missing code in the following code fragment. This fragment is intended to implement a method to assign a value to an instance variable. Public class Vehicle { Private String model; Private double rpm; ) . . _______ { Model = modelName; } }

(Multiple Choice)
4.9/5
(39)

Insert the missing code in the following code fragment. This fragment is intended to initialize an instance variable. Public class Motor { Int motorSpeed; Public Motor(int speed) { MotorSpeed = speed; } Public Motor() { _________; } } Which of the following lines of code will allow the second constructor to call the first constructor?

(Multiple Choice)
4.9/5
(41)

Which operator should you use to test whether an object reference is null?

(Multiple Choice)
4.8/5
(34)

Which statement illustrates the invocation of a static method?

(Multiple Choice)
4.8/5
(46)

Which type of method modifies the object on which it is invoked?

(Multiple Choice)
4.9/5
(35)

Complete the following code snippet to create a constructor that will initialize the class instance variables shown using data provided by the program which is creating an object from this class. Public class Employee { Private String empID; Private boolean hourly; _______________________ { ) . . } } Which of the following statements can be used to create an object of type Employee?

(Multiple Choice)
4.9/5
(32)

Insert the missing code in the following code fragment. This fragment is intended to implement a method to get the value stored in an instance variable. Public class Employee { Private String empID; Private boolean hourly; ) . . _______ { Return hourly; } }

(Multiple Choice)
4.8/5
(26)
Showing 1 - 20 of 101
close modal

Filters

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