Solution xtand xtAnswer xtGuide : Farrell, Java Programming 10e, [978-035-767-3423], Chapter 1: Creating Java Programs
xt xt xt xt xt xt xt xt xt xt
SolutionandAnswerGuide xt xt xt
Farrell, Java Programming 10e, [978-035-767-3423], Chapter 1: Creating Java Programs
xt xt xt xt xt xt xt xt xt
Table of Contents xt xt
Review Questions Answers.................................................................................................. 1
xt xt
Programming Exercises Solutions......................................................................................... 7
xt xt
Debugging Exercises Solutions ........................................................................................... 13
xt xt
Game Zone Solutions ........................................................................................................ 15
xt xt
Case Problems Solutions .................................................................................................... 17
xt xt
Review Questions Answers xt xt
1. The most basic circuitry-level computer language is ____________.
xt xt xt xt xt xt xt
a. machine language xt
b. Java
c. high-level language xt
d. C++
Answer: a xt
Feedback: xt
The most basic circuitry-level computer language is machine language. Machine language, or
xt xt xt xt xt xt xt xt xt xt xt
machine code, is the most basic set of instructions a computer can execute. Java and C++ are both
xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt
high-level languages and are the opposite of circuitry-level computer language.
xt xt xt xt xt xt xt xt xt xt xt
2. Languages that let you use an easily understood vocabulary of descriptive terms, such as read, write, or add,
xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt
xt are known as ____________languages.
xt xt xt
a. procedural
b. high-level
c. machine
d. object-oriented
Answer: b xt
Feedback: xt
High-level languages use English-like terms; Java is an example of a high-level language. xt xt xt xt xt xt xt xt xt xt xt xt
Procedural languages are those that run by executing a series of procedures or methods. Machine-
xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt
© 2022 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in
xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt
1
whole or in part.
xt xt xt xt xt
, Solution xtand xtAnswer xtGuide : Farrell, Java Programming 10e, [978-035-767-3423], Chapter 1: Creating Java Programs
xt xt xt xt xt xt xt xt xt xt
level languages do not use English-like terms; they use 1s and 0s. Object-oriented languages are
xt xt xt xt xt xt xt xt xt xt xt xt xt xt
run by declaring and using objects that contain data and methods.
xt xt xt xt xt xt xt xt xt xt xt
3. The rules of a programming language constitute its ____________.
xt xt xt xt xt xt xt xt
a. syntax
b. logic
c. format
d. objects
Answer: a xt
Feedback: xt
The rules of a programming language constitute its syntax.
xt xt xt xt xt xt xt xt
4. A ____________ translates high-level language statements into machine code.
xt xt xt xt xt xt xt xt
a. programmer
b. syntax detector xt
c. compiler
d. decipherer
Answer: c xt
Feedback: xt
A compiler translates high-level language statements into machine code. A programmer writes
xt xt xt xt xt xt xt xt xt xt xt
high-level language statements but does not translate them. “Syntax detector” and “decipherer”
xt xt xt xt xt xt xt xt xt xt xt xt
are not terms used in programming.
xt xt xt xt xt xt
5. Named computer memory locations are called ____________.
xt xt xt xt xt xt
a. compilers
b. variables
c. addresses
d. appellations
Answer: b xt
Feedback: xt
Named computer memory locations are variables. Compilers translate programming statements
xt xt xt xt xt xt xt xt xt
into machine language; they are not memory locations. Addresses are unnamed computer
xt xt xt xt xt xt xt xt xt xt xt xt
memory locations. “Appellations” is not a term used in programming.
xt xt xt xt xt xt xt xt xt xt
6. The individual operations used in a computer program are often grouped into logical units called
xt xt xt xt xt xt xt xt xt xt xt xt xt xt
© 2022 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in
xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt
2
whole or in part.
xt xt xt xt xt
, Solution xtand xtAnswer xtGuide : Farrell, Java Programming 10e, [978-035-767-3423], Chapter 1: Creating Java Programs
xt xt xt xt xt xt xt xt xt xt
xt ____________.
a. procedures
b. variables
c. constants
d. logistics
Answer: a xt
Feedback: xt
The individual operations used in a computer program are often grouped into logical units called
xt xt xt xt xt xt xt xt xt xt xt xt xt xt
procedures. Variables are named memory locations, and constants are values that do not change;
xt xt xt xt xt xt xt xt xt xt xt xt xt xt
they are not groups of logical operations. “Logistics” is not a term commonly used in programming.
xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt
7. Envisioning program components as objects that are similar to concrete objects in the real world is the
xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt
xt hallmark of ____________. xt xt
a. command-lineoperatingsystems xt xt
b. procedural programming xt
c. object-oriented programming xt
d. machine languages xt
Answer: c xt
Feedback: xt
Envisioning program components as objects that are similar to concrete objects in the real world is
xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt
the hallmark of object-oriented programming.
xt xt xt xt xt
8. The values of an object’s attributes are known as its ____________.
xt xt xt xt xt xt xt xt xt xt
a. state
b. orientation
c. methods
d. condition
Answer: a xt
Feedback: xt
The values of an object’s attributes are known as its state.
xt xt xt xt xt xt xt xt xt xt
9. An instance of a class is a(n) ____________.
xt xt xt xt xt xt xt
© 2022 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in
xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt
3
whole or in part.
xt xt xt xt xt
, Solution xtand xtAnswer xtGuide : Farrell, Java Programming 10e, [978-035-767-3423], Chapter 1: Creating Java Programs
xt xt xt xt xt xt xt xt xt xt
a. method
b. procedure
c. object
d. case
Answer: c xt
Feedback: xt
An instance of a class is an object.
xt xt xt xt xt xt xt xt
10. Java is architecturally ____________.
xt xt xt
a. neutral
b. oriented
c. specific
d. abstract
Answer: a xt
Feedback: xt
Java is architecturally neutral. xt xt xt
11. You must compile classes written in Java into ____________.
xt xt xt xt xt xt xt xt
a. bytecode
b. source code xt
c. Javadoc statements xt
d. object code xt
Answer: a xt
Feedback: xt
You must compile classes written in Java into bytecode. Source code is the high-level programming
xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt
statements. Javadoc statements are a type of comment used for documentation. Object code is the
xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt
low-level code produced when a compiler translates high-level code.
xt xt xt xt xt xt xt xt xt
12. All Java programming statements must end with a ____________.
xt xt xt xt xt xt xt xt
a. period
b. comma
c. closing parenthesis xt
© 2022 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in
xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt
4
whole or in part.
xt xt xt xt xt
xt xt xt xt xt xt xt xt xt xt
SolutionandAnswerGuide xt xt xt
Farrell, Java Programming 10e, [978-035-767-3423], Chapter 1: Creating Java Programs
xt xt xt xt xt xt xt xt xt
Table of Contents xt xt
Review Questions Answers.................................................................................................. 1
xt xt
Programming Exercises Solutions......................................................................................... 7
xt xt
Debugging Exercises Solutions ........................................................................................... 13
xt xt
Game Zone Solutions ........................................................................................................ 15
xt xt
Case Problems Solutions .................................................................................................... 17
xt xt
Review Questions Answers xt xt
1. The most basic circuitry-level computer language is ____________.
xt xt xt xt xt xt xt
a. machine language xt
b. Java
c. high-level language xt
d. C++
Answer: a xt
Feedback: xt
The most basic circuitry-level computer language is machine language. Machine language, or
xt xt xt xt xt xt xt xt xt xt xt
machine code, is the most basic set of instructions a computer can execute. Java and C++ are both
xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt
high-level languages and are the opposite of circuitry-level computer language.
xt xt xt xt xt xt xt xt xt xt xt
2. Languages that let you use an easily understood vocabulary of descriptive terms, such as read, write, or add,
xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt
xt are known as ____________languages.
xt xt xt
a. procedural
b. high-level
c. machine
d. object-oriented
Answer: b xt
Feedback: xt
High-level languages use English-like terms; Java is an example of a high-level language. xt xt xt xt xt xt xt xt xt xt xt xt
Procedural languages are those that run by executing a series of procedures or methods. Machine-
xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt
© 2022 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in
xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt
1
whole or in part.
xt xt xt xt xt
, Solution xtand xtAnswer xtGuide : Farrell, Java Programming 10e, [978-035-767-3423], Chapter 1: Creating Java Programs
xt xt xt xt xt xt xt xt xt xt
level languages do not use English-like terms; they use 1s and 0s. Object-oriented languages are
xt xt xt xt xt xt xt xt xt xt xt xt xt xt
run by declaring and using objects that contain data and methods.
xt xt xt xt xt xt xt xt xt xt xt
3. The rules of a programming language constitute its ____________.
xt xt xt xt xt xt xt xt
a. syntax
b. logic
c. format
d. objects
Answer: a xt
Feedback: xt
The rules of a programming language constitute its syntax.
xt xt xt xt xt xt xt xt
4. A ____________ translates high-level language statements into machine code.
xt xt xt xt xt xt xt xt
a. programmer
b. syntax detector xt
c. compiler
d. decipherer
Answer: c xt
Feedback: xt
A compiler translates high-level language statements into machine code. A programmer writes
xt xt xt xt xt xt xt xt xt xt xt
high-level language statements but does not translate them. “Syntax detector” and “decipherer”
xt xt xt xt xt xt xt xt xt xt xt xt
are not terms used in programming.
xt xt xt xt xt xt
5. Named computer memory locations are called ____________.
xt xt xt xt xt xt
a. compilers
b. variables
c. addresses
d. appellations
Answer: b xt
Feedback: xt
Named computer memory locations are variables. Compilers translate programming statements
xt xt xt xt xt xt xt xt xt
into machine language; they are not memory locations. Addresses are unnamed computer
xt xt xt xt xt xt xt xt xt xt xt xt
memory locations. “Appellations” is not a term used in programming.
xt xt xt xt xt xt xt xt xt xt
6. The individual operations used in a computer program are often grouped into logical units called
xt xt xt xt xt xt xt xt xt xt xt xt xt xt
© 2022 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in
xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt
2
whole or in part.
xt xt xt xt xt
, Solution xtand xtAnswer xtGuide : Farrell, Java Programming 10e, [978-035-767-3423], Chapter 1: Creating Java Programs
xt xt xt xt xt xt xt xt xt xt
xt ____________.
a. procedures
b. variables
c. constants
d. logistics
Answer: a xt
Feedback: xt
The individual operations used in a computer program are often grouped into logical units called
xt xt xt xt xt xt xt xt xt xt xt xt xt xt
procedures. Variables are named memory locations, and constants are values that do not change;
xt xt xt xt xt xt xt xt xt xt xt xt xt xt
they are not groups of logical operations. “Logistics” is not a term commonly used in programming.
xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt
7. Envisioning program components as objects that are similar to concrete objects in the real world is the
xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt
xt hallmark of ____________. xt xt
a. command-lineoperatingsystems xt xt
b. procedural programming xt
c. object-oriented programming xt
d. machine languages xt
Answer: c xt
Feedback: xt
Envisioning program components as objects that are similar to concrete objects in the real world is
xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt
the hallmark of object-oriented programming.
xt xt xt xt xt
8. The values of an object’s attributes are known as its ____________.
xt xt xt xt xt xt xt xt xt xt
a. state
b. orientation
c. methods
d. condition
Answer: a xt
Feedback: xt
The values of an object’s attributes are known as its state.
xt xt xt xt xt xt xt xt xt xt
9. An instance of a class is a(n) ____________.
xt xt xt xt xt xt xt
© 2022 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in
xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt
3
whole or in part.
xt xt xt xt xt
, Solution xtand xtAnswer xtGuide : Farrell, Java Programming 10e, [978-035-767-3423], Chapter 1: Creating Java Programs
xt xt xt xt xt xt xt xt xt xt
a. method
b. procedure
c. object
d. case
Answer: c xt
Feedback: xt
An instance of a class is an object.
xt xt xt xt xt xt xt xt
10. Java is architecturally ____________.
xt xt xt
a. neutral
b. oriented
c. specific
d. abstract
Answer: a xt
Feedback: xt
Java is architecturally neutral. xt xt xt
11. You must compile classes written in Java into ____________.
xt xt xt xt xt xt xt xt
a. bytecode
b. source code xt
c. Javadoc statements xt
d. object code xt
Answer: a xt
Feedback: xt
You must compile classes written in Java into bytecode. Source code is the high-level programming
xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt
statements. Javadoc statements are a type of comment used for documentation. Object code is the
xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt
low-level code produced when a compiler translates high-level code.
xt xt xt xt xt xt xt xt xt
12. All Java programming statements must end with a ____________.
xt xt xt xt xt xt xt xt
a. period
b. comma
c. closing parenthesis xt
© 2022 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in
xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt xt
4
whole or in part.
xt xt xt xt xt