Structured Programming

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

1/90

flashcard set

Earn XP

Description and Tags

C++

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

91 Terms

1
New cards

Procedure or Subroutine

A function is a name section of a program that performs a specific task, so a function is this

2
New cards

Void function

A function that does not return a value

3
New cards

Code block

Enclosed group of statements inside a set of braces

4
New cards

Function Definition

Contains the interface to the function as well as the statements that make up the function

5
New cards

A function call

A statement that causes a function to execute

6
New cards

A parameter

A special variable that holds a value being passed into a function

7
New cards

Function prototype

Eliminates the need to place a function definition before all calls to the function

8
New cards

Body of the function

The set of statements that perform the function’s operation

9
New cards

Modular Program

Several small functions to solve a specific parts of a problem

10
New cards

Static local variables

Exist for the life time of the program outside scope of function.

11
New cards

Function

A collection of statements that performs a specific task

12
New cards

Arguments

Values that are sent to a function

13
New cards

Function Overloading

A concept to define two or more functions with the same name with unique signatures.

14
New cards

Function Header

The very first line of a function definition

15
New cards

Default Arguments

Passed to parameters automatically if no argument is provided in function call

16
New cards

Global Variable

Defined outside all functions and is accessible to all functions

17
New cards

Flow of execution

The order in which statements are executed in a program

18
New cards

A library

A package of code that is meant to be reused by many programs

19
New cards

Passed by value

When a copy of an argument is passed to a function.

20
New cards

Driver code

A code that tests a function by simply calling it

21
New cards

A function, procedure, or subroutine

A programming construct that allows a programmer to associate a given set of instructions with a specific name

22
New cards

Incremental Development

Involves writing and testing small portions of a programs repeatedly until the program is complete.

23
New cards

Local Variable

Defined inside a function and is not accessible outside the function.

24
New cards

A stub

A dummy function that is called instead of the actual function it represents.

25
New cards

Library

A collection of precompiled routines that a program can use

26
New cards

Formal parameters

The list of parameters indicated in the functions definition

27
New cards

Dead or unreachable code

Is a part of the source code of a program which can never be executed because there exists no control flow path to the code

28
New cards

Return value

A function sends a value to the part of the program that executed it

29
New cards

Static variables

Variables that are defined inside a function that remain in memory after the function has finished executing.

30
New cards

Passed by Reference

When a reference variable is used as a parameter.

31
New cards

reference variables

Allow a function to access the parameter’s original argument

32
New cards

True

A problem can be solved with recursion of it can be broken down into successive smaller problems that are identical to the overall problem.

33
New cards

True

Any problem that can be solved recursively can also be solved iteratively, with a loop. In fact, recursive algorithms are usually less efficient than iterative algorithms. This is because a function call requires several actions to be performed by the C++ runtime system. These actions include allocating memory for parameters and local variables and storing the address of the program location where control returns after the function terminates. These actions, which are sometimes referred to as overhead, take place with each function call. Such overhead is not necessary with a loop

34
New cards

Recursive

A function is one that calls on itself

35
New cards

indirect recursion

occurs when function A calls function B, which in turn calls function A.

36
New cards

Base Case

The part of a calculation that can be solved without recursion. This stops the recursive function from continuing to call itself.

37
New cards

Direct recursion

When a recursive function calls itself

38
New cards

Subscript (index)

The number inside an array’s brackets in an assignment statement, or any other statement that works with contents of the array. Can also pinpoint a specific location in a array.

39
New cards

Size declarator

The number inside the brackets of an array definition

40
New cards

Iterator

An STL object that behaves like a pointer and is used to access the individual data elements in a container

41
New cards

Bounds Checking

C++ does not perform this, and means you can write programs with subscripts that go beyond the boundaries of a particular array.

42
New cards

Subscript operator

Data in a standard C++ array is accessible only via this

43
New cards

Array

Allows you to store and work with multiple values of the same data type.

44
New cards

Subscript operators (push_back())

Data can be stores in a vector via this member function.

45
New cards

Range-based for loop

