47. Inheritance models the __________ relationship between two classes. a.static
ID: 3596278 • Letter: 4
Question
47. Inheritance models the __________ relationship between two classes.
a.static
b.is-a
c.has-a
d.private
48. Calling the same method name for objects of different classes which have different implementations (ways of doing the operation) demonstrates __________.
a.inheritance
b.subordination
c.polymorphism
d.implementation hiding
49.
Given two String references, name1 and name2, the statement if(name1 = = name2) tests ________.
if the contents of the first String are equal to the second
if the variables reference the same String
nothing - it assigns the second String to the first
nothing - it is not a valid operation for String objects
50. The correct statement that will instantiate a Graphics object named picasso is __________.
Graphics picasso;
Graphics picasso = new Graphics();
Graphics picasso = getGraphics();
Graphics picasso = getGraphics(new)
51. When passing an array to a method __________ is passed.
a reference to the array
the entire array
nothing (arrays cannot be passed to methods)
each individual element
52. Which of the two statements: 1) int[ ] array; 2) int array[ ]; is correct?
only the first is correct
only the second is correct
both are correct
neither is correct
53. Given that a class defines an instance variable as Timestamp ts and a method with a header of public boolean setTo(Timestamp ts), an appropriate implementation might contain _________.
this.ts = ts;
ts = this.ts;
ts = ts
name conflict - cannot do this
54. Variables that are shared by every instance of a class are __________.
class variables
private variables
public variables
illegal
55. The keyword final in a variable declaration indicates __________.
the end of the program
a static field
a symbolic, or named, constant
that no more variables will be declared in the program
56. Overloaded methods cannot have the same __________.
name
number of parameters
number and order of argument types
return type
57. If you declare a variable within a class and declare and use the same variable name within a method of the class, __________.
the variable used inside the method takes precedence
the class variable takes precedence
they become the same variable with the same memory address
an error will occur
a.if the contents of the first String are equal to the second
b.if the variables reference the same String
c.nothing - it assigns the second String to the first
d.nothing - it is not a valid operation for String objects
Explanation / Answer
47. b) is-a
48. c) polymorphism
49. b) if the variables reference the same String
50. c) Graphics picasso = getGraphics();
51. a) a reference to the array
52. c) both are correct
53. a) this.ts = ts;
54. a) class variables
55. b) a static field
56. b) number of parameters
57. c) they become the same variable with the same memory address
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.