Exam 4: Writing Classes
Exam 1: Introduction65 Questions
Exam 2: Data and Expressions77 Questions
Exam 3: Using Classes and Objects58 Questions
Exam 4: Writing Classes56 Questions
Exam 5: Conditionals and Loops37 Questions
Exam 6: More Conditionals and Loops36 Questions
Exam 7: Object-Oriented Design76 Questions
Exam 8: Arrays70 Questions
Exam 9: Inheritance71 Questions
Exam 10: Polymorphism70 Questions
Exam 11: Exceptions68 Questions
Exam 12: Recursion68 Questions
Exam 13: Collections68 Questions
Select questions type
Java methods can return only primitive types (int, double, float, char, boolean, etc).
Free
(True/False)
4.8/5
(35)
Correct Answer:
False
An example of passing message to a String where the message has a String parameter would occur in which of the following messages?
Free
(Multiple Choice)
4.8/5
(31)
Correct Answer:
C
Write a statement to instantiate a cube with a length of 3, width of 3, and height of 3.
Free
(Short Answer)
4.9/5
(29)
Correct Answer:
Box cube = new Box(3);
What happens if you declare a class constructor to have a void return type?
(Multiple Choice)
4.8/5
(33)
Formal parameters are those that appear in the method call and actual parameters are those that appear in the method header.
(True/False)
4.7/5
(54)
Write the statement to instantiate an Box object, blueBox, with a length of 6, width of 4, and height of 2.
(Short Answer)
4.8/5
(32)
To define a class that will represent a car, which of the following definitions is most appropriate?
(Multiple Choice)
4.9/5
(34)
The relationship between a class and an object is best described as
(Multiple Choice)
4.9/5
(32)
Having multiple class methods of the same name where each method has a different number of or type of parameters is known as
(Multiple Choice)
4.9/5
(35)
A constructor may contain a return statement so long as no value (or expression) is returned.
(True/False)
4.8/5
(48)
The expressions that are passed to a method in an invocation are called
(Multiple Choice)
4.8/5
(28)
The following method header definition will result in a syntax error: public void aMethod( );
(True/False)
4.9/5
(45)
Consider a method defined with the header: public void doublefoo(double x). Which of the following method calls is legal?
(Multiple Choice)
4.7/5
(42)
Assume method0 calls method1 and method2, method1 calls method3 which calls method4 and method5. Explain the chain of method calls (what order methods are called and from which method).
(Essay)
4.9/5
(38)
While multiple objects of the same class can exist, in a given program there can be only one version of each class.
(True/False)
4.9/5
(38)
Write a toString method that returns the player's name, position and batting average formatted to have 1 digit to the left of the decimal and 3 digits to the right of the decimal. Assume DecimalFormat has been imported.
(Essay)
4.8/5
(38)
Showing 1 - 20 of 56
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)