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