1/44
These flashcards cover key terms and definitions related to Java's data types, variable declaration, and initialization concepts.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
No
Is $10.5$ valid for variable declared as int crayons;?
int and boolean
Types that are considered primitive in Java.
The semicolon after the data type is incorrect.
Syntax error in the declaration: double; price;.
Two (true and false)
Number of distinct values a boolean variable can hold.
char
Data type used to store a single character value.
int num; num = 5;
Two-statement equivalent for int num = 5;.
initialized
What variable names must be before they are used in Java.
Numbers with fractional parts (decimals)
What a double data type stores.
$2.0$
The value held by variable y after executing int x = 7; double y = 2.0; x = 14;.
TRUE
True or False: A final variable can be assigned a value exactly once.
String
Data type required to store the literal text 'robins egg blue'.
Primitive
Is char considered a primitive or a reference data type in Java?
Primitive
Is boolean considered a primitive or a reference data type in Java?
Primitive
Is double considered a primitive or a reference data type in Java?
Primitive
Is int considered a primitive or a reference data type in Java?
Variable Declaration
The process of defining a new variable by specifying its type and name.
Variable Initialization
The process of assigning a starting value to a previously declared variable.
The previous value is overwritten.
What happens to a variable's existing value when reassigned.
int
Numeric data type to use for counts that cannot have fractions.
It is missing the mandatory data type declaration.
Why myInteger = 100; is improper for first-time variable use.
It is missing a variable name.
Reason char = 'a'; is improper syntax.
It is initialized to $20$ and cannot be reassigned.
Status of variable z after executing final int z; z = 20;.
FALSE
Reference data types do not hold numeric primitive values directly.
reference
Variable type that stores a memory address to point to an object.
String
The non-primitive type among int, double, boolean, String.
TRUE
If boolean z = false; is followed by z = true;, what does z hold?
initialize
The act created by double price; that does not yet assign a value.
Yes
Can the whole number $42$ be successfully stored in an int variable?
No
Is the String value '10.5' compatible with an int variable?
Primitive data types
Category characterized by holding values directly in memory.
Primitive
Type defined by the declaration int x = 7;.
char
Specific Java keyword used for single character primitive type.
A semicolon (;)
What follows a variable declaration like double price to be correct.
A compilation error occurs.
Consequences of attempting to print a local variable that is not initialized.
boolean
Data type best for representing a simple toggle state like On/Off.
Reference type
Is String a built-in Java keyword or a reference type?
Yes
Can a final variable be declared first and then initialized later?
$5$
Value of x after executing int x = 10; x = 5;.
To declare a variable that reserves memory for a decimal number.
The primary function of the instruction double price; in Java.
int x = 5;
The valid declaration and initialization in Java.
$12$
The only valid value for an int among $12$, $12.0$, or '12'.
location
What reference types store about an object's memory.
TRUE
Is it possible to declare a variable in Java without giving it a value?
Primitive types
Category including int, double, and boolean.
A memory address
Type of data stored in the memory location of a reference variable.