Chapter 2 Flashcards

1
Q

in a program are used to store data such as numbers and letters. They can be thought of as containers of a sort. The number, letter, or other data

A

Variabels

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

To know the name of the variable, how much computer memory to reserve for the variable, and how the data item in the variable is to be coded as strings of 0s and 1s. You give this information in

A

variable declaration

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The variable can hold whole numbers, such as 42, −99, 0, and 2001. A whole number is called

A

Integer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a data type for objects of a class called?

A

class type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How many primitive type do we have ?

A

8

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which Primitive Type has the range of -128 to 127

A

byte

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which Primitive Type has the range of -32,768 to 32,767 ?

A

short

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which Primitive Type has the range of -2,147,483,648 to 2,147,483,647

A

int

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which Primitive Type has the range of -9,223,372,036,8547,75,808 to 9,223,372,036,854,775,807

A

Long

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What kind of value is char?

A

Single character (Unicode)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What kind of value is float?

A

floating-point

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How much memory does boolean use?

A

1 bit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which Primitive Type has the range of ±3.40282347 × 10 +38 to ±1.40239846 × 10 −45

A

Float

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which Primitive Type has the range of ±1.79769313486231570 × 10 +308 to ±4.94065645841246544 × 10 −324

A

double

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which Primitive Type has the range of 0 to 65,535

A

char

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How many floating point do we have?

A

2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

A number having a fractional part—such as the numbers 9.99, 3.14159, −5.63, and 5.0—is called

A

floating-point number

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

As with integer types, the differences between float and double involve the range of their values and their storage requirements. If you cannot decide between the types float and double, use

A

double

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Are these legal identifier? inputStream, YourClass, CarWash, hotCar, theTimeOfDay

A

yes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

We will always follow the convention that the names of classes start with

A

Upper case letter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

the names of variables and methods start with

A

lower case letter

22
Q

Are these legal identifier prenhall.com, go-team, Five*, 7eleven ?

23
Q

What is wrong with this identifier prenhall.com ?

A

It has a dot in it

24
Q

What is wrong with this identifier go-team ?

A

It has a hyphen in it

25
What is wrong with this identifier Five* ?
it has an asterisk in it
26
What is wrong with this identifier 7eleven ?
it starts with a digit
27
Some words in a Java program, such as the primitive types and the word if, are called
keywords or reserved words
28
All Java keywords are entirely in what case?
lower case
29
main and println are not keywords, then what are they?
predefined meaning
30
What does predefined meaning mean?
you can change their meaning, but it is a bad idea to do so
31
The most straightforward way to give a variable a value or to change its value is to use
assignment statement
32
What does the " = " equal sign called?
assignment operator
33
The computer evaluates what side of the " = " sign in an expression, right or left?
right
34
A variable that has been declared, but that has not yet been given a value by an assignment statement called
uninitialized
35
If the variable is a variable of a class type, it literally has no value. If the variable has a primitive type, it likely has some
default value
36
This line must appear before the first statement that takes input from the keyboard. That statement in our example is
Scanner keyboard = new Scanner(System.in);
37
What does this line do keyboard.nextInt() ?
reads one int value from the keyboard.
38
System is a ____ that is part of the Java language, and out is ___
class, object
39
What does this called 865000000.0. in a Floating-point?
scientific notation
40
what is it public static final double PI = 3.14159; called?
Constants
41
You can assign a value of any type on the following list to a variable of any type that appears further down on the list called: byte → short → int → long → float → double
Assignment Compatibilities
42
a _____ changes the data type of a value from its normal type to some other type.
type casting
43
What are the 5 Arithmetic Operators?
+ - / * and %
44
A __ has two operands, such as the operators + and * in
binary operator
45
A string can even have zero characters. Such a string is called
empty string and is written as a pair of adjacent double quotes, like so:" ".
46
You can connect or join or paste two strings together to obtain a larger string using +, called:
concatenation
47
Any characters that are not visible when displayed are collectively known as
whitespace
48
What is this \"Java\" called?
Escape Characters
49
\" Double quote. \' Single quote. \\ Backslash. \n New line. Go to the beginning of the next line. \r Carriage return. Go to the beginning of the current line. \t Tab. Add whitespace up to the next tab stop. are example of ?
Escape Characters
50
A method works like the print method except it allows you to add formatting instructions that specify things such as the number of digits to include after a decimal point.
printf
51
This is called /** ?
javadoc
52
This is called /* */ ?
long comment