Question

In: Computer Science

1. Briefly describe the four categories of identifier scope in C++. 2. List the three steps...

1. Briefly describe the four categories of identifier scope in C++.

2. List the three steps in loop design.

**please give simple answers. I don't need a code. Just the definitions please.

Solutions

Expert Solution

Every identifier has a scope that is determined by where it is declared. Identifier Scope in a program is the region(s) of the program within which the identifier can be used. Using a name outside of its scope is an error.

There are five possible scopes in C++: -

1. Block scope:

An identifier declared inside curly braces or in a function parameter list has block scope. Block scope extends from the declaration to the enclosing right brace.

2. Function scope: Labels in C/C++ have their own scope. They are accessible before and after their declaration, for the whole function. The thing that makes its scope unique is that the label (the declaration) can appear after the first goto that uses it

3. Class scope:

An identifier that is declared inside a class definition has class scope. Class scope is anywhere in the class definition or in the bodies of member functions.

4. File scope:

This is basically the same as global scope, except that file scope variables are not exported to the linker. The keyword static hides an identifier from other source files and gives it file scope. File scope variables cannot be declared extern and accessed from another file. File scope variables, because they are not exported, do not pollute the global namespace. They are often used in C programs because C has no concept of private class members.

5. Global scope:

An identifier whose declaration is not in between braces (round or curly) has global scope. The scope of such an identifier begins at the declaration and extends from there to the bottom of the source code file.

Three steps in loop design are: -

1. Initialize: - Used to initialize the loop control variable.

2. Test: - Used to check the terminating condition for the loop.

3. Update: - It is used to update the loop control variable.

Loop also has a body which contains all the statements which are to be executed when the loop is executed.


Related Solutions

c. List the four steps involved with the phagocytosis and destruction of a microbe? Briefly describe...
c. List the four steps involved with the phagocytosis and destruction of a microbe? Briefly describe what is occurring in each step d.   Briefly describe one way a pathogen could escape phagocytosis
List and briefly describe the four steps in the process for managing legal risk.
List and briefly describe the four steps in the process for managing legal risk.
1) Describe fraud. 2) What are the three categories of fraud and list an example of...
1) Describe fraud. 2) What are the three categories of fraud and list an example of each. 3) Describe the fraud triangle. 4) List the key requirements of the Sarbanes-Oxley Act (SOX) 5) List the components of the framework commonly used in corporations when analyzing their internal control systems: 1. 2. 3. 4. 5. 6) List the five common principles of Internal Control and give an explanation and example of each 1. 2. 3. 4. 5. 7) Name two reasons...
What are the three categories of business entities? List and briefly describe the two primary differences...
What are the three categories of business entities? List and briefly describe the two primary differences between the three categories of business entities.
1.List and describe the four forms of energy used in the human body. 2.Describe the three...
1.List and describe the four forms of energy used in the human body. 2.Describe the three major types of chemical bonds and any subtype they have. Compare and contrast the three. 3.Define homeostasis and describe the parts and functions of the homeostatic control mechanism. 4.Describe the four macromolecules, in detail. Include the elements that build the four molecules, the building blocks, and the major functions of the four. 5.List and describe the structural organization of the human body.
QUESTION FOUR [15] Economists classify unemployment according to various categories. List and describe three main types...
QUESTION FOUR [15] Economists classify unemployment according to various categories. List and describe three main types of unemployment.
List and briefly describe the four spending components of GDP.
List and briefly describe the four spending components of GDP.
1. Name key elements of Object-Oriented systems 2. Briefly describe three steps of the Analysis Phase....
1. Name key elements of Object-Oriented systems 2. Briefly describe three steps of the Analysis Phase. 3. Briefly describe major elements of the Structural Models in OOD with UML.
Describe fraud. What are the three categories of fraud and list an example of each. Describe...
Describe fraud. What are the three categories of fraud and list an example of each. Describe the fraud triangle. List the key requirements of the Sarbanes-Oxley Act (SOX) List the components of the framework commonly used in corporations when analyzing their internal control systems: List the five common principles of Internal Control and give an explanation and example of each Name two reasons why internal control for cash is important. What does the term “cleared the bank” mean? What are...
1. Identify the three categories of the accounting equation, and list at least four accounts associated with each category.
 1. Identify the three categories of the accounting equation, and list at least four accounts associated with each category. 2. What is the purpose of the chart of accounts? Explain the numbering typically associated with the accounts. 3. What does a ledger show? What's the difference between a ledger and the chart of accounts? 4. Accounting uses a double-entry system. Explain what this sentence means.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT