0% found this document useful (0 votes)
50 views20 pages

51799

The document provides links to download test banks and solution manuals for various editions of Java Programming and other subjects. It includes specific ISBN numbers and direct URLs for accessing these resources. Additionally, it contains sample questions and answers related to Java programming concepts.

Uploaded by

saakavirto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views20 pages

51799

The document provides links to download test banks and solution manuals for various editions of Java Programming and other subjects. It includes specific ISBN numbers and direct URLs for accessing these resources. Additionally, it contains sample questions and answers related to Java programming concepts.

Uploaded by

saakavirto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Visit https://testbankmall.

com to download the full version and


explore more testbank or solution manual

Test Bank for Java Programming, 9th Edition, Joyce


Farrell, ISBN-10: 1337397075, ISBN-13: 9781337397070

_____ Click the link below to download _____


https://testbankmall.com/product/test-bank-for-java-
programming-9th-edition-joyce-farrell-
isbn-10-1337397075-isbn-13-9781337397070/

Explore and download more testbank at testbankmall


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Java Programming 9th Edition Joyce Farrell Solutions


Manual

https://testbankmall.com/product/java-programming-9th-edition-joyce-
farrell-solutions-manual/

testbankmall.com

Java Programming 8th Edition Joyce Farrell Solutions


Manual

https://testbankmall.com/product/java-programming-8th-edition-joyce-
farrell-solutions-manual/

testbankmall.com

Test Bank for Chemistry, 9th Edition, Zumdahl, ISBN-10:


1133611095, ISBN-13: 9781133611097

https://testbankmall.com/product/test-bank-for-chemistry-9th-edition-
zumdahl-isbn-10-1133611095-isbn-13-9781133611097/

testbankmall.com

Test Bank For Brain & Behavior: An Introduction to


Biological Psychology 3rd Edition by Bob L. Garrett

https://testbankmall.com/product/test-bank-for-brain-behavior-an-
introduction-to-biological-psychology-3rd-edition-by-bob-l-garrett/

testbankmall.com
Test Bank for Advertising and Promotion: An Integrated
Marketing Communications Perspective, 12th Edition, George
Belch Michael Belch
https://testbankmall.com/product/test-bank-for-advertising-and-
promotion-an-integrated-marketing-communications-perspective-12th-
edition-george-belch-michael-belch/
testbankmall.com

Test Bank for Child Development: A Cultural Approach, 3rd


Edition, Jeffery Jensen Arnett, Lene Arnett Jensen

https://testbankmall.com/product/test-bank-for-child-development-a-
cultural-approach-3rd-edition-jeffery-jensen-arnett-lene-arnett-
jensen/
testbankmall.com

Solution Manual for Financial Markets and Institutions,


8th Edition, Anthony Saunders, Marcia Cornett Otgo
Erhemjamts
https://testbankmall.com/product/solution-manual-for-financial-
markets-and-institutions-8th-edition-anthony-saunders-marcia-cornett-
otgo-erhemjamts/
testbankmall.com

Test Bank for Community Health Nursing: Advocacy for


Population Health, 5th Edition: Mary Jo Clark

https://testbankmall.com/product/test-bank-for-community-health-
nursing-advocacy-for-population-health-5th-edition-mary-jo-clark/

testbankmall.com

Test Bank for Biostatistics for the Biological and Health


Sciences Marc M. Triola, Mario F. Triola

https://testbankmall.com/product/test-bank-for-biostatistics-for-the-
biological-and-health-sciences-marc-m-triola-mario-f-triola/

testbankmall.com
Test Bank for Taxation for Decision Makers, 2019 Edition
9th Edition

https://testbankmall.com/product/test-bank-for-taxation-for-decision-
makers-2019-edition-9th-edition/

testbankmall.com
Name: Class: Date:

Chapter 01: Creating Your First Java Classes


ANSWER: True

8. A compiler ignores whitespace (that is, any combination of nonprinting characters) between words and lines.
a. True
b. False
ANSWER: True

9. Dots (or periods) in a Java statement are used to separate the names of the components that make up the statement.
a. True
b. False
ANSWER: True

10. Using the void keyword in the main() method header indicates that a value will be returned by the main()
method is called.
a. True
b. False
ANSWER: False

Multiple Choice

11. A program written in ____ is the most basic circuitry-level language.


a. Java b. machine language
c. BASIC d. C
ANSWER: b

12. Locating and repairing all syntax errors is part of the process of ____ a program.
a. interpreting b. compiling
c. debugging d. executing
ANSWER: c

