Variables, Assignments, and Basic Expressions chapter 2

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/38

flashcard set

Earn XP

Description and Tags

Key vocabulary for understanding variables, data types, expressions, functions, and related concepts in introductory programming with Coral.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

39 Terms

1
New cards

Variable

Named storage location that holds a value which can change during program execution.

2
New cards

Assignment Statement

Uses = to store the value of a right-side expression into a left-side variable (e.g., x = 5).

3
New cards

Variable Declaration

Statement that introduces a new variable and specifies its data type (e.g., integer userAge).

4
New cards

Expression

Combination of variables, literals, operators, or function calls that evaluates to a single value.

5
New cards

Literal

Explicit value written in code, such as 2, -5, or 3.14.

6
New cards

Operator

Symbol that performs a built-in computation like +, -, *, /, or %.

7
New cards

Addition Operator (+)

Returns the sum of two operands (x + y).

8
New cards

Subtraction Operator (-)

Performs subtraction or, as unary minus, negation (-x).

9
New cards

Multiplication Operator (*)

Returns the product of two operands (x * y).

10
New cards

Division Operator (/)

Performs division; result type depends on operand types (integer or floating-point).

11
New cards

Modulo Operator (%)

Returns the remainder of integer division (e.g., 23 % 10 → 3).

12
New cards

Precedence Rules

Standard order of evaluation: parentheses, unary -, *, /, then + and - (left to right for ties).

13
New cards

Identifier

Programmer-defined name for variables, functions, etc.; must start with a letter and be case-sensitive.

14
New cards

Reserved Word (Keyword)

Word that is part of the language syntax and cannot be used as an identifier (e.g., integer, Get).

15
New cards

camelCase

Naming style that capitalizes each word except the first (e.g., numApples).

16
New cards

Underscore_separated

Naming style that uses lowercase words separated by underscores (e.g., num_apples).

17
New cards

Integer

Whole-number data type; Coral range ≈ –2 billion to +2 billion.

18
New cards

Floating-Point Number (float)

Real-number data type able to store fractional values (e.g., 98.6).

19
New cards

Boolean

Data type with exactly two values: true or false.

20
New cards

Array

Ordered list of items of a given data type (e.g., array of integers).

21
New cards

String

Sequence of characters like "Hello"; printed directly in Coral via Put.

22
New cards

Unary Minus

Operator that negates a single operand (-x).

23
New cards

Integer Division

/ with two integer operands; fractional part is discarded (10 / 4 → 2).

24
New cards

Floating-Point Division

/ where at least one operand is float; fraction is preserved (10 / 4.0 → 2.5).

25
New cards

Divide-by-Zero Error

Runtime error for integer / or % when divisor is 0; terminates program.

26
New cards

Type Conversion

Changing a value from one data type to another.

27
New cards

Implicit Conversion

Automatic conversion performed by the language, e.g., int to float in mixed arithmetic.

28
New cards

Type Casting

Explicit programmer-requested conversion, often via multiplying by 1.0 or other cast syntax.

29
New cards

Constant

Named value that cannot change during execution; often written in ALLCAPS (e.g., SOUNDSPEED).

30
New cards

Function

Reusable group of statements invoked by name that may return a value.

31
New cards

Function Call

Execution of a function using its name followed by arguments in parentheses.

32
New cards

Argument

Value or expression passed into a function call.

33
New cards

SquareRoot(x)

Built-in Coral function that returns the square root of x.

34
New cards

RaiseToPower(x, y)

Built-in Coral function that returns x raised to the y power.

35
New cards

AbsoluteValue(x)

Built-in Coral function that returns the non-negative magnitude of x.

36
New cards

RandomNumber(low, high)

Returns a pseudo-random integer between low and high inclusive.

37
New cards

SeedRandomNumbers(val)

Initializes the pseudo-random generator with a specific seed value.

38
New cards

Pseudo-Random

Sequence that appears random but is generated deterministically from a seed.

39
New cards

Incremental Development

Process of writing, compiling, and testing small pieces of code repeatedly.