Primitives Flashcards

1
Q

primitive type: byte

bits?
range?
default value?
representations?

A

8 bits

-128 to 127

0

Representation: Binary (0b1001), Octal (072), Decimal (1234), Hex (0x4F)

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

primitive type: short

bits?
range?
default value?
representations?

A

16 bits

-32768 to 32768

0

Representation: Binary (0b1001), Octal (072), Decimal (1234), Hex (0x4F)

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

primitive type: int

bits?
range?
default value?
representations?

A

32 bits

-2147483648 to 2147483648

0

Representation: Binary (0b1001), Octal (072), Decimal (1234), Hex (0x4F)

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

primitive type: long

bits?
range?
default value?
representations?

A

64 bits

-92233720368547000 to 92233720368547000

0 or 0L

Representation: Binary (0b1001), Octal (072), Decimal (1234), Hex (0x4F)

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

primitive type: float

bits?
range?
default value?
representations?

A

32 bits

  1. 4E-45 to 3.4028235E+38
  2. 0F

Representation: Normal (123.4), Exponential (1.234E2)

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

primitive type: double

bits?
range?
default value?
representations?

A

64 bits

  1. 9E-324 to 1.7976931348623157E+308
  2. 0

Representation: Normal (123.4), Exponential (1.234E2)

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

primitive type: char

bits?
range?
default value?
representations?

A

16 bits

0 to 65535 (unicode set)

\u0000

Character (‘A’), ASCII (‘\101’), Unicode (‘\u0041’), Escape (\t, \b, \n, \r, \f, ', ", \)

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

What primitive type is expected when performing arithmetic on bytes, shorts, or chars?

A

int

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

When performing arithmetic on primitives and all participants are bigger than an int, what primitive data type will the result be?

A

The largest participant in the arithmetic expression.

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

What types can work with a switch statement?

A

byte, short, int, char, String, enum

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