Exam 8: Objects and Classes
Exam 1: Introduction96 Questions
Exam 2: Fundamental Data Types103 Questions
Exam 3: Decisionseasy99 Questions
Exam 4: Loops100 Questions
Exam 5: Methods94 Questions
Exam 6: Arrays and Arraylists100 Questions
Exam 7: Inputoutput and Exception Handling100 Questions
Exam 8: Objects and Classes101 Questions
Exam 9: Inheritance and Interfaces99 Questions
Exam 10: Graphical User Interfaces54 Questions
Exam 11: Advanced User Interfaces91 Questions
Exam 12: Object-Oriented Design100 Questions
Exam 13: Recursion100 Questions
Exam 14: Sorting and Searching99 Questions
Exam 15: The Java Collections Framework100 Questions
Exam 16: Basic Data Structures94 Questions
Exam 17: Tree Structures100 Questions
Exam 18: Generic Classes78 Questions
Exam 19: Streams and Binary Inputoutput82 Questions
Exam 20: Multithreading82 Questions
Exam 21: Internet Networking74 Questions
Exam 22: Relational Databases75 Questions
Exam 23: XML74 Questions
Exam 24: Web Applications74 Questions
Select questions type
An instance variable declaration consists of ____.
Free
(Multiple Choice)
4.8/5
(43)
Correct Answer:
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:
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:
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)
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)
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
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)