2. Variables / Assignments Flashcards

1
Q

A(n) ____ is a named item, such as x or numPeople, used to hold a value.

A

variable

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

A(n) ____ assigns a variable with a value, such as x = 5.

A

assignment statement

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

The equals sign (=) is known as a(n) ____ operator. It is NOT equality as in mathematics.

A

assignment

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

A variable declaration declares a new variable, specifying the variable’s ____ and ____.

A

name, type

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

A variable of type ____ can hold whole number values, like 1, 999, 0, or -25 (but not 3.5 or 0.001).

A

integer

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

A name created by a programmer for an item like a variable or function is called a(n) ____.

A

identifier

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

A ____ word (or ____) is a word that is part of the language, like integer, Get, or Put. A programmer cannot use one of these words as an identifier.

A

reserved, keyword

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

Identifiers must start with a(n) ____.

A

letter

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

Identifiers must be a sequence of ____, ___, and ____.

A

letters, underscores, digits

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

A(n) ____ is a combination of items, like variables, literals, operators, and parentheses, that evaluates to a value.

A

expression

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

A(n) ____ is a specific value in code, like 2.

A

literal

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

A(n) ____ is a symbol that performs a built-in calculation, like “+”.

A

operator

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

An expression is evaluated using the order of standard mathematics, such order known in programming as ____.

A

precedence rules

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

List the precedence rules for arithmetic operators. Start with the operator that is evaluated first.

A
  1. ()
  2. unary - (“unary minus,” used for negation)
    • /
    • -
  3. left-to-right
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

____ development is the process of writing, compiling, and testing a small amount of code, then writing, compiling, and testing a small amount more, and so on.

A

Incremental

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

A(n) ____ is a real number, like 98.6, 0.0001, or -666.667.

A

floating point number

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

A floating point ____ is a number with a fractional part, even if that fraction is 0, as in 1.0, 0.0, or 99.573.

A

literal

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

Integer variables are typically used for values that are ____, whereas floating-point variables are typically used for values that are ____.

A

counted, measured

19
Q

If the dividend and divisor in floating-point division are both 0, the division results in a ____.

A

NotANumber

20
Q

A(n) ____ is a list of statements executed by invoking this thing’s name, with such invoking known as a ____ call.

A

function

21
Q

Function input values are called ____.

A

arguments

22
Q

For the first call to the RandomNumber() function, no previous random integer exists, so the function uses a built-in integer known as the ____.

A

seed

23
Q

A programmer can specify the seed for a random number using the function ____.

A

SeedRandomNumbers()

24
Q

When the operands of “/” are both integers, what data type is the quotient?

A

An integer

25
Q

If at least one of the operands in a division operation is a floating point number, what data type is the quotient?

A

A floating-point type

26
Q

In the following variable assignment, if w and x are integers, and y is a floating-point type, will a fraction be generated?

y = w / x

A

No. Both operands are integers, which means that the operator performs integer division, leaving no fraction.

27
Q

What type of error occurs at runtime integer division is occurring and the second operand in a “/” or “%” is zero? What happens to the program?

A

A divide-by-zero error. The program terminates.

28
Q

The transformation of an integer into a float is an example of ____.

A

type conversion

29
Q

Type conversion that a programming language performs automatically is called ____ conversion.

A

implicit

30
Q

When different data types are involved in an assignment operation, which side—the left or right side—is implicitly converted to the other?

A

The right-side type is converted to the left-side type.

31
Q

If a programmer intentionally converts one data type to another, what is this called?

A

A type cast

32
Q

”%” is known as the ____ operator.

A

modulo

33
Q

What data type is a whole number value, like 1, 999, 0, or -25?

A

Integer

34
Q

What data type is a real number, like 98.6, 0.0001, or -666.667.

A

Float. A float is a floating-type number.

35
Q

What data type is a single letter, like ‘A’, ‘p’, or ‘%’?

A

Character

36
Q

What data type is a sequence of characters, like “Hello” or “The forecast for today is sunny with highs of 75F.”E+

A

String

37
Q

What data type refers to a quantity that has only two possible values, true or false?

A

Boolean

38
Q

A(n) ____ is an ordered list of items of a given data type.

A

array

39
Q

A(n) ____ is a named value item that holds a value that cannot change.

A

constant

40
Q

What can you use to minimize the use of literal numbers in code and improve readability?

A

constants

Example: newPrice = origPrice - PRICE_DISCOUNT, where PRICE_DISCOUNT is a constant

41
Q

What is Coral’s built-in math function for x^y?

A

RaiseToPower(x, y)

42
Q

What is Coral’s built-in math function for the square root of x?

A

SquareRoot(x)

43
Q

What is Coral’s built-in math function for the absolute value of x?

A

AbsoluteValue(x)

44
Q

A(n) ____ is a data type that holds a single value at a time, as opposed to an array.

A

scalar