Solution Manual for Introduction to Java Programming, Brief Version, 11th Edition, Y. Daniel Liang pdf download
Solution Manual for Introduction to Java Programming, Brief Version, 11th Edition, Y. Daniel Liang pdf download
https://testbankmall.com/product/solution-manual-for-
introduction-to-java-programming-brief-version-11th-edition-y-
daniel-liang/
https://testbankmall.com/product/solution-manual-for-revel-for-
introduction-to-python-programming-and-data-structures-y-daniel-liang/
https://testbankmall.com/product/test-bank-inquiry-into-life-sylvia-
mader-14th-edition/
Principles and Practice of Physics 1st Edition Eric Mazur
Solutions Manual
https://testbankmall.com/product/principles-and-practice-of-
physics-1st-edition-eric-mazur-solutions-manual/
https://testbankmall.com/product/test-bank-for-physics-a-conceptual-
world-view-7th-edition/
https://testbankmall.com/product/discrete-mathematics-and-
applications-2nd-ferland-test-bank/
College Physics 10th Edition Young Test Bank
https://testbankmall.com/product/college-physics-10th-edition-young-
test-bank/
Chinese RMB or US dollars, respectively. Here are the
sample runs:
<Output>
Enter the exchange rate from dollars to RMB: 6.81
Enter 0 to convert dollars to RMB and 1 vice versa: 0
Enter the dollar amount: 100
$100.0 is 681.0 Yuan
<End Output>
<Output>
Enter the exchange rate from dollars to RMB: 6.81
Enter 0 to convert dollars to RMB and 1 vice versa: 1
Enter the RMB amount: 10000
10000.0 Yuan is $1468.43
<End Output>
<Output>
Enter the exchange rate from dollars to RMB: 6.81
Enter 0 to convert dollars to RMB and 1 vice versa: 5
Incorrect input
<End Output>
2
2. (10 pts) Write a program that prompts the user to enter an integer. If
the number is a multiple of 5, print HiFive. If the number is divisible
by 2 or 3, print Georgia. Here are the sample runs:
<Output>
Enter an integer: 6
Georgia
<End Output>
<Output>
Enter an integer: 15
HiFive Georgia
<End Output>
<Output>
Enter an integer: 25
HiFive
<End Output>
<Output>
Enter an integer: 1
<End Output>
3
Name:
a. 76
b. 76.0252175
c. 76.03
d. 76.02
#
2. What is y after the following switch statement?
int x = 0;
int y = 0;
switch (x + 1) {
case 0: y = 0;
case 1: y = 1;
default: y = -1
}
a. 2
b. 1
c. 0
d. -1
#
3. Assume x is 0. What is the output of the following statement?
if (x > 0)
System.out.print("x is greater than 0");
else if (x < 0)
System.out.print("x is less than 0");
else
System.out.print("x equals 0");
a. x is less than 0
b. x is greater than 0
c. x equals 0
d. None
4
4. Analyze the following code:
Code 1:
boolean even;
if (number % 2 == 0)
even = true;
else
even = false;
Code 2:
#
5. What is the output of the following switch statement?
char ch = 'a';
switch (ch) {
case 'a':
case 'A':
System.out.print(ch); break;
case 'b':
case 'B':
System.out.print(ch); break;
case 'c':
case 'C':
System.out.print(ch); break;
case 'd':
case 'D':
System.out.print(ch);
}
a. ab
b. a
c. aa
d. abc
e. abcd
5
#
6. What is x after evaluating
x = (2 > 3) ? 2 : 3;
a. 5
b. 2
c. 3
d. 4
#
7. Analyze the following code.
int x = 0;
if (x > 0);
{
System.out.println("x");
}
#
8. To declare a constant MAX_LENGTH inside a method with value 99.98, you write
#
9. Which of the following is a constant, according to Java naming conventions?
a. read
b. MAX_VALUE
c. ReadInt
d. Test
#
10. What is y after the following switch statement is executed?
x = 3;
switch (x + 3) {
case 6: y = 0;
case 7: y = 1;
default: y += 1;
}
6
a. 1
b. 4
c. 3
d. 2
e. 0
#
11. Which of the following code displays the area of a circle if the radius is
positive.
7
Sample Final Exam for CSCI 1302
Here is a mapping of the final comprehensive exam against the course outcomes:
1
Name: CSCI 1302 Introduction to Programming
Covers chs8-19 Armstrong Atlantic State University
Final Exam Instructor: Dr. Y. Daniel Liang
Please note that the university policy prohibits giving the exam score by email. If you need to know your
final exam score, come to see me during my office hours next semester.
I pledge by honor that I will not discuss the contents of this exam with
anyone.
Signed by Date
Design a class named Person and its two subclasses named Student and
Employee. Make Faculty and Staff subclasses of Employee. A person has a
name, address, phone number, and email address. A student has a class
status (freshman, sophomore, junior, or senior). Define the status as a
constant. An employee has an office, salary, and date hired. Define a
class named MyDate that contains the fields year, month, and day. A
faculty member has office hours and a rank. A staff member has a title.
Override the toString method in each class to display the class name
and the person's name.
Draw the UML diagram for the classes. Write the code for the Student
class only.
2
2. Design and use interfaces (10 pts)
3
3. Design and create GUI applications (10 pts)
Write a Java applet to add two numbers from text fields, and
displays the result in a non-editable text field. Enable your applet
to run standalone with a main method. A sample run of the applet is
shown in the following figure.
4
4. Text I/O (10 pts)
5
5. Multiple Choice Questions: (1 pts each)
(1. Mark your answers on the sheet. 2. Login and click Take
Instructor Assigned Quiz for QFinal. 3. Submit it online
within 5 mins. 4. Close the Internet browser.)
1. describes the state of an object.
a. data fields
b. methods
c. constructors
d. none of the above
#
2. An attribute that is shared by all objects of the class is coded
using .
a. an instance variable
b. a static variable
c. an instance method
d. a static method
#
3. If a class named Student has no constructors defined explicitly,
the following constructor is implicitly provided.
a. public Student()
b. protected Student()
c. private Student()
d. Student()
#
4. If a class named Student has a constructor Student(String name)
defined explicitly, the following constructor is implicitly provided.
a. public Student()
b. protected Student()
c. private Student()
d. Student()
e. None
#
5. Suppose the xMethod() is invoked in the following constructor in
a class, xMethod() is in the class.
public MyClass() {
xMethod();
}
a. a static method
b. an instance method
c. a static method or an instance method
#
6. Suppose the xMethod() is invoked from a main method in a class as
follows, xMethod() is in the class.
6
xMethod();
}
a. a static method
b. an instance method
c. a static or an instance method
#
7. What would be the result of attempting to compile and
run the following code?
public class Test {
static int x;
#
8. Analyze the following code:
#
9. Suppose s is a string with the value "java". What will be
assigned to x if you execute the following code?
char x = s.charAt(4);
a. 'a'
b. 'v'
c. Nothing will be assigned to x, because the execution causes the
runtime error StringIndexOutofBoundsException.
d. None of the above.
#
10. What is the printout for the following code?
class Test {
7
public static void main(String[] args) {
int[] x = new int[3];
System.out.println("x[0] is "+x[0]);
}
}
a. The program has a syntax error because the size of the array
wasn't specified when declaring the array.
b. The program has a runtime error because the array elements are
not initialized.
c. The program runs fine and displays x[0] is 0.
d. None of the above.
#
11. How can you get the word "abc" in the main method from the
following call?
a. args[0]
b. args[1]
c. args[2]
d. args[3]
#
12. Which code fragment would correctly identify the number of
arguments passed via the command line to a Java application,
excluding the name of the class that is being invoked?
#
13. Show the output of running the class Test in the following code
lines:
interface A {
void print();
}
class C {}
class Test {
public static void main(String[] args) {
B b = new B();
if (b instanceof A)
System.out.println("b is an instance of A");
if (b instanceof C)
System.out.println("b is an instance of C");
}
}
8
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.
#
14. When you implement a method that is defined in a superclass, you
the original method.
a. overload
b. override
c. copy
d. call
#
15. What modifier should you use on a variable so that it can only be
referenced inside its defining class.
a. public
b. private
c. protected
d. Use the default modifier.
#
16. 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() {
System.out.println(
"The default constructor of B is invoked");
}
}
public class C {
public static void main(String[] args) {
B b = new B();
}
}
a. none
b. "The default constructor of B is invoked"
c. "The default constructor of A is invoked" followed by "The
default constructor of B is invoked"
d. "The default constructor of A is invoked"
#
17. Analyze the following program.
class Test {
9
Random documents with unrelated
content Scribd suggests to you:
to worry about handling any other ships that might follow this one."
"Right, sir," said McTavish. "And, man, begging your pardon, sir, I
hope we're in on the handling!"
Lieutenant-Commander Clemens shook his head moodily. "We did
well. But the Congress of Specialists will be disappointed. We didn't
bring back prisoners for examination."
But his eyes were smiling—again.
*** END OF THE PROJECT GUTENBERG EBOOK INVADER FROM
INFINITY ***
Updated editions will replace the previous one—the old editions will
be renamed.
1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the
terms of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.
• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”
• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.F.
1.F.4. Except for the limited right of replacement or refund set forth
in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.
Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.
testbankmall.com