COMP 1125: Repetition Structures, Functions, and Arrays

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/33

flashcard set

Earn XP

Description and Tags

Vocabulary flashcards covering repetition structures, functions, modular programming, and arrays based on COMP 1125: Principles of Programming.

34 Terms

1
New cards

Repetition Structures

Control structures, more commonly known as loops, that allow specific blocks of code to repeat multiple times.

2
New cards

Iteration

A single execution of the block of code that composes a loop.

3
New cards

Condition-Controlled Loop

A category of loops (including while and do-while loops) that repeats as long as a specified condition evaluates to true.

4
New cards

Count-Controlled Loop

A loop (such as a for loop) best utilized when the exact number of iterations is known before execution begins.

5
New cards

Pretest Loop

A loop type, such as the while loop, where the controlling condition is evaluated before any loop code executes.

6
New cards

Posttest Loop

A loop type, specifically the do-while loop, where the body executes first and the condition is evaluated afterward to determine if it should run again.

7
New cards

Infinite Loop

A loop whose condition remains perpetually true and never evaluates to false, requiring an outside action to stop execution.

8
New cards

Augmented Assignment Operators

Shorthand programming operators (such as += or *=) used to update the value of a variable relative to its current value.

9
New cards

Increment and Decrement Operators

Special unary operators (++ and --) that increase or decrease a variable's value by 1.

10
New cards

Loop Header

The top statement of a for loop that typically contains where to start (initialization), where to stop (condition), and how to advance (update).

11
New cards

Running Total

A cumulative sum maintained across loop iterations, such as a partial sum in a mathematical summation.

12
New cards

Accumulator Variable

A variable that is augmented during each iteration of a loop to track a running total.

13
New cards

Sentinel Value

A predetermined flag value entered to signal the termination of a loop, selected because it is unlikely to be mistaken for legitimate data.

14
New cards

Nested Loops

A structure where one loop resides inside another; the inner loop executes in its entirety for each individual iteration of the outer loop.

15
New cards

break Keyword

A control statement used to immediately terminate and exit the execution of a loop.

16
New cards

continue Keyword

A control statement used to bypass the remainder of the current iteration and advance directly to the loop's next iteration.

17
New cards

String Index

The zero-based numerical position of a character within a string, accessed using bracket syntax.

18
New cards

Modular Programming

A development approach rooted in top-down design that breaks a complex problem into smaller tasks, implementing each task as a distinct function.

19
New cards

Function

A named, reusable block of code designed to solve a specific subtask, which can be defined once and called wherever needed.

20
New cards

Function Header

The declaration line of a function that specifies its return type, function name, and parameter list.

21
New cards

Function Signature

The combination of a function's name and its parameter list.

22
New cards

void Function

A function that performs an action but does not return a value to the caller.

23
New cards

Parameter

A local variable declared within a function header's parameter list that receives incoming values when the function is called.

24
New cards

Argument

The actual value passed into a function call to initialize its corresponding parameter.

25
New cards

Function Prototype

A function declaration placed before its use (typically near the top of the file) that enables functions to be called regardless of their definition order.

26
New cards

Pass By Value

The default parameter passing mechanism where a copy of an argument's value is passed into the function, meaning changes made inside do not alter the caller's variable.

27
New cards

Pass By Reference

A parameter passing mechanism using the address-of operator (&) to pass the memory address of the actual variable, causing changes inside the function to alter the variable outside.

28
New cards

Array

A contiguous sequence of values in memory of identical data type that can be referenced using a single variable name.

29
New cards

Element (Array)

An individual value stored within an array structure.

30
New cards

Subscripts

The bracket notation ([]) and index used to access or reassign specific values within an array.

31
New cards

Contiguous Memory

The consecutive arrangement in physical memory where an array's elements are placed sequentially back-to-back.

32
New cards

Range-Based for Loop

A loop construct introduced in C++ 11 (also referred to as a for-each loop or enhanced for loop) that iterates directly over array values instead of element indices.

33
New cards

Incomplete Initialization

Providing fewer initializers than the declared array size, which fills the uninitialized elements with default values (such as 0 for ints or empty strings for strings) rather than garbage values.

34
New cards

Bounds Checking

A safety feature verifying that index accesses stay within an array's valid bounds, which is not performed by standard C++ arrays.