Introduction to Java Programming Comprehensive Version 9th Edition Liang Test Bank pdf download
Introduction to Java Programming Comprehensive Version 9th Edition Liang Test Bank pdf download
https://testbankfan.com/product/introduction-to-java-programming-
comprehensive-version-9th-edition-liang-test-bank/
https://testbankfan.com/product/introduction-to-java-programming-
comprehensive-version-10th-edition-liang-test-bank/
https://testbankfan.com/product/introduction-to-java-programming-
comprehensive-version-10th-edition-liang-solutions-manual/
https://testbankfan.com/product/introduction-to-java-programming-
brief-version-10th-edition-liang-test-bank/
https://testbankfan.com/product/think-sociology-canadian-2nd-edition-
carl-solutions-manual/
Starting Out with Python 4th Edition Gaddis Test Bank
https://testbankfan.com/product/starting-out-with-python-4th-edition-
gaddis-test-bank/
https://testbankfan.com/product/psychology-themes-and-variations-8th-
edition-weiten-test-bank/
https://testbankfan.com/product/illustrated-microsoft-office-365-and-
powerpoint-2016-introductory-1st-edition-beskeen-solutions-manual/
https://testbankfan.com/product/pharmacology-and-the-nursing-
process-8th-edition-lilley-snyder-test-bank/
https://testbankfan.com/product/effective-human-relations-
interpersonal-and-organizational-applications-13th-edition-reece-
solutions-manual/
Understanding Psychology 12th Edition Feldman Test Bank
https://testbankfan.com/product/understanding-psychology-12th-edition-
feldman-test-bank/
Name:_______________________ CSCI 1302 OO Programming
Armstrong Atlantic State University
(50 minutes) Instructor: Y. Daniel Liang
Part I:
(A)
B’s constructor is invoked
A’s constructor is invoked
(B)
(a) The program has a syntax error because x does not have the compareTo
method.
(b) The program has a syntax error because the member access operator (.) is
executed before the casting operator.
(C)
(1) false
(2) true
(3) false (because they are created at different times)
(4) true
(E) The method throws a checked exception. You have to declare to throw
the exception in the method header.
Part II:
1
return result;
}
a. private method
b. protected method
c. public method
d. a and c
e. b and c
Key:e
2
#
2. Show the output of running the class Test in the following code:
interface A {
void print();
}
class C {}
a. Nothing.
b. b is an instance of A.
c. b is an instance of C.
d. b is an instance of A followed by b is an instance of C.
Key:d
#
3. When you implement a method that is defined in a superclass, you
__________ the original method.
a. overload
b. override
c. copy
d. call
Key:b
#
4. What is the output of running the class C.
public class C {
public static void main(String[] args) {
Object[] o = {new A(), new B()};
System.out.print(o[0]);
System.out.print(o[1]);
}
}
class A extends B {
public String toString() {
return "A";
}
}
3
class B {
public String toString() {
return "B";
}
}
a. AB
b. BA
c. AA
d. BB
e. None of above
Key:a
#
5. What is the output of running class C?
class A {
public A() {
System.out.println(
"The default constructor of A is invoked");
}
}
class B extends A {
public B(String s) {
System.out.println(s);
}
}
public class C {
public static void main(String[] args) {
B b = new B("The constructor of B is invoked");
}
}
a. none
b. "The constructor of B is invoked"
c. "The default constructor of A is invoked" "The constructor of B
is invoked"
d. "The default constructor of A is invoked"
Key:c
#
6. Analyze the following code:
a. The program has a syntax error because Test1 does not have a main
method.
4
b. The program has a syntax error because o1 is an Object instance
and it does not have the compareTo method.
c. The program has a syntax error because you cannot cast an Object
instance o1 into Comparable.
d. The program would compile if ((Comparable)o1.compareTo(o2) >= 0)
is replaced by (((Comparable)o1).compareTo(o2) >= 0).
e. b and d are both correct.
Key:e
#
7. The method _____ overrides the following method:
#
8. Which of the following possible modifications will fix the errors in
this code?
#
9. Analyze the following code.
class Test {
public static void main(String[] args) {
Object x = new Integer(2);
System.out.println(x.toString());
}
}
5
Key:c
#
10. What exception type does the following program throw?
public class Test {
public static void main(String[] args) {
Object o = new Object();
String d = (String)o;
}
}
a. ArithmeticException
b. No exception
c. StringIndexOutOfBoundsException
d. ArrayIndexOutOfBoundsException
e. ClassCastException
Key:e
#
11. What exception type does the following program throw?
public class Test {
public static void main(String[] args) {
Object o = null;
System.out.println(o.toString());
}
}
a. ArrayIndexOutOfBoundsException
b. ClassCastException
c. NullPointerException
d. ArithmeticException
e. StringIndexOutOfBoundsException
Key:c
6
Random documents with unrelated
content Scribd suggests to you:
− Outlook. 85: 330. F. 9, ’07. 350w.
+
The story of May and the winning over of her friend Merle,
whose world was all awry, to a wholesome girlish view of life will
interest boys as well as girls, for it is full of both fun and
incident.
“It would interest boys, too, and it is better than the title
would suggest.”
+ Bookm. 24: 525. Ja. ’07. 30w.
“It is full of wholesome lively, good fun, with just enough
seriousness to carry it home to susceptible young hearts. It
would do any girl good to read it.”
+ N. Y. Times. 12: 3. Ja. 5, ’07. 480w.
“It happens that Mr. Staley’s praise is not only tiresome, but
generally meaningless, and without any clear perception of the
real quality of the work praised.”
− Nation. 84: 67. Ja. 17, ’07. 260w.
“The [narrative biography] is admirably told with sufficient
anecdote to appeal to the general reader, while the chronology
of his advancement is preserved for reference through the titles
of his pictures inserted as marginal notes.”
+ N. Y. Times. 11: 836. D. 1, ’06. 570w.
“He has written with such apparent indiscrimination.”
− Outlook. 84: 706. N. 24, ’06. 340w.
“Lord Stanmore has, on the whole, done his work well, but
some readers will object to the occasional intrusion of his own
personality and opinions.”
+ Ath. 1906, 2: 726. D. 8. 3450w.
−
“It is good that the world should know what war means for the
men who are of the administrations responsible for a war; and
except for the Aberdeen memoirs, there are among English
political biographies no books which are more valuable from this
point of view than the biography of Sidney Herbert.”
+ Ind. 63: 822. O. 3, ’07. 790w.
“In many respects Sidney Herbert is singularly fortunate in his
biographer. He is only unfortunate in having had to wait so long.
His treatment of the Crimean war and its causes is such as might
not unfairly be called in these days a little old-fashioned.”
+ Lond. Times. 5: 413. D. 14, ’06. 2700w.
+
−
“The net impression would have been better made in one-third
the space.”
+ Nation. 84: 204. F. 28, ’07. 410w.
−
“It is as a history of the Peelites that biography is chiefly
interesting, and especially for the fresh light it throws, not on
Herbert, but on Gladstone, the most distinguished and the most
able of the Peelites. For the rest, we must admit, that we have
found the work formidable and rather dreary reading.”
+ Outlook. 85: 332. F. 9, ’07. 260w.
−
testbankfan.com