COP2253 Zybooks Chapter Two Flashcards

(53 cards)

1
Q

variable

A

a named item used to hold a value

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

assignment

A

assigns a variable with a value

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

an assignments left side must be a

A

variable

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

= symbol is

A

an assignment of a left-side variable with a right-side value (NOT equality as in mathematics)

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

incrementing

A

increasing a variables value by 1

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

variable declaration

A

a statement that declares a variable, specifying the variable’s name and type

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

assignment statement

A

a statement that assigns the variable on the left-side of the = with the current value of the right-side expression

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

expression

A

a combination of items, like variables, literals, operators, and parentheses, that evaluates to a value

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

an integer appearing in an expression is known as an

A

integer literal

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

identifier

A

a case-sensitive name created by a programmer for an item like a variable or method

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

reserved word (or keyword)

A

a word that is part of the language that cannot be used as an identifier

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

camel case

A

abuts multiple words, capitalizing each word except the first

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

literal

A

a specific value in code

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

operator

A

a symbol that performs a built-in calculation (like +-*/)

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

when an expression evaluates to a value it

A

replaces the expression

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

precedence rules

A

in order:

unary -
*/%
+-
left-to-right
~~~

```

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

unary minus -

A

minus used as a negative

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

compound variables

A

shorthand way to update a variable (ex. +=)

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

Should you include commas in an integer literal?

A

NO

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

floating-point number

A

a real number containing a decimal point that can appear anywhere (or “float”) in the number

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

double variable

A

stores a floating-point number

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

floating-point literal

A

a number with a fractional part, even if the fraction is 0 as in 1.0

23
Q

What statement reads a floating-point value from input?

A

scnr.nextDouble();

24
Q

Integer variables are typically used for values that are___?

25
floating-point variables are typically used for values that are ___?
measured
26
Dividing a non-zero floating-point number by zero results in:
infinity or -infinity
27
NaN indicates:
(not a number) an unrepresentable or undefined value
28
scientific notation
written as e preceding the power-of-10 exponent, as in 6.02e33
29
constant variable (or final variable)
an initialized variable whose value cannot be changed, usually named in uppercase and separated by underscores. variable declaration is preceded with keyword final
30
method
a list of statements executed by invoking the method's name (via method call)
31
arguments
method input values, appear within (), separated by commas
32
modulo operator
%, evaluates the remainder of the division of two integer operands
33
type conversion
a conversion of one data type to another
34
implicit conversion
automatic type conversion
35
type cast (type)
explicitly converts a value of one type to another type (ex. (double)myIntVar)
36
variable char type
stores a single character
37
character literal
character surrounded with single quotes, as in 'k'
38
What statement reads a character from input?
scnr.next().charAt(0);
39
string
sequence of characters
40
string literal
surrounds a character sequence with double quotes
41
object
consists of some internal data items plus operations that can be performed on that data
42
scnr.next()
reads a string from input until reaching a whitespace
43
What statement reads all of the text on the current input line?
scnr.nextLine()
44
overflow
occurs when the value being assigned to a variable is greater than the maximum value the variable can store
45
numeric data type long
used for integers expected to exceed about 2 billion
46
Random class
provides methods that return a random integer
47
What statement imports the Random class?
import java.util.Random;
48
API
application programming interface
49
module
a group of related packages
50
package
a group of related classes
51
debugging (or troubleshooting)
the process of determining and fixing the cause of a problem in a program
52
output formatting
adjusting the way that a program's output appears
53
format specifiers
specifies the type of value to print in it's place, begins with the % character followed by another character that indicates the value type to be printed