1/61
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
What is a constant in programming?
A value that cannot be changed while a program is running.
What is a variable?
A named memory location that can store a value.
What does a data type describe?
The type of data that can be stored, how much memory it uses, and what operations can be performed on it.
What is a primitive data type?
A simple, uncomplicated data type.
What is a reference data type?
A more complex data type that holds memory addresses.
What primitive data type stores a byte-length integer?
byte
What primitive data type stores a short integer?
short
What primitive data type is most commonly used for whole numbers?
int
What primitive data type stores long integers?
long
What primitive data type stores single-precision floating-point values?
float
What primitive data type stores double-precision floating-point values?
double
What primitive data type stores a single character?
char
What primitive data type stores true or false values?
boolean
What is a variable declaration?
A statement that reserves a named memory location.
What four components can be included in a variable declaration?
Data type, identifier (variable name), optional assignment/value, and a semicolon.
What is an identifier?
The name of a variable.
What is camel casing?
A naming style that starts with a lowercase letter and capitalizes subsequent words.
Give an example of camel casing.
firstName
What is the assignment operator?
The equals sign =.
How does the assignment operator work?
The value on the right is assigned to the memory location on the left.
What is initialization?
Assigning a value when a variable is declared.
What is assignment (after declaration)?
Assigning a value to a variable later in the program.
How many times can a variable be declared in a method?
Once
How many times can a variable be assigned a new value?
Any number of times.
What is an uninitialized variable?
A variable declared without being assigned a value.
What keyword is used to declare a named constant in Java?
final
How many times can a named constant be assigned a value?
Only once
What is a blank final constant?
A constant declared without an initial value.
When must a constant be assigned a value?
Before it is used.
What naming convention is used for named constants?
All uppercase letters with underscores between words.
What is the range of a byte?
–128 to 127
How many bytes does a byte use?
1 byte
What is the range of a short?
–32,768 to 32,767
How many bytes does a short use?
2 bytes
What is the range of an int?
–2,147,483,648 to 2,147,483,647
How many bytes does an int use?
4 bytes
What is the range of a long?
–9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
How many bytes does a long use?
8 bytes
How many significant digits does a float hold?
About 6–7 digits.
How many significant digits does a double hold?
About 13–15 digits.
Which uses more memory: float or double?
Double.
What is the char data type used for?
Storing a single character.
How is a char written in Java?
Using single quotes (e.g., 'M').
What is a String in Java?
A built-in class used to store and manipulate character strings.
What does \b do?
Moves the cursor one space to the left (backspace).
What does \t do?
Moves the cursor to the next tab stop.
What does \n do?
Moves the cursor to the beginning of the next line (newline).
What does \r do?
Moves the cursor to the beginning of the current line.
What escape sequence displays a double quote?
\"
What escape sequence displays a single quote?
\'
What escape sequence displays a backslash?
\\
What does InputDialog do?
Prompts the user for text input.
What does ConfirmDialog do?
Asks a question with Yes, No, and Cancel buttons.
What is type conversion?
Converting one data type to another.
What is a unifying type?
The type all operands are converted to so they are compatible.
What is implicit conversion?
Automatic type conversion performed by Java.
Which type has the highest priority in implicit conversion?
double
Which type has the lowest priority in implicit conversion?
int (byte and short convert to int)
What happens to byte and short in expressions?
They are automatically converted to int.
What is type casting?
Forcing a value of one data type to be used as another.
Why is type casting used?
To override automatic type conversion.
How is a cast operator written?
By placing the desired type in parentheses, e.g. (int)