COP2253 Zybooks Chapter Two Flashcards

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___?

A

counted

25
Q

floating-point variables are typically used for values that are ___?

A

measured

26
Q

Dividing a non-zero floating-point number by zero results in:

A

infinity or -infinity

27
Q

NaN indicates:

A

(not a number) an unrepresentable or undefined value

28
Q

scientific notation

A

written as e preceding the power-of-10 exponent, as in 6.02e33

29
Q

constant variable (or final variable)

A

an initialized variable whose value cannot be changed, usually named in uppercase and separated by underscores. variable declaration is preceded with keyword final

30
Q

method

A

a list of statements executed by invoking the method’s name (via method call)

31
Q

arguments

A

method input values, appear within (), separated by commas

32
Q

modulo operator

A

%, evaluates the remainder of the division of two integer operands

33
Q

type conversion

A

a conversion of one data type to another

34
Q

implicit conversion

A

automatic type conversion

35
Q

type cast (type)

A

explicitly converts a value of one type to another type (ex. (double)myIntVar)

36
Q

variable char type

A

stores a single character

37
Q

character literal

A

character surrounded with single quotes, as in ‘k’

38
Q

What statement reads a character from input?

A

scnr.next().charAt(0);

39
Q

string

A

sequence of characters

40
Q

string literal

A

surrounds a character sequence with double quotes

41
Q

object

A

consists of some internal data items plus operations that can be performed on that data

42
Q

scnr.next()

A

reads a string from input until reaching a whitespace

43
Q

What statement reads all of the text on the current input line?

A

scnr.nextLine()

44
Q

overflow

A

occurs when the value being assigned to a variable is greater than the maximum value the variable can store

45
Q

numeric data type long

A

used for integers expected to exceed about 2 billion

46
Q

Random class

A

provides methods that return a random integer

47
Q

What statement imports the Random class?

A

import java.util.Random;

48
Q

API

A

application programming interface

49
Q

module

A

a group of related packages

50
Q

package

A

a group of related classes

51
Q

debugging (or troubleshooting)

A

the process of determining and fixing the cause of a problem in a program

52
Q

output formatting

A

adjusting the way that a program’s output appears

53
Q

format specifiers

A

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