Exam 8: Objects and Classes

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

The ____ operator is used to construct an object from a class.

(Multiple Choice)
4.9/5
(27)

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

(Multiple Choice)
4.9/5
(44)

Given the following class definition, which of the following are NOT considered part of the class's public interface? Public class CashRegister { Public static final double DIME_VALUE = 0.1; Private static int objectCounter; Public void updateDimes(int dimes) {…} Private boolean updateCounter(int counter) {…} }

(Multiple Choice)
4.8/5
(43)

Which of the following statements about instance methods is correct?

(Multiple Choice)
4.9/5
(40)

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 these instance methods is NOT correct?

(Multiple Choice)
4.8/5
(35)

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

(Multiple Choice)
4.7/5
(37)

The process of hiding object data and providing methods for data access is called ____.

(Multiple Choice)
4.9/5
(38)

Consider the following code snippet: Public int getCoinValue(String coinName) { ) . . } Which of the following statements is correct?

(Multiple Choice)
4.9/5
(43)

Given the following class definition, which of the following are 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.8/5
(42)

Which of the following statements about classes is correct?

(Multiple Choice)
4.9/5
(35)

Which statement about instance variables is correct?

(Multiple Choice)
5.0/5
(36)

Which of the following statements about encapsulation is correct?

(Multiple Choice)
4.8/5
(35)

Which of the following statements about constructors is correct?

(Multiple Choice)
4.7/5
(35)

Consider the following code snippet: Public int getSalary(String empNum) { ) . . } Which of the following statements is correct?

(Multiple Choice)
4.8/5
(35)

Given the following class definition, which of the following are considered part of the class's public interface? Public class CashRegister { Public static final double DIME_VALUE = 0.1; Private static int objectCounter; Public void updateDimes(int dimes) {. . .} Private boolean updateCounter(int counter) {. . .} }

(Multiple Choice)
4.9/5
(34)

The this reference refers to ____.

(Multiple Choice)
4.8/5
(44)

Given the following class: Public class Coin { Private String coinName; Private double coinValue; ) . . } Consider the following code snippet that utilizes the Coin class: Coin coin1 = new Coin("dime", 0.10); Coin coin2 = coin1; Coin2.setValue(0.15); Which of the following statements is correct?

(Multiple Choice)
4.9/5
(33)

Consider the following code snippet: Coin coin1 = null; System.out.println("Value of coin = " + coin1.getValue()); What is wrong with this code?

(Multiple Choice)
4.8/5
(38)

Consider the following code snippet: Public class Employee { Private String empID; Private boolean hourly; Public Employee() { } ) . . } Which statement reflects the action performed when the constructor to Employee is called?

(Multiple Choice)
4.9/5
(40)

Data required for an object's use are stored in ____.

(Multiple Choice)
4.7/5
(34)
Showing 81 - 100 of 101
close modal

Filters

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