Level 12 Level 14
Level 13

[Quiz] Data Types


40 words 0 ignored

Ready to learn       Ready to review

Ignore words

Check the boxes below to ignore/unignore words, then click save at the bottom. Ignored words will never appear in any learning session.

All None

Ignore?
What are the eight Java primitive data types?
char , byte, short, int, long, float, double, and boolean.
True
True or false: boolean is a primitive data type.
Boolean, numeric, and character data types.
Categorize the primitive data types into three types.
What values can the boolean data type accept?
The boolean data type is used to store data with only two possible values. These two possible values may be thought of as…
What is a literal value?
A literal is a fixed value that doesn't need further calculations to be assigned to any variable. Numeric data types:
integers or decimal numbers.
What types of values can numeric values can be stored as?
What data types can store integer numbers?
byte, short, int, and long can be used to store integers.
What are the bit sizes of the types used to store integer numbers?
The byte, short, int, and long data types use 8, 16, 32, and 64 bits, respectively, to store their values.
What data types are used to store decimal numbers?
float and double can be used to store decimal numbers.
What are the bit sizes of the data types used to store decimal numbers?
The float and double data types use 32 and 64 bits, respectively, to store their values.
int.
What is the default type for integers—that is, nondecimal numbers?
add the suffix L or l to the literal value
What suffix is used to designate an integer literal value as a long value?
What are the four numeric formats?
binary, octal, decimal, and hexadecimal number formats.
What are the prefixes for the four numeric formats?
The literal values in the octal number system start with the prefix 0. For example, 0413 in the octal number system is 267 in the decimal number system. The literal values in the hexadecimal nu…
Starting with Java 7, a new format was made available for numeric literal variables. Describe it.
You can use underscores within the Java literal values to make them more readable. 0B1_0000_10_11, 0_413, and 0x10_B are valid binary, octal, and hexadecimal literal values.
double.
What is the default type of a decimal number?
add the suffix F or f to the literal value.
How to designate a decimal literal value as a float value?
How to designate a decimal literal value as a double value?
The suffixes D and d can be used to mark a literal value as a double value.
How many bits does the char data type have?
A char data type can store a single 16-bit Unicode character; that is, it can store characters from virtually all the world's existing scripts and languages.
What are the range of unicode values for a char?
You can use values from (or 0) to a maximum of \uffff (or 65,535 inclusive) to store a char .
True or false: Unicode values are defined in the hexadecimal number system.
True. Internally, the char data type is stored as an unsigned integer value (only positive integers).
True.
In Java, Exceptions are objects. True or false?
What are the rules for a valid variable identifier:
A valid identifier starts with a letter (a-z, upper- or lowercase), a currency sign, or an underscore. There is no limit to its length. A valid identifier can contain digits, but not in the star…
++ and --.
What are the unary operators?
Discuss why the logical operators && and || are also called short-circuit operators.
If these operators can determine the output of the expression with the evaluation of the first operand, they don't evaluate the second operand. The && operator returns true only if both of the operands…
Dereferenced
In what phase is an object when it goes out of scope and has no remaining live pointers?
Which three locations are invalid when placing underscores in a numeric literal?
Beginning or end of a number, contiguous to decimal points, or contiguous to D, F, and L suffixes.
Is 314_15.23_D a valid numerical literal in Java 7?
No. The underscore is contiguous to the D suffix.
Finalized
In what phase is an object when the garbage collector is about to remove it from memory?
16 + the size of the initializing String
What is the capacity of a StringBuilder if a String is specified in its constructor?
append
Which StringBuilder method adds to the end of a string literal?
replace
Which StringBuilder method overwrites characters within a string literal?
True or False: the declaration is valid, float myFloat = 3.15
False. The default literal type for decimal values is double. Assigning a double to a float variable would result in a loss of precision. The declaration would result in a compiler error. The declaration c…
}
Define a class called MyClass that extends MySuperclass and implements Yourinterface.
char ch = 10;
Yes, and int literal will fit into a char.
double d = 256;
// compile error, literal out of range
byte, char, short, int, enum, and String.
What types can be used in a switch statement?
65535
What is the max int a char can hold?
Will the primitive wrapper classes accept primitives in their overridden equals method?
Yes. An Integer object and accept a primitive int as an argument to its equals method.
Yes
Does the executable run faster with a compiler?