D278 EXAMINATION QUESTIONS AND ANSWERS
Variable - A named item used to hold a value.
Ex: x, numItems, numPeople
Assignment Statement - Assigns a variable with a value.
Example: The example states that x is assigned to 5.
x=5
Variable Declaration - A statement that declares a new variable, specifying the variable's
name and type.
Integer - A whole number. Commonly used to count items.
Example: 1, 999, 0, -25.
Identifier - A starts with a letter, can contain a sequence of letters, digits, and
underscores.
Example: num_Cars1, numCars, num__Cars
Reserved Word (Key Word) - A word that has a special meaning in a programming
language and therefore cannot be used as a name by the programmer.
Examples: Get, Put
Naming Conventions - A set of style guidelines defined by a company, team, teacher, etc.,
for naming variables.
Are case-sensitive.
, Uses Camel Case: capitalizing each word except the first.
Underscore Separated: words are lowercase and separated by underscores.
Expression - A combination of items like variables, literals, operators, and parentheses
that evaluates to a value.
Example: x is 3
2 * (x + 1) = 8
Literal - A specific value in code, like 2.
Operator - A symbol that performs a built-in calculation.
Example:
*/+-
Precedence Rules for Arithmetic Operators - Rules used to evaluate an expression in a
certain order.
1. ( ) - Items in parentheses.
2. Unary- used for negotiation
3. * / having equal precedence
4. + - having equal precedence
5. Left to Right; if more than one operator of equal precedence is being evaluated.
Which expression is evaluated first? - x=4
w=2
y = 3 * (x + 10 / w)
Variable - A named item used to hold a value.
Ex: x, numItems, numPeople
Assignment Statement - Assigns a variable with a value.
Example: The example states that x is assigned to 5.
x=5
Variable Declaration - A statement that declares a new variable, specifying the variable's
name and type.
Integer - A whole number. Commonly used to count items.
Example: 1, 999, 0, -25.
Identifier - A starts with a letter, can contain a sequence of letters, digits, and
underscores.
Example: num_Cars1, numCars, num__Cars
Reserved Word (Key Word) - A word that has a special meaning in a programming
language and therefore cannot be used as a name by the programmer.
Examples: Get, Put
Naming Conventions - A set of style guidelines defined by a company, team, teacher, etc.,
for naming variables.
Are case-sensitive.
, Uses Camel Case: capitalizing each word except the first.
Underscore Separated: words are lowercase and separated by underscores.
Expression - A combination of items like variables, literals, operators, and parentheses
that evaluates to a value.
Example: x is 3
2 * (x + 1) = 8
Literal - A specific value in code, like 2.
Operator - A symbol that performs a built-in calculation.
Example:
*/+-
Precedence Rules for Arithmetic Operators - Rules used to evaluate an expression in a
certain order.
1. ( ) - Items in parentheses.
2. Unary- used for negotiation
3. * / having equal precedence
4. + - having equal precedence
5. Left to Right; if more than one operator of equal precedence is being evaluated.
Which expression is evaluated first? - x=4
w=2
y = 3 * (x + 10 / w)