Solved

Term check:

Posted on 2004-09-20
4
198 Views
Last Modified: 2010-04-01
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.



0
Comment
Question by:edelossantos
  • 3
4 Comments
 
LVL 30

Accepted Solution

by:
Axter earned 500 total points
ID: 12105308
>>3. Name and describe the three kinds of parameter passing mechanisms in C++.

I think they're really looking for (1. by-valure, 2. by-ref, 3. by-pointer)
0
 
LVL 30

Expert Comment

by:Axter
ID: 12105323
>>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
0
 
LVL 30

Expert Comment

by:Axter
ID: 12105436
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.
0
 

Author Comment

by:edelossantos
ID: 12105987
Great information.  Thank you Axter.  Del
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now