13. ____ are also called modules, methods, functions, and subroutines. Java programmers most frequently use the term
“method.”
a. Procedures b. Calls
c. Classes d. Applications
ANSWER: a

14. ____ refers to the hiding of data and methods within an object.
a. Instance b. Inheritance
c. Passed d. Encapsulation
ANSWER: d

15. ____ describes the feature of languages that allows the same word to be interpreted correctly in different situations
based on the context.
a. Polymorphism b. Architecturally neutral
c. Source code d. Insulation
Copyright Cengage Learning. Powered by Cognero. Page 2
Name: Class: Date:

Chapter 01: Creating Your First Java Classes


ANSWER: a

16. Given the statement: System.out.println(“First Java application”);


out refers to ____.
a. the screen b. the standard output device
c. the printer d. the keyboard
ANSWER: b

17. ____ are pieces of information that are sent into, or passed to, a method, usually because the method requires the
information to perform its task or carry out its purpose.
a. Applets b. Methods
c. Arguments d. Objects
ANSWER: c

18. A(n) ____ defines the circumstances under which a class can be accessed and the other classes that have the right to
use a class.
a. identifier b. access specifier
c. parameter d. Pascal casing
ANSWER: b

19. In Java, the reserved keyword ____ means that a method is accessible and usable even though no objects of the class
exist.
a. active b. undefined
c. static d. void
ANSWER: c

20. Line comments start with ____.


a. a forward slash and an asterisk b. two forward slashes
c. a forward slash and two asterisks d. a percent sign
ANSWER: b

21. In a ____ environment, you can change directories using the cd command. For example, to change to a directory
named MyClasses, you type cd MyClasses and press Enter.
a. Windows b. Java
c. graphical d. DOS
ANSWER: d

22. After a successful compile, you can run the class file on any computer that has a ____.
a. Java language interpreter b. Web browser
c. text editor d. DOS
ANSWER: a

23. Java contains a class named ____ that allows you to produce dialog boxes.
a. JBox b. JOptionPane
c. JDialog d. JGUI
Copyright Cengage Learning. Powered by Cognero. Page 3
Name: Class: Date:

Chapter 01: Creating Your First Java Classes


ANSWER: b

24. Whenever a method requires multiple arguments, the arguments are always separated with ____.
a. commas b. periods
c. forward slashes d. brackets
ANSWER: a

25. If a compiler detects a violation of language rules, it refuses to translate the class to ____.
a. an application b. a logic error
c. machine code d. Java
ANSWER: c

26. ____ is the process the compiler uses to divide your source code into meaningful portions; the message means that the
compiler was in the process of analyzing the code when the end of the file was encountered prematurely.
a. Running b. Debugging
c. Compiling d. Parsing
ANSWER: d

27. A ____ is an error not detected until the program asks the computer to do something wrong, or even illegal, while
executing.
a. syntax error b. run-time error
c. package d. Java API
ANSWER: b

28. It is best to use the ____ available text editor when writing Java programs.
a. most complex b. simplest
c. best d. latest
ANSWER: b

29. It is a tradition among programmers that the first program you write in any language produces “____” as its output.
a. Hi, your name! b. Hello, world!
c. My first program! d. Hello, your name!
ANSWER: b

30. When you run a Java application using the ____ command, do not add the .class extension to the filename.
a. class b. static
c. java d. output
ANSWER: c

31. If you receive an error that states, “Exception in thread ‘main’ java.lang.NoClassDefFoundError,” when you try to
execute the application, you probably do not have your ____ set correctly.
a. class length b. class path
c. java d. object
ANSWER: b

Copyright Cengage Learning. Powered by Cognero. Page 4


Name: Class: Date:

Chapter 01: Creating Your First Java Classes


32. {
public static void main(String[] args)
{
System.out.println(“First Java application”);
}
}

Given the above code, which item identifies the access specifier?

a. public b. static
c. void d. First
ANSWER: a

33. public class First


{
public static void main(String[] args)
{
System.out.println(“First Java application”);
}
}

Given the above code, which item identifies the name of the class?
a. public b. static
c. void d. First
ANSWER: d

34. public class First


{
public static void main(String[] args)
{
System.out.println(“First Java application”);
}
}

Given the above code, which item identifies the method’s return type?
a. public b. static
c. void d. println
ANSWER: c

35. public class First


{
public static void main(String[] args)
{
System.out.println(“First Java application”);
}
}

Given the above code, which item identifies that the method will work without instantiating an object of the class?
a. public b. static
c. void d. println
Copyright Cengage Learning. Powered by Cognero. Page 5
Name: Class: Date:

Chapter 01: Creating Your First Java Classes


ANSWER: b

