Ch 1: Review & Intro Flashcards
what is ifstream & ofstream? (what do you use them for, how do you use them - functions)
ifstream & ofstream are file input streams that write to (ofstream) and get data from (ifstream) file inputs
what do you use ifstream & ofstream operators and how do you use them?
- use insertion»_space; and extraction «_space;operators to get and write data
- use similarly to cin: inFS», outFS«
- # include
what is a pointer and what does the data type of the pointer do?
- pointer: holds a memory address
- pointer data type determines what type of address the pointer will store (Ex. int* p points to address of an int variable)
what is a reference(&), what are the dereference operators and what do they do?
- reference(&): obtain a variable’s address
- dereference operators: *, ->, []
- dereference operators retrieve the data from the variable that the pointer points to (Ex. int a = *p, sets a to the data that pointer p points to)
what is the new operator?
new operator allocates memory into heap before calling constructor (ex. Point* point1 = new Point(___); )
what is the delete operator?
delete operator frees memory of variable in heap
how is an allocated array deleted?
delete[]
what is the advantage of linked lists over sequential storage approaches (arrays or vectors)?
items can be reordered, added and removed in linked lists without having to shift items
what is recursion?
calling the same algorithm(function) multiple times for smaller sets
what are the two functions for recursion?
- outer: the function that is called from other parts of the program, calls the inner function
- inner: called by the other function, does recursive action
what is an ADT, or abstract data type?
a data type whose creation and update are constrained to specific well-defined operations
do variables have to be declared before being used in class definition? how does this relate to inline member functions?
no, variables can be declared after its use in class definition. this relates to inline member functions because sometimes an inline member function calls on a variable that is defined afterwards, but the function definition is still valid
what is 100% code coverage?
every line of code is conducted
what are border cases?
unusual or extreme test case values
how does 100% code coverage relate to bugs in code?
100% code coverage does not ensure that there are no bugs in code