Chapter 2.2 : Variables and the Primitive Types Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

According to the syntax rules of java, a name is a sequence of _______.

A

characters

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

Identifiers dont allow _______.

A

spaces

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

What are the names called in Java that cannot be used by programmers for any other purposes?

A

reserved names

Ex. class, public, static, if, else, while, etc

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

What character set is used in Java?

A

Unicode

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

What are compound names?

A

several ordinary names separated by periods which is a path to an item through one or more levels of containment

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

Names are used to refer to data instead of _______.

A

numbers

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

What is a variable?

A

A name that refers to data stored in memory

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

What is an assignment statement?

A

the only way to get data into a variable.

Ex. variable=expression;

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

How many types of data can one variable hold?

A

One

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

What are the 8 primitive types of data in Java?

A
  1. byte
  2. short
  3. int
  4. long
  5. float
  6. double
  7. char
  8. boolean
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What two logical values does a boolean hold?

A

True or False

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

What does a char variable hold?

A

a single character from Unicode character set

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

What do the float and double types of variables hold?

A

real numbers such as 3.6 and -145.99

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

Any data value stored in the computer’s memory must be represented as a _______.

A

binary number

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

A single 0 or 1 is referred to as a_____?

A

bit

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

What is a byte?

A

a string of 8 bits

17
Q

What range of numbers can a byte hold?

A

-128 to 127

18
Q

When a character is typed into a program it should be surrounded by _______.

A

single quotes

19
Q

What is a string?

A

A sequence of characters

20
Q

What do you have to do to a variable in a program before you can use it?

A

Declare it

21
Q

What is a variable declaration statement?

A

It is used to declare one or more variables and to give them names

22
Q

What are variables declared within a subroutine called?

A

Local variables

23
Q

What does a paramater do for a subroutine?

A

It provides it with the information it needs to perform its task