Question
1. If two method headers are identical, changing which of the following could make the method signatures unique? A. Method name B. Parameter data type
1. If two method headers are identical, changing which of the following could make the method signatures unique? A. Method name
B. Parameter data type
C. Return value type
D. Formal parameter name
E. All of the above
F. A and B 2. A In the Java statement, Math.pow( a, b );, a and b are referred to as: A. actual parameters
B. formal parameters
C. static variables
D. B and C
E. None of the above.
3. The StringBuilder Class A. Is mutable like the StringBuffer class.
B. Has non-synchronized methods.
C. In most cases, can seamlessly replace the String Class in a program with little or no changes to the code.
D. All of the above
E. None of the above
4. If s1 and s2 both print out Hello World when used as parameters in the System.out.println() method: A. (s1.equals(s2)) definitely returns a value of true.
B. (s1 == s2) might return a value of true.
C. (s1 == s2) definitely returns a value of true.
D. A and B
E. A and C
5. A class is a template for creating __________________ . A. Java Source Code (JSC)
B. Objects
C. Methods
D. Program data
E. None of the above
6. Analyze the following code contained in the file Circle.java.:
class Circle {
private double radius;
public Circle(double radius) {
radius = radius;
}
} A. The class has a compiler error because you cannot assign radius to radius.
B. The class will compile, but you cannot create/instantiate an object of Circle with a specified radius. The object will always have radius 0.
C. The class does not compile because Circle does not have a default constructor.
D. The class has a compilation error because it does not have a main method. 7. Given the declaration Circle x = new Circle(), which statement is most accurate. A. x contains a Circle object
B. You can assign an int value to x.
C. x contains a reference to a Circle object.
D. x contains a null value.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started