36. In programming, named computer memory locations are called ____because they hold values that might vary.
a. constants b. variables
c. strings d. addresses
ANSWER: b

37. ____ comments are a special case of block comments that are used to generate documentation.
a. Line comments b. Doc comments
c. JDoc d. Javadoc
ANSWER: d

38. You use an import statement when you want to access a built-in Java class that is contained in a group of classes
called a(n) ____.
a. JGroup b. JImport
c. package d. GUI
ANSWER: c

39. A(n) ____ error occurs when the syntax of the program is correct and the program compiles but produces incorrect
results when you execute it.
a. logic b. syntax
c. JVM d. class
ANSWER: a

40. The ____ is also called the Java class library; it contains information about how to use every prewritten Java class,
including lists of all the methods you can use with the classes.
a. Java package b. Java Interface
c. Java SDK d. Java API
ANSWER: d

41. A class named first is different from a class named FIRST because ____.
a. Java is case insensitive b. it is confusing to have two names that look the same
c. Java is case sensitive d. first and FIRST are different literal strings
ANSWER: c

42. Programmers use ____ to organize program code and make it easier to read.
a. literal strings b. whitespace
c. headings d. FAQs
ANSWER: b

43. What is the purpose of the argument "null" in the statement below:
JOptionPane.showMessageDialog(null, “Show my message”);
a. This argument is ignored by Java. b. The output message will be placed in the upper left
corner of the screen.

Copyright Cengage Learning. Powered by Cognero. Page 6


Name: Class: Date:

Chapter 01: Creating Your First Java Classes


c. The output message will be placed in the d. It instructs Java to display the message immediately.
middle of the screen.
ANSWER: c

