Ch2. Data Types (zybooks) Flashcards

1
Q

what is a variable ?

A

variable= named item that is used to hold a value.

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

assignment statement?

A

assignment statement: is when a variable is assigned a value. this is done through a statement.

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

what is the format of an assignment? hint: statements and variables

A

the left side of a statement assignment must be a variable while the right side can be an expression. so…
x = (y+5) X is the variable while (y+5) is the expression.

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

what does

mean in programming ? how does it work

A

=
not equals but instead equals is used to assign a value from the right side to a left side variable.
so… x = 5 means x is assigned 5.

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

what is an incrementing variable and how does it work.

A

increment variable: when a variable is assigned itself plus one. for example: x = x + 1

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

variable declaration?

A

statement that declares a new variable -type and name.

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

what is an assignment statement?

A

assignment statement:

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

what is an assignment statement?

A

assignment statement:

assigns a variable (left side of = ) with the value to the right of =

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

expression?

A

expression : a number, variable name or calculation

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

what does ‘int’ stand for in code?

A

int = integer or a number.

it tells the memory to allocate a space for the following object. this object holds a number/integer

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

can int variables (integer) hold a negative value?

A

yes, integer values can hold a negative value.

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

what is a reserve word or keyword?

A

reserve word/ keyword: a word that is part of the language (int, sort, double,) these words can not be used as an identifier.

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

how is an _ identified when used in an identifier?

A

_ is treated as a letter and can be the 1st “letter” in the identifier name.

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

are spaces allowed in an identifier name?

A

no, but _ can be used instead.

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

can an expression be a literal?

A

expression: evaluates to a value. a literal is a specific value. YES, an expression can be a series of operators (+ - ) with literals or variables or it can just be one literal.

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

can two - - operators that are negative be next to one another?

A
    • Yes, seen as one a negative and a negation (negative of the following value)
17
Q

Precedence rules?

A

Precedence rules: how math symbols are used in a problem. order of operations..
() first,
-x negative numbers evaluated before multiplication
…use () often to make expressions clear and oreder of operations.

18
Q

compound operators?

A

when an operator is compounded for instance: numBalls = numBalls + 1
compounded into:
numBalls += 1

19
Q

are commands allowed in interger literals and if so how are they used?

A

no. integer intervals can not use commas.

20
Q

variable declared with ;double; means what?

A

is used to store a floating point number which is when a number has a decimal point within it

21
Q

what is a flouting point litera;?

A

floating point literal is a number that has a portion that is a fraction and is marked using decimal point with leading zero.

22
Q

how to do scientific notation for floating point literal?

A

the letter e is used to represent exponent. so 6.02 x 10^23 would be written as: 6.02e23

23
Q

what is the name of a variable that cannot change?

A

constant variable

if a variable is preceded with final variable then the variables value can not change after that statement.

24
Q

what is a good practicce with writing code when writing a constant variable? what format?

A

all uppercase letters and word have _ between them.

25
Q

Modulo operator?

A

Modulo operator = % when division occurs then this symbol tells what the remainer would be.
example: 23 % 10 = 3
see remainder of 3