• Home
  • Textbooks
  • Introduction to Programming with Java: A Problem Solving Approach
  • Java Basics

Introduction to Programming with Java: A Problem Solving Approach

John S. Dean, Raymond H. Dean

Chapter 3

Java Basics - all with Video Answers

Educators


Chapter Questions

03:07

Problem 1

What does this chapter's Dream.java program do?

SS
Sarvesh Somasundaram
Numerade Educator
02:09

Problem 2

What are the filename extensions for Java source code and bytecode, respectively?

Vishal Sharma
Vishal Sharma
Numerade Educator
01:38

Problem 3

Why does source code have comments?

Adam Conner
Adam Conner
Numerade Educator
01:48

Problem 4

For a file with a public class, the program's filename must match the program's class name except that the filename has a $\cdot$ java extension added to it. $(\mathrm{T} / \mathrm{F})$

Foster Wisusik
Foster Wisusik
Numerade Educator
01:13

Problem 5

Standard coding conventions dictate that class names start with a lowercase first letter. (T / F)

Ernest Castorena
Ernest Castorena
Numerade Educator
06:21

Problem 6

In Java, the case of a character does matter. (T / F)

Anthony Ramos
Anthony Ramos
Numerade Educator
00:41

Problem 7

A program's start-up method, main, should be in a class that is public. (T / F)

Ernest Castorena
Ernest Castorena
Numerade Educator
00:41

Problem 8

The main method itself must be public. (T / F)

Ernest Castorena
Ernest Castorena
Numerade Educator
01:30

Problem 9

From your memory alone (don't look for the answer in the book), write the main method heading.

Anas Venkitta
Anas Venkitta
Numerade Educator
00:39

Problem 10

Identify two types of groupings that must be enclosed in braces.

Cory Kuzinski
Cory Kuzinski
Numerade Educator
01:47

Problem 11

From your memory alone (don't look for the answer in the book), write the statement that tells the computer to display this string of text: Here is an example

Anas Venkitta
Anas Venkitta
Numerade Educator
00:30

Problem 12

List all of the types of characters that may be used to form an identifier.

Kyler Gray
Kyler Gray
Numerade Educator
00:53

Problem 13

List all of the types of characters that may be used as the first character of an identifier.

Ernest Castorena
Ernest Castorena
Numerade Educator
01:40

Problem 14

You should abbreviate variable names by omitting vowels, in order to save space. (T / F)

Meghan Mulcahy
Meghan Mulcahy
Numerade Educator
01:56

Problem 15

Why is it good practice to use a separate line to declare each separate variable?

Adam Conner
Adam Conner
Numerade Educator
00:49

Problem 16

There must be a semicolon after every assignment statement. (T / F)

Ernest Castorena
Ernest Castorena
Numerade Educator
01:06

Problem 17

Initialization "kills two birds with one stone". What are the "two birds"?

Evan Sun
Evan Sun
Numerade Educator
03:06

Problem 18

The most appropriate type to use for financial accounting is ___________

Jennifer Stoner
Jennifer Stoner
Numerade Educator
00:23

Problem 19

For each statement, specify true or false:
a) 1234.5 is a floating-point number. (T / F)
b) 1234 is a floating-point number. (T / F)
c) $1234 .$ is a floating-point number. (T / F)

Amy Jiang
Amy Jiang
Numerade Educator
03:18

Problem 20

If you try to assign an int value into a double variable, the computer automatically makes the conversion without complaining, but if you try to assign a double value into an int variable, the compiler generates an error. Why?

Samriddhi Singh
Samriddhi Singh
Numerade Educator
01:42

Problem 21

For each statement, specify true or false:
a) 0.1234 is a float. (T / F)
b) $0.1234 \mathrm{f}$ is a float. (T / F)
c) 0.1234 is a double. (T / F)
d) 1234.0 is a double. (T / F)

Nick Johnson
Nick Johnson
Numerade Educator
00:39

Problem 22

What modifier specifies that a variable's value is fixed/constant?

Ernest Castorena
Ernest Castorena
Numerade Educator
01:30

Problem 23

