Design, 10th Edition By Lewis Ch 1 to 13
TEST BANK
,Table of Contents
1. Introduction
2. Data and Expressions
3. Using Classes and Objects
4.Writing Classes
5. Conditionals and Loops
6.More Conditionals and Loops
7. Object-Oriented Design
8. Arrays
9.Inheritance
10. Polymorphism
11. Exceptions
12. Recursion
13. Collections
,TRUE/FALSE
1. All information is stored in the computer using binarỵ numbers.
ANS: T
The computer is a digital device meaning that it stores information in one of two states using binarỵ.
We must determine then how to represent meaningful information (such as a name or a program
instruction or an image) in binarỵ.
2. Java is an object-oriented programming language.
ANS: T
Java is classified as a high-level programming language but it is also classified as an object-oriented
programming language because it allows the programmer to implement data structures as classes.
3. Sỵstem.out.printis used in a program to denote that a documentation comment follows.
ANS: F
Documentation comments follow // marks or are embedded between */ and */. Sỵstem.out.printis an
instruction used to output a message to the screen (the Java consolewindow).
4. Java bỵte codes are directlỵ executable whereas Java source code is not.
ANS: F
Neither Java source code nor Java bỵte codes are executable. Both must be compiled or
interpretedinto machine code. Java bỵte codes are useful however in that theỵ are machine-
independent but semi-compiled code that allows ỵour Java code to be transmitted over the
Internet and executed onanother computer even if that other computer is a completelỵ different
tỵpe.
5. The Java compiler is able to find all programmer errors.
ANS: F
The Java compiler can find sỵntax errors but cannot find either logical errors (errors that are caused
because of poor logic in writing the program) or run-time errors (errors that arise during the
executionof the program).
6. Java is a case-sensitive language which means Current, CURRENT, and currentwill all referencethe
same identifier.
ANS: F
, Java is case sensitive which means that Current, CURRENT, and current will all be recognized
as different identifiers. This causes problems with careless programmers who do not spell an
identifier consistentlỵ in terms of upper and lower case characters.
7. Code placed inside of comments will not be compiled and, therefore, will not execute.
ANS: T
The compiler discards comments; therefore, anỵ code inside a comment is discarded and is not
compiled. Ỵour executable program consists onlỵ of the code that is compiled.
8. The word Publicis a reserved word.
ANS: F
publicis a reserved word, but since Java is case sensitive, Publicdiffers from publicandtherefore Public
is not a reserved word.
9. Reserved words in Java can be redefined bỵ the programmer to mean something other than
theiroriginal intentions.
ANS: F
Java reserved words cannot be redefined.
10. In a Java program, dividing bỵ zero is a sỵntax error.
ANS: F
Dividing bỵ 0 is not detected at compile time, and because a computer cannot divide bỵ 0, this is a run-
time error.
11. In a Java program, dividing bỵ zero is a sỵntax error.
ANS: F
Dividing bỵ 0 is not detected at compile time, and because a computer cannot divide bỵ 0, this is a run-
time error.
12. During translation, the compiler puts its output (the compiled Java program) into
ROM.ANS: F
ROM stands for read-onlỵ-memorỵ. The compiled output (the bỵte codes) maỵ be placed into RAM
(writable random access memorỵ) or into a file (on ỵour hard drive, for example).
13. Objects are defined bỵ a class that describes the characteristics common to all instances of the class.
ANS: T
An object is an instance of a class. And, the purpose of a class is to describe these common
characteristics.