Study your flashcards anywhere!

Download the official Cram app for free >

  • Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off

How to study your flashcards.

Right/Left arrow keys: Navigate between flashcards.right arrow keyleft arrow key

Up/Down arrow keys: Flip the card between the front and back.down keyup key

H key: Show hint (3rd side).h key

A key: Read text to speech.a key


Play button


Play button




Click to flip

116 Cards in this Set

  • Front
  • Back
  • 3rd side (hint)
What are the 4 steps in the problem solving phase?
Analyze the problem
Specify what the soluction must do
Develop a sequence of steps that leads to a solution
Verify that the steps solve the problem
What are the 3 phases in programming?
Problem solving phase
Implementation phase
Maintenance phase
What is an algorithm?
The logical sequence of steps that leads to the solution of a problem.
What 4 conditions must be met in an algorithm?
Solve the problem in a finite amount of time
Must be unambiguous
Must stop
Must solve the problem
What is a programming language?
A set of rules, symbols and special words used to construct a program
rules, symbols, words
What are 4 types of control structures?
Define sequence.
A series of statements that are executed one after the other in order.
series of...
Define selection.
The conditional control structure that determines what statment will execute next.
conditional control structure that...
Define loop.
The repetitive control structure that repeats a statment or group of statements while certain conditions remain satisfied.
repetitive control structure that...
Define sub-program.
Allows a complex program to be broken down into the smaller less complex units.
break down...
What is the decimal system based upon?
Ten unique digits
What is the binary system based upon?
Two unique digits (0s and 1s)
How do you convert from binary to base 10?
number the 0s and 1s starting at 0 from right to left
the number under each is to the power 2
add the numbers
2^5 + ...
How do you convert from base 10 to binary?
divide by 2 and record quotient and remainder
if quotient is 0, stop
binary number is the sequence of remainders recorded bottom to top
bottom up
Define bit.
A single binary digit
Define byte.
A group of eight bits
group of __ bits
What are words?
Groups of 16, 32 and 64 bits
16, 32, 64
What code do we use for representing characters as binary numbers?
American Standard Code for Information Interchange
What is a machine language?
A special language built into each computer where all instructions and data are represented by sequences of 0s and 1s
What is an assembly language?
A low-level language where mnemonic is used to represent each machine language instructions
mneomic - a programming code that is easy to remember
What is a source program?
A high-level language that has more english-like representations of algorithms such as C++
What happens during compilation?
The computer runs the compiler program using your source code as input
What happens during execution?
The computer runs your object program?
runs __________ program
What is a C++ program a collection of?
one or more sub-programs
What is a function?
A function is a sub-progam
smaller part
#include is what?
A preprocessor directive
What is syntax?
The formal rules describing how valid instructions are written, legal combinations of letters, numbers and symbols
rules, instructions
What is semantics?
The set of rules that determine the meaning of statements
What is a metalanguage?
A language used to describe another language
What does BNF stand for and what is it?
Backus-Naur Form, computer-oriented metalanguages
What is an identifier?
A programmer-defined name assigned to a variable, named constant or function
name assigned to ________
What is a variable?
A value that can be changed.
What is a named constant?
A value that can't be changed
value that ______
What are the rules for constructing identifiers?
Must begin with a letter or _
can contain any number of letters, digits and _
letters are case sensitive
What is a reserved word?
A word that has special meaning to C++ and cannot be used be used as an identifier
What is a data type? Give examples.
A representation of a specific set of values and set of valid operators. Ex. int, char, short, float, bool, ect.
What does a declaration associate?
A declaration associates an idntifier (ex. name1) with a data type (ex. string)
int numOfPies
What does an assignment do?
Stores the value of an expression in a variable.
area = PI * radius * radius
What does the char data type do?
Describes data consisting of a single character in single quotes
Is char an integral type?
Yes because characters are stored as integers
characters are stored as ____
What is the concatenation of strings?
The joining of strings
string = string1 + string2;
What does the insertion operator do and what does it look like?
The insertion operator is used to convert a sequence of characters into an output stream. It looks like this: <<
List the two numeric data types and describe the difference between the two.
Int and Float. Int contains no decimals and float contains 6.
____ num = 12;
____ num = 12.4;
What is type coercion?
Automatic conversion from one type to another
What is type casting?
Explicit conversion from one type to another.
What happens when a value of 4.5 is inputted into an int data type?
The .5 is truncated and the int has a value of 4
What do the manipulators setw, fixed, showpoint and setprecision do?
setw sets the width of the output, fixed forces all floats to output in decimal format (opposite of scientific), showpoint forces the decimal to print an dsetprecision determines the number of decimal places to output
cout << fixed << showpoint;
cout << setw(5) << setprecision(2) << x;
Write two segments of code that use length and size functions.
string myName = "Kendra Cunningham";
int numOfChars;
What value does each segment contain?
numOfChars = myName.lenght(); = 16
numOfChars = myName.size(): = 16
Lenght and size functions are called using dot notation.
What does the find function do? Give an example.
The find function searches a string to find the first occurance of a substring and returns and unsigned integer equal to the first position of the substring. Example:
string firstName = "Kendra" (count starting at 0 so K = 0, n = 2)
position = firstName.find("Ken"); = sets position to 0
What do x and y stand for in the following segment of code?
firstName = myName.substr(x,y);
x is the start position and y is the length.
where and for how long?
What does an extraction operator do and what does it look like?
An extraction operator is used to convert a sequence of characters into an input stream. It looks like this: >>
What are 3 rules extraction operators follow?
Skips leading whitespace.
If data is char, stops after a single character.
If data is an int or float, stops once the data is inappropriate
skip char stop
What does the new line character look like and how is it generated?
It looks like this: '\n', and it is generated by the endl manipulator
What do x and y stand for in the following segment of code:
cin.ignore(x, y);
x is the number of characters are ignored unless the character y is encountered.
How do you use the get function and why is it useful??
The get function is used like this:
and it is useful because it does not skip leading whitespace
welkjr* werj3
What are the two ways to read data into a string? What do each do?
>> and getline function. >> skips leading whitespace and reads until the next whitespace (whitespace is never consumed) whereas the getline function does not skip leading whitespace and reads all characters up to the next new line character (new line is consumed but not stored).
1. werj3a wer900 = werj3a
2. 234 w49gawer = 234 w49gawer
When do we use input and output files? What is the header file called?
We use output files when we want the data to persist and input files when the amount of data is large or we want to reuse the data. The header file is called <fstream>.
inFile, outFile
What are the 5 steps to do file I/O?
1. include header file <fstream>
2. declare file streams (ifstream inFile;)
3. Open files for reading and writing:"Data.In");; - a cstring is a null terminated sequence of characters of type char
4. specify names of file streams inFile >> i;, outFile << "i = ";
5. close the files (inFile.close();)
What is the flow of control?
The order in which statments are executed.
What is a logical expression?
An assertion that C++ evaluates to determine whether it is true or false
How are boolean variables and constants represented and what two possible values do they take on?
The are represented by the bool data type and take on the values true (non-zero value) and false (zero value).
What do these logical operators stand for and what do they do?
1. &&
2. ||
3. !
1. && - and, requires both relationships to be true, otherwise the result is false
2. || - or, requires on of the relationships to be true, only two falses cause it to be false
3. ! - not, used to reverse the meaning of an assertion
What is short-circuit evaluation?
Evaluation that proceeds from the left to the right and stops evaluating as soon as the truth of the assertion is known.
- if the left hand side of a || is true, the right side is not checked
- if the left hand side of and && is false, the right side is not checked
assertion1 && assertion2
What are the levels of the precedence rules that detemine the order that arithmetic, relational, and logical operators are applied?
1 !, unary+, unary-
2 *, /, %
3 +, -
4 <, <=, >, >=
5 ==, !==
6 &&
7 ||
8 =
Define loop test, loop entry, loop exit, iteration, and termination condition.
loop test - the point where a decision is made whether to begin an iteration of the loop
loop entry - point at which the flow of control reaches the first statment
loop exit - the point where repetition of the loop body ends
iteration - an individual pass through the loop
termination condition - the condition that causes the loop to end
What is a count-controlled loop?
A loop that executes a specific number of times.
What is an event-controlled loop? What are the 3 types?
A loop that executes until something happens inside the loop body that makes it quit. The 3 types include:
Sentinel control loops - used to read in values until some special termination value is encountered
End-of-file controlled loop - used to read in values until the steram goes into a fail state
Flag controlled loop - sets a flag (usually a boolean variable) that is set to either true or false when the loop should stop
What is the for statment a simplification of?
The for statement is used to simplify writing of count-controlled while loops. Example:
do something
- the for statement is actually translated into the while loop by the compiler
What do x, y, and z stand for in the for statment:
for( x; y; z;)
do something
x is the initialization expression and initializes the loop control variable
y is the loop continuation variable and is checked prior to each iteration of the loop
z is the increment/decrement expression and is increased or decreased following each iteration of the loop
What is the difference between while and do-while loops?
A while loop may never execute whereas a do-while loop executes at least once.
What is black box testing (functional testing)?
Black box/functional testing is testing to see if the program does what it is suppose to do. It is called black box testing because it doens't explicitly used knowledge of the internal structure of a program or system.
no knowledge of insides
What are 3 general strategies in black box testing?
Equivalence partitioning - try to identify values that will give the same result
Checking boundary values - try to test values at or near the endpoints of ranges and try to identify any restrictions on the number of values
Other conditions - check for blanks or null characters in strings, check for negative numbers, check for non-numeric data in numeric variables, check for input data that is too short or too long
What is white box testing (structural testing)?
White box testing is concerned with designing test cases based upon the c++ source code witch knowledge of its internal structure and workings
knowledge of insides
What are 6 general strategies of white box testing?
Statment level - each statment must be executed at least once
Branch level - each branch must be crossed at least once and every entry point taken at least once
Condition level - each condition must be true at least once and false at least once
Compound condition level - all combinations of conditions and values executed at least once
Path level - all program paths crossed at least once
Black box strategies
Define complexity.
Complexity is the amount of work involved in executing an algorithm relative to the size of the problem.
work algorithm size
Define step.
A step is the amount of work done in a basic operation like a comparison, I/O operation or assignment
The amount of work required to execute an algorithm is measured in the number of steps.
How do you measure complexity in sequential statments, conditional branches and loops
1. In sequential statements, the number of steps is basically equivalent to the number of statements.
2. In conditional branches, the number of steps is basically equivalent to the number of statements in the longest branch.
3. In loops, the number of steps is basically equivalent to the number of statements in a loop times the number of iterations.
What is constant-time, linear-time and quadratic-time complexity?
Constant-time is when an algorithm always executes in the same number of steps or fewer
Linear-time complexity is when an algorithm always executes in a number of steps that is some factor of the input size
Quadratic-time complexity is when an algorithm always executes in a number of steps that is a factor of teh time required to execute two nested loops
same-,same*, same*2
What is big-oh notation? Give examples
Big-oh notation is when complexity of an algorithm is classified according to the highest order of N (called the order of magnitude)
Constant-time = O(1)
Linear-time = O(N)
Quadratic-time = O(N^2)
What is a one-dimensional array?
A one-dimensional array is a structured collection of components, all of the same data type, and all associated with a single identifier name
same data type
What is each component of an array called?
An element. Each element is accessed by an index that indicates teh element's relative position within the collection.
What is an array index.
An index is an integer expression whose ranges of values is from 0 to n-1 where n is the number of elements in the array
Is there a difference between the "fifth element" and "element 5"? If so, what is it?
Yes, the fifth element is actually referenced by index 4 whereas element 5 is in position 6
What is a value-returning function do?
A value-returning function usually receives some data through the argument list in the function call, computes some value, and returns the value to the calling code.
recieve data, compute, return
What does a void function do?
A void function can receive some data through the argument list in the function call, but it doesn't return a value to the calling code.
print stars
Define functional decomposition.
Functional decomposition is the process of breaking a problem into smaller more easily understood subproblems
-structured design
-top-down design
building blocks
Define concrete steps.
Concrete steps are subproblems for which the implementation steps are fully defined/specified
Define abstract steps.
Abstract steps are subproblems for which some implementation steps remain undefined/unspecified
Define module.
A module is each box in the hierarchical solution tree.
What do function calls do?
Function calls (control structures) alter the logical order of execution.
Define argument list (or function arguments).
The argument list is the list of items in the call to the function (a mechanism by which functions communicate with each other)
Define parameter list (or function parameters)
Function parameters are the variables declared in a function heading
-item name is local to the function
int Calc (int num)
What is a function prototype used to do?
A function prototype is used to identify the type of value returned and the types of its parameters (or a function declaration wihtout the body of the function).
void Calc ();
What is a function definition?
A function definition is a declaration that includes the body of the function
void Calc ()
do something
Define scope.
Scope is the region of a program where it is legal to reference an identifier.
use identifier
Define scope rules. Give examples.
Scope rules determine where an identifier may be referenced and is based upon where it is declared.
-function names have global scope
-function parameters have local scope
-global variables and constants have scope that extends from teh point of declaration to the end of the program
-local variables and constants have scope that extends from teh point of declaration to the end of the black in which it is declared
-the scope of an identifier does not include any nested blocks that contain a locally declared identifier of the same name
global vs. local
Define function parameter.
A parameter is a variable declared in a function heading
-value parameter
-reference parameter
declared variable in ____??
Which is the value paramter in the following:
void Example(int& param1, float param2)
a. example
b. param1
c. param2
c. param2 is a value parameter ( a parameter that recieves a copy of the value of the corresponding argument).
a is the function heading and b is a reference parameter
Which is the reference paramter in the following:
void Example(int& param1, float param2)
a. example
b. param1
c. param2
b. param1 is the reference paramter (a parameter that receives the location of the caller's argument).
Define character set.
The set of all possible characters that a computer uses is called the character set.
What is EBCDIC and who uses it?
Extended Binary Coded Decimal Interchange Code used by IBM mainframes
What is external representation?
The external representation is the way a character looks on an I/O device, such as the screen or printer.
What is internal representation?
The internal representation is the way a character is stored in memory.
Ex. 'A' is stored as 65
char constants come in what 2 forms?
Printable characters (ex. ASCII characters with integer values from 32 to 126) enclosed in single quotes, such as 'A', '+'
Control characters (ex. ASCII characters with integer values from 0 to 31 and 127) and are not meant ot be printed, they are meant to control the screen, printer and other devices '\n' - newline, '\'' - single quote, etc.
What is a model number?
Any real number that can be represented exactly on a computer by a floating point number is called a model number.
Define absolute error.
Absolute error is the rounding error that occurs between the real number and the model number.
real vs. model
Define relative error.
Relative error is the absolute error divided by the real number represented as a percentage.
absolute / real
Define underflow.
Underflow is representational error w here the value of a calculation is too small to be represented.
Define overflow.
Overflow is the representational error where the number is too large to be represented.
Define enum.
The enum (short for enumeration) type is a user-defined data type whose domain is an ordered set of literal values expressed as identifiers.
-the values contained in the enum are called enumerators
-sine enumerators are named constants, it is usually proper style to capitalize them
set of values
Define an automatic variable.
An automatic variable is one whose storage is allocated at block entry and deallocated at block exit.
in a void function
Define a static variable.
A static variable is one whose storage remains allocated for the duration of the program.
Define lifetime and it's relation to scope.
The lifetime of a varialbe is the period of time during program execution when an identifier has memory allocated to it. Lifetime is related to scope, but scope is a compile-time issue and lifetime is a run-time issue.
program execution
What is a side effect.
A side effect is any effect of one function on another that is not part of the explicitly defined interface.
one on another
What is the function call stack?
A mechanism used to support the creation, execution and destruction of called functions and the variables they contain.
When does stack overflow occur?
Stack overflow occurs when the number of activation number exceeds the amount of memory allocated to the stack