Exam 8: Objects and Classes

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

You have created a ShoppingCart class and a Fruit class. Which of the following will correctly declare an array list of Fruit objects in the ShoppingCart class?

(Multiple Choice)
4.8/5
(34)

Which of the following statements about a class is correct?

(Multiple Choice)
4.8/5
(41)

Consider the following code snippet: Public class Vehicle { Private String model; Private double rpm; ) . . } Which of the following methods would correctly remove the values of the class instance variables?

(Multiple Choice)
4.9/5
(30)

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

(Multiple Choice)
4.9/5
(41)

Which of the following is NOT part of the declaration of an instance variable?

(Multiple Choice)
4.9/5
(43)

Which of the following statements using data values in a class is NOT correct?

(Multiple Choice)
4.9/5
(35)

Insert the missing code in the following code fragment. This fragment is intended to initialize an instance variable. Public class Employee { Private String empName; ) . . Public Employee(String empName) { ________ } }

(Multiple Choice)
4.8/5
(35)

The object on which a method is invoked is called the ____.

(Multiple Choice)
4.8/5
(35)

Which of the following is a mutator method of the CashRegister class used in the textbook?

(Multiple Choice)
4.9/5
(39)

Private instance variables ___.

(Multiple Choice)
4.9/5
(36)

Consider the following code snippet: Public class Student { Private static int lastAssignedStudentNum = 1500; { ) . . } } Which of the following statements about this code is correct?

(Multiple Choice)
4.9/5
(41)

You have created a Coin class and a Purse class. Which of the following will correctly allow the Purse class to collect Coin objects?

(Multiple Choice)
4.9/5
(43)

Which of the following are considered members of a class?

(Multiple Choice)
4.9/5
(34)

Consider the following code snippet: Public class Vessel { Private String type; Public String Vessel(String type) { ) . . } } What is wrong with this code?

(Multiple Choice)
4.8/5
(33)

Which of the following is an accessor method of the CashRegister class used in the textbook?

(Multiple Choice)
4.7/5
(41)

Consider the following code snippet: Public class Employee { Private String empName; Public String getEmpName() { ) . . } } Which of the following statements is correct?

(Multiple Choice)
4.7/5
(39)

Consider the following code snippet: Public class AutoRace { Private int lapCount; Private double totalTime; ) . . } Which of the following completeLap methods would correctly track how many laps occurred?

(Multiple Choice)
4.7/5
(37)

You are creating a class named Vessel. Which statement correctly declares a constructor for this class?

(Multiple Choice)
4.7/5
(27)

Which of the following statements about encapsulation is correct?

(Multiple Choice)
4.7/5
(29)

Each object of a class has a separate copy of each ___.

(Multiple Choice)
4.8/5
(41)
Showing 61 - 80 of 101
close modal

Filters

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