Answer: Modularity was introduced to support construction of large programs. A module is a large program units that can be implemented as an independent entity. A well-designed module typically has a single purpose and represents a narrow interface to other modules. A module typically makes only a few components visible outside. Such components are said to be exported by the module. Other modules remain hidden inside the module and used for implementing the visible components. Modules are designed to be resuable.
Solution:
Yes, agree with the statement. Use of abstraction allows us to concentrate on general ideas rather than on specific manifestations of these ideas. In programming, abstraction refers to what a piece of code does rather that how it is implemented. For example, in C/C++ consider the difference between a .h file (prototype declaration-what the program does)and a .c file (how the program does it, i.e., its implementation).
3. Give an example of a parameterless abstraction (i.e. a procedure, or a function which has no parameters) that does not perform exactly the same computation every time it is called. Under what circumstances, in general, will a parameterless abstraction behave like this?
Solution:
int a; // global variable a void test() { cout << 2*a; } ... int main() { a = 2; test(); a = 3; test(); ... } In general, a parameterless abstraction may not perform exactly the same computation every time it is called if it relies on the exterior environment for at least one of the values that it uses.