44. Using the given code, which statement in the main() method body will produce the output “Hello to all!”.
public class Hello
{
public static void main(String[] args)
{
____
}
{
a. System.out(“Hello to all!”); b. System.println(“Hello to all!”);
c. println(“Hello to all!”); d. System.out.println(“Hello to all!”);
ANSWER: d

45. A(n) ____ is a GUI object resembling a window in which you can place messages you want to display.
a. JDK b. dialog box
c. variable d. argument
ANSWER: b

Matching

Match each term with the correct statement below.


a. literal string
b. high-level programming languages
c. dialog box
d. syntax
e. whitespace
f. compiler
g. attributes
h. Machine language
i. Java virtual machine (JVM)
j. debugging
k. javadoc
l. encapsulation
m. inheritance
n. polymorphism
o. method

46. Allow you to assign intuitive names to areas of computer memory


ANSWER: b

47. Repairing syntax errors


ANSWER: j

Copyright Cengage Learning. Powered by Cognero. Page 7


Name: Class: Date:

Chapter 01: Creating Your First Java Classes


48. Documentation comments
ANSWER: k

49. A low-level programming language


ANSWER: h

50. Self-contained block of code that carries out an action


ANSWER: o

51. Placing data and methods within an object


ANSWER: l

52. Series of characters that will appear in output exactly as entered


ANSWER: a

53. The same word can be used in different situations


ANSWER: n

54. A GUI object resembling a window in which you can place messages you want to display
ANSWER: c

55. The rules for the programming language


ANSWER: d

56. Translates an entire program before carrying out the statement


ANSWER: f

57. Hypothetical computer used to run a Java program


ANSWER: i

58. Creating classes that share from existing classes


ANSWER: m

59. Any combination of nonprinting characters


ANSWER: e

60. The characteristics that define an object


ANSWER: g

Subjective Short Answer

61. Why is creating a GUI environment for users a natural use for object orientation?
ANSWER: Creating a GUI environment for users also is a natural use for object orientation. It is easy to think of the
components a user manipulates on a computer screen, such as buttons and scroll bars, as similar to real-world
objects. Each GUI object contains data—for example, a button on a screen has a specific size and color. Each
object also contains behaviors—for example, each button can be clicked and reacts in a specific way when
clicked. Some people consider the term object-oriented programming to be synonymous with GUI
programming, but object-oriented programming means more.
Copyright Cengage Learning. Powered by Cognero. Page 8
Name: Class: Date:

Chapter 01: Creating Your First Java Classes

62. Describe the components (objects and classes) that are used in the statement System.out.println().
ANSWER: Within the statement System.out.println("First Java application");, the method to which
you are passing "First Java application" is named println(). The Java methods println() and
print() both produce output. With println(), after the output is displayed, the insertion point moves to
the following line so that subsequent output appears on a new line. With print(), however, the insertion
point does not advance to a new line, so subsequent output appears at the end of the current line.
Within the statement System.out.println("First Java application");, out is an object that
is a property of the System class that refers to the standard output device for a system, normally the monitor.
The out object itself is an instance of the PrintStream class, which contains several methods, including
println().
Within the statement System.out.println("First Java application");, System is a
class. Therefore, System defines attributes for System objects, just as the Dog class defines the attributes
for Dog objects. One of the System attributes is out. The dots (periods) in System.out.println() are
used to separate the names of the components in the statement.

63. When you define a Java class using an identifier, what are the requirements you need to know?
ANSWER: You can define a Java class using any name or identifier you need, as long as it meets the following
requirements:

• A Java identifier must begin with a letter of the English alphabet, a non-English letter (such as α or π),
an underscore, or a dollar sign. A class name cannot begin with a digit.
• A Java identifier can contain only letters, digits, underscores, or dollar signs.
• A Java identifier cannot be a reserved keyword, such as public or class.
• A Java identifier cannot be one of the following values: true, false, or null. These are not keywords
(they are primitive values), but they are reserved and cannot be used.

64. Regarding code layout, write the following Java code using a common alternate placement of the first curly brace:
public static void main(String[] args)
{
System.out.println("First Java application");
}
ANSWER: public static void main(String[] args) {
System.out.println("First Java application");
}

65. Why is it important for programmers to use program comments?


ANSWER: Programmers use comments to leave notes for themselves and for others who might read their programs in the
future. At the very least, your Java class files should include comments indicating the author, the date, and the
class name or function. The best practice dictates that you also include a brief comment to describe the
purpose of each method you create within a class.

66. What are some of the reasons the javac command might not be recognized?
ANSWER: You made a typo error when typing the command javac.
You misspelled the filename.
You are not within the correct subfolder or subdirectory on your command line.
Copyright Cengage Learning. Powered by Cognero. Page 9
Name: Class: Date:

Chapter 01: Creating Your First Java Classes


Java was not installed properly.

67. What happens after a programmer successfully compiles a Java program named “First.java”?
ANSWER: If you receive no error messages after compiling the code in a file named First.java, the application compiled
successfully. In that case, a file named First.class is created and saved in the same folder as the text file that
holds the source code. After a successful compile, you can execute the program (run the class file) on any
computer that has a Java language interpreter.

68. If you modify a class, what are the steps you must take to see your changes in the executing program?
ANSWER: 1. Save the file with the changes (using the same filename).
2. Recompile the class with the javac command.
3. Interpret the class bytecode and execute the class using the java command.

69. Provide examples of logic errors. How do programmers minimize logic errors in their code?
ANSWER: Examples of logic errors include multiplying two values when you meant to add, printing one copy of a report
when you meant to print five, or forgetting to produce a total at the end of a business report when a user
has requested one. Errors of this type must be detected by carefully examining the program output. It is the
responsibility of the program author to test programs and find any logic errors. Good programming practices
can help to minimize errors.

70. Explain the purpose of arguments and why it is necessary to pass arguments to a method.
ANSWER: Arguments are pieces of information that are sent to a method. The act of sending arguments to a method is
called passing arguments to the method. You pass methods to arguments so they know what information to
work with.

71. Briefly describe the elements of the main() method:


public static void main(String[] args)
{
Java code...
}
ANSWER:
In the method header public static void main(String[] args), the word public is an access
specifier, just as it is when you use it to define the First class.
In Java, the reserved keyword static means that a method is accessible and usable even though no objects
of the class exist.
The keyword void used in the main() method header indicates that the main() method does not return
any value when it is called.
The name of the method is main().
In the method header public static void main(String[] args), the contents between the
parentheses, String[] args, represent the type of argument that can be passed to the main() method.

72. Once an application is written and saved, the Java class must be compiled. Describe what two procedures must occur
in order to view the output of the application.
ANSWER:
1. You must compile the class you wrote (called the source code) into bytecode.
2. You must use the Java interpreter to translate the bytecode into executable statements.

Copyright Cengage Learning. Powered by Cognero. Page 10


Name: Class: Date:

Chapter 01: Creating Your First Java Classes


73. public class FindMyErrors
{
public static void main(String[] args)
{
System.out.println(“My application with errors)
}

Given the above code, identify three separate syntax errors.


ANSWER: There is a semicolon missing at the end of the println statement that will produce the output.
There is a missing curly brace. Curly braces must be open and closing pairs.
There are missing quotation marks in the println statement that will produce the output.

74. Write a line comment and block comment for the following line of code identifying the author, date, and purpose of
the method. In addition, explain the difference between comments that consist of a double-slash (//) and those that have a
starting and ending slash asterisk (/* .. */).
System.out.println(“Hello Students”);
ANSWER: Possible comments include:
// Written by <your name>
// Written on <date>
/* The println method will output “Hello Students” */
// - used for line comments
/* - used for block comments */

75. System.out.println(“First Java application”);

Given the above code, identify and describe the use of a literal string and the use of parentheses.
ANSWER: A literal string is a series of characters that will appear exactly as entered. Any literal string in Java is written
between double quotation marks. The string “First Java application” appears within parentheses because the
string is an argument to a method, and arguments to methods always appear within parentheses.

76. What are the differences between K & R style and Allman style? Which one is used in this textbook?
ANSWER: The indent style in which opening braces do not stand alone on separate lines, is known as the K & R style and
is named for Kernighan and Ritchie, who wrote the first book about the C programming language. The indent
style in which curly braces are aligned and each occupies its own line, is called the Allman style and is named
for Eric Allman, a programmer who popularized the style. The Allman style is used throughout this book.

Copyright Cengage Learning. Powered by Cognero. Page 11


Visit https://testbankmall.com
now to explore a rich
collection of testbank,
solution manual and enjoy
exciting offers!
Other documents randomly have
different content
1.F.6. INDEMNITY - You agree to indemnify and hold the
Foundation, the trademark owner, any agent or employee of the
Foundation, anyone providing copies of Project Gutenberg™
electronic works in accordance with this agreement, and any
volunteers associated with the production, promotion and distribution
of Project Gutenberg™ electronic works, harmless from all liability,
costs and expenses, including legal fees, that arise directly or
indirectly from any of the following which you do or cause to occur:
(a) distribution of this or any Project Gutenberg™ work, (b)
alteration, modification, or additions or deletions to any Project
Gutenberg™ work, and (c) any Defect you cause.

Section 2. Information about the Mission of


Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new computers.
It exists because of the efforts of hundreds of volunteers and
donations from people in all walks of life.

Volunteers and financial support to provide volunteers with the


assistance they need are critical to reaching Project Gutenberg™’s
goals and ensuring that the Project Gutenberg™ collection will
remain freely available for generations to come. In 2001, the Project
Gutenberg Literary Archive Foundation was created to provide a
secure and permanent future for Project Gutenberg™ and future
generations. To learn more about the Project Gutenberg Literary
Archive Foundation and how your efforts and donations can help,
see Sections 3 and 4 and the Foundation information page at
www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-profit
501(c)(3) educational corporation organized under the laws of the
state of Mississippi and granted tax exempt status by the Internal
Revenue Service. The Foundation’s EIN or federal tax identification
number is 64-6221541. Contributions to the Project Gutenberg
Literary Archive Foundation are tax deductible to the full extent
permitted by U.S. federal laws and your state’s laws.

The Foundation’s business office is located at 809 North 1500 West,


Salt Lake City, UT 84116, (801) 596-1887. Email contact links and up
to date contact information can be found at the Foundation’s website
and official page at www.gutenberg.org/contact

Section 4. Information about Donations to


the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission of
increasing the number of public domain and licensed works that can
be freely distributed in machine-readable form accessible by the
widest array of equipment including outdated equipment. Many small
donations ($1 to $5,000) are particularly important to maintaining tax
exempt status with the IRS.

The Foundation is committed to complying with the laws regulating


charities and charitable donations in all 50 states of the United
States. Compliance requirements are not uniform and it takes a
considerable effort, much paperwork and many fees to meet and
keep up with these requirements. We do not solicit donations in
locations where we have not received written confirmation of
compliance. To SEND DONATIONS or determine the status of
compliance for any particular state visit www.gutenberg.org/donate.

While we cannot and do not solicit contributions from states where


we have not met the solicitation requirements, we know of no
prohibition against accepting unsolicited donations from donors in
such states who approach us with offers to donate.

International donations are gratefully accepted, but we cannot make


any statements concerning tax treatment of donations received from
outside the United States. U.S. laws alone swamp our small staff.

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.

Section 5. General Information About Project


Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could be
freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose network of
volunteer support.

Project Gutenberg™ eBooks are often created from several printed


editions, all of which are confirmed as not protected by copyright in
the U.S. unless a copyright notice is included. Thus, we do not
necessarily keep eBooks in compliance with any particular paper
edition.

Most people start at our website which has the main PG search
facility: www.gutenberg.org.

This website includes information about Project Gutenberg™,


including how to make donations to the Project Gutenberg Literary
Archive Foundation, how to help produce our new eBooks, and how
to subscribe to our email newsletter to hear about new eBooks.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

testbankmall.com

You might also like