Structured Programming

0.0(0)
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/58

flashcard set

Earn XP

Description and Tags

C++

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

59 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++)