Link to home
Start Free TrialLog in
Avatar of edelossantos
edelossantos

asked on

Term check:

Please check for accuracy and correctiveness.

1.  When is it appropriate to use one-letter variable names?
-loop or counter variables
-variables in mathematical expression
-in all other cases do not do it

2. What are pre- and post- conditions and why are they useful?
-the precise conditions that must hold when a program begins and after it finishes.
-they are invariants.

3. Name and describe the three kinds of parameter passing mechanisms in C++.
-Input parameters, output parameters, and Inout parameters.
-input parameters should be passed by value whenever possible
-if passed by reference use const
-output and inout parameters must be passed by reference (& or *)

4. Give an example of when you should use each of the parameters described
   in #3.
-in C++ input parameters are often passed by value.
-Large objects should be passed by reference
-inout parameters are passed by reference

5. What is a program stub?
-a stub is a function with just enough code in it to get past the compiler.  You create a stub in order to test you program before writing full implementations of all functions.

6. What is the difference between stubs and drivers, and when should each be
   used?
-a driver is code written with the purpose of testing functions.  Drivers will be taken out when the code is fully debugged.
-a stub is partial function definition, not meant to be tested.
-both should be used during the debugging and refinement process of coding.

7. Give an example of and describe the scope and lifetime of each of the
   following identifiers or entities: not sure!!! please check and correct or add where applicable:-)
   * a local variable - int c; are defined in the function and exists only while the function is being executed.  They are not initialized before the function begins and are discarded when the function ends.  Alive when in memory.
   * an argument passed by reference: int size, &dynamic_array, i; void Life::initialize(int &x, int &y) { has to have a memory location.
   * an argument passed by value: int size, dynamic_array, i; void Life::initialize(int x, int y) { alive when in memory
   * a global variable: are used in the function but not defined in the function. alive when in memory
   * a static variable outside a class:static int maxrow = 20, maxcol = 60; is alive during complete execution of the program throughout the file. Has to have a memory location.
   * a function name: func_1(int, int);
   * a return value: return x;
   * a literal ???

8.  What is black-box testing?
-testing method that is usually more effective when recovering errors.

9.  What is top-down refinement?
-the real key to writing large programs that work.

10. What is modular programming?
-in glass box testing, the advantages of modular program design becomes evident.



ASKER CERTIFIED SOLUTION
Avatar of Axter
Axter
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>>4. Give an example of when you should use each of the parameters described
>>   in #3.

Change this to examples for by-value, by-ref, and by-pointers
Number 7 needs a lot of work.

EE has rules against doing homework questions.
But we're aloud to help you with existing work.

Check out your book for by-reference and by-pointers definitions.
Avatar of edelossantos
edelossantos

ASKER

Great information.  Thank you Axter.  Del