What is the remainder operator?

AG
Ankit Gupta
Numerade Educator
01:04

Problem 24

Write the following mathcmatical cxpressions as legal Java cxpressions:
a. $\frac{3 x-1}{x^{2}}$
b. $\frac{1}{2}+\frac{1}{x y}$

Heather Zimmers
Heather Zimmers
Numerade Educator
00:31

Problem 25

Assume this:
$\operatorname{int} m=3, n=2$
double $x=7.5$
Evaluate the following expressions:
$\begin{array}{llllll}\text { a) } & (7-n) & \text { ? } & 2 & \text { ? } & 7.5 & \text { 9 }\end{array}$
b) $(4+n / m) / 6.0 * x$

Liuxi Sun
Liuxi Sun
Numerade Educator
01:13

Problem 26

Write the shortest Java statement that increments count by one.

SS
Sarvesh Somasundaram
Numerade Educator
01:13

Problem 26

Write the shortest Java statement that increments count by one.

SS
Sarvesh Somasundaram
Numerade Educator
03:31

Problem 27

Write the shortest Java statement that decrements count by 3

SS
Sarvesh Somasundaram
Numerade Educator
01:13

Problem 28

Write the shortest Java statement that multiplics number by (number - 1 ) and leaves the product in number.

SS
Sarvesh Somasundaram
Numerade Educator
01:17

Problem 29

What does it mean if a variable contains garbage?

Adam Conner
Adam Conner
Numerade Educator
00:29

Problem 30

In a trace listing, what are line numbers for?

Brandon Fox
Brandon Fox
Numerade Educator
02:45

Problem 31

Write a Java statement that assigns the double variable, my Double, to the int variable, myInteger.

SS
Sarvesh Somasundaram
Numerade Educator
02:34

Problem 32

What's wrong with the following initialization? char letter = "y",

Ernest Castorena
Ernest Castorena
Numerade Educator
03:23

Problem 33

If we try to put a quotation mark (") somewhere inside a string literal to be printed, the computer interprets the quotation mark as the cnd of the string literal. How can we overcome this problem and force the computer to recognize the quotation mark as something we want to print?

SS
Sarvesh Somasundaram
Numerade Educator
01:45

Problem 34

When describing the location of a file or directory, computers use directory paths. In Windows environments, use the backslash character ( ) to separate directories and files within a directory path. If you need to print a directory path within a Java program, how should you write the backslash character?

Foster Wisusik
Foster Wisusik
Numerade Educator
00:29

Problem 35

The type name for a primitive type is not capitalized, but the type name for a reference type is usually capitalized. (T / F)

Ernest Castorena
Ernest Castorena
Numerade Educator
View

Problem 36

List the primitive types this chapter describes, in the following categories:
a) Integer numbers.
b) Floating point numbers.
c) Individual text characters and special symbols.

Nicole Hoffman
Nicole Hoffman
Numerade Educator
01:43

Problem 37

What two operators perform string concatenation, and what's the difference between the operators?

Linh Vu
Linh Vu
Numerade Educator
01:45

Problem 38

What method can be used to retrieve a character at a specified position within a string?

Florencia Cuzmar
Florencia Cuzmar
Numerade Educator
01:45

Problem 39

What two methods can be used to compare strings for equality?

Florencia Cuzmar
Florencia Cuzmar
Numerade Educator
01:26

Problem 40

What is whitespace?

Ameer Said
Ameer Said
Numerade Educator
02:45

Problem 41

Write the statement that you must put before any other code to tell the compiler that you will be using the Scanner class.

SS
Sarvesh Somasundaram
Numerade Educator
00:55

Problem 42

Write the statement that creates a connection between your program and the computer's keyboard.

Trent Speier
Trent Speier
Numerade Educator
03:06

Problem 43

Write a statement that inputs a line of text from the keyboard and puts it into a variable named line.

Foster Wisusik
Foster Wisusik
Numerade Educator
05:58

Problem 44

Write a statement that inputs a double number from the keyboard and puts it into a variable named number.

Darren Wilson
Darren Wilson
Numerade Educator