Exam 3: Using Methods Classes and Objects
Exam 1: Creating Java Programs61 Questions
Exam 2: Using Data67 Questions
Exam 3: Using Methods Classes and Objects66 Questions
Exam 4: More Object Concepts66 Questions
Exam 5: Making Decisions66 Questions
Exam 6: Looping66 Questions
Exam 7: Characters Strings and the Stringbuilder68 Questions
Exam 8: Arrays66 Questions
Exam 9: Advanced Array Concepts66 Questions
Exam 10: Introduction to Inheritance66 Questions
Exam 11: Advanced Inheritance Concepts66 Questions
Exam 12: Exception Handling66 Questions
Exam 13: File Input and Output66 Questions
Exam 14: Introduction to Swing Components66 Questions
Exam 15: Advanced Gui Topics66 Questions
Exam 16: Graphics66 Questions
Select questions type
Describe fully qualified identifiers and explain why they are necessary.
Free
(Essay)
4.8/5
(39)
Correct Answer:
A complete name that includes the class is a fully qualified identifier. If you want to use a method in another class, the compiler does not recognize the method unless you use the full name. A fully qualified identifier includes the class time, a dot, and the method name.
Often, programmers list the ____________________ first because it is the first method used when an object is created.
Free
(Short Answer)
4.8/5
(38)
Correct Answer:
constructor
public int getStudentNum()
{
return studentNum;
}
In the above code, identify if the method is a mutator method or an accessor method. Describe how the two types of methods differ and how they are similar.
Free
(Essay)
4.8/5
(44)
Correct Answer:
Methods that set or change field values are called mutator methods; methods that retrieve
values are called accessor methods. In Java, mutator methods conventionally start with the
prefix set , and accessor methods conventionally start with the prefix get . Using these three-letter prefixes with your method names is not required, but it is conventional.
The method in the above code is an accessor method because it retrieves studentNum.
Does a programmer need to write every class he or she uses? Why or why not?
(Essay)
4.7/5
(39)
After an object has been instantiated, its methods can be accessed using the object's _____, a dot, and a method call.
(Multiple Choice)
4.7/5
(34)
Parentheses in a method declaration contain parameters that are "dropped into" the method.
(True/False)
4.9/5
(39)
public Employee()
{
empSalary = 300.00;
}
The above code shows the Employee class constructor. What is a constructor and how would this default constructor operate?
(Essay)
4.8/5
(40)
In order to allocate the needed memory for an object, you must use the ____ operator.
(Multiple Choice)
4.9/5
(38)
public static void predictRaise(double salary)
{
double newSalary;
final double RAISE_RATE = 1.10;
newSalary = salary * RAISE_RATE;
System.out.println("Current salary: " +
salary + " After raise: " +
newSalary);
}
In the above code, what are the parameter data type and parameter identifier? How do you identify each?
(Essay)
4.9/5
(35)
The name of the ____ is always the same as the name of the class whose objects it constructs.
(Multiple Choice)
4.9/5
(42)
How does the order in which methods appear in a class affect how the application executes? Please explain.
(Essay)
4.9/5
(40)
When an application is run, the method that must be executed first must be named ____.
(Multiple Choice)
4.7/5
(43)
A major advantage of a method is that it is easily reusable. What does it mean to reuse a method and what are the advantages of doing so?
(Essay)
4.8/5
(27)
In the above code, the calculateBonus() method acts as a "black box." What does this mean?

(Essay)
4.9/5
(41)
Normally, you declare constructors to be ____________________ so that other classes can instantiate objects that belong to the class.
(Short Answer)
4.8/5
(41)
Public classes are accessible by all objects, which means that public classes can be ____, or used as a basis for any other class.
(Multiple Choice)
4.9/5
(42)
Showing 1 - 20 of 66
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)