Java Foundations 2 Flashcards

1
Q

What are the primitive data types in Java?

A

The primitive data types in Java are byte, short, int, long, float, double, char, and boolean.

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

True or False: Numeric literals can include underscores for better readability.

A

True

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

Fill in the blank: The _______ type is used to represent a single 16-bit Unicode character in Java.

A

char

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

Which of the following is NOT a primitive data type? (a) int (b) String (c) boolean

A

b) String

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

What is the purpose of using underscores in numeric literals?

A

Underscores in numeric literals improve readability by separating groups of digits.

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

Short Answer: What is the maximum value of a byte in Java?

A

The maximum value of a byte in Java is 127.

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

True or False: String is a primitive data type in Java.

A

False

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

Fill in the blank: The data type used to represent true/false values in Java is _______.

A

boolean

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

What is the syntax to declare a String variable in Java?

A

String variableName = “value”;

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

Multiple Choice: Which of the following correctly uses underscores in a numeric literal? (a) 1000 (b) 1000 (c) 1__000

A

(a) 1_000

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