Receives the value of a different container element during each iteration of this. During the first loop iteration, it receives the value of the first element; during the second iteration, it receives the value of the second element and so forth.

46
New cards

pop_back()

Removes the last element from a vector

47
New cards

Range Variable

Receives the value of a different container element during each iteration

48
New cards

Vector

Holds a sequence of values stored in contiguous memory locations

49
New cards

Algorithms

Provided by the STL are implemented as function templates

50
New cards

element

each storage location of an array

51
New cards

resize()

Member function increases the number of values that a vector may store by the number indicated by its first argument.

52
New cards

clear()

Completely delete the contents of a vector.

53
New cards

at()

Retrieve the value of an element in a vector

54
New cards

size()

Vectors can report the number of elements they contain

55
New cards

empty()

Returns true if no data is stored in the vector

56
New cards

containers

The data types that are defined in the STL are commonly called this.

57
New cards

Off-by-one error

Starts at 1 instead of 0

58
New cards

capacity()

To determine the number of values that may currently stored in a vector

59
New cards

Standard template library

A collection of data types and algorithms that you can use in your programs (programmer defined and not part of C++)

60
New cards

binary search

is a clever algorithm that is much more efficient than the sequential search. Its only requirement is that the values in the container be sorted in order. Instead of testing the container’s first element, this algorithm starts with the element in the middle. If that element happens to contain the desired value, then the search is over

61
New cards

ascending order

 arrange the data in a way such that each element is in some way “smaller than” its successor.

62
New cards

selection sort

The smallest value in the array is located and moved to element 0. Then, the next smallest value is located and moved to element 1. This process continues until all of the elements have been placed in their proper order.

63
New cards

linear search

 also known as the sequential search, uses a loop to sequentially step through a container, starting with the first element. It compares each element with the value being searched for, and stops when either the value is found or the end of the container is encountered. If the value being searched for is not in the container, the algorithm will unsuccessfully search to the end of the container.

64
New cards

Running Total

is a summation that is continually adjusted to take account of items as they are "seen" by a program; these summations are stored in a variable referred to as a(n) accumulator.

65
New cards

pretest loop

the loop's expression is tested prior to an iteration.

66
New cards

infinite loop.

A repeating sequence of instructions that has no way to stop repeating would be a(n)

67
New cards

Input validation

is the process of inspecting data given to a program by the user and determining if it is valid.

68
New cards

increment or decrement operator

placed before the variable

69
New cards

 loop body

The statement or block of statements that repeat

70
New cards

initialization expression

 is the first expression in a for loop header. It is normally used to initialize a counter variable to its starting value. This is the first action performed by the loop and it is only done once.

71
New cards

nested loop

A loop that is inside another loop

72
New cards

 iteration

A single pass through a loop

73
New cards

multiple assignment

 describes how a variable in a loop stores different values throughout the execution of the loop.

74
New cards

Event - controlled loop

The number of repetition is unknown before the loop begins executing.

75
New cards

Sentinel

Indicate the end of data. Also a special value that cannot be mistaken as a member of data.

76
New cards

posttest loop

The loops expression is tested after each iteration

77
New cards

Loop header

The first line of a while or for loop

78
New cards

Update

Common kind of reassignment, where a new value of the variable depends on the old

79
New cards

Counter

A variable that is regularly incremented or decremented each time a loop iterates.

80
New cards

Initialize a variable

To store a value in the variable for the first time

81
New cards

Iteration, repetition, and looping

Repeated execution of a set of statements

82
New cards

Priming read

The read operation that takes place just before an input validation loop

83
New cards

Repetition

Repeated execution of a set of statements: one execution of the set of statements is referred to as an iteration.

84
New cards

Postfix mode

The increment or decrement operator is placed after the variable.

85
New cards

Decrement

To decrease the value of a variable

86
New cards

Increment

To increase the value of the variable.

87
New cards

Flag

Is raised when a program detects that an event has occurred.

88
New cards

Update expression

Executes at the end of each iteration.

89
New cards

Count controlled loop

The number of repetitions is known before the loops begins executing.

90
New cards

Descending order

Means the value in the container are stored from highest to lowest.

91
New cards