Answer the following statements true (T) or false (F)

1. In C++, a compilation unit is a class or function.
2. An unnamed namespace provides a facility for collecting names that are local to the file where the unnamed namespace is located. Such names are available in that file, and are unavailable in any other file.
3. A function defined inside an unnamed namespace requires qualification.
4. You can use the static qualifier with a global function, class or variable to get the same effect as an unnamed namespace.


1. False
A C++ compilation unit is the file. A file may contain the contents of include files (files that are present by way of #include directives), global namespace function and class definitions, an unnamed namespace, and possibly one or more named namespaces.
2. True
The names in an unnamed namespace can be reused in another unnamed namespace that is located in another file with no chance of name clash.
3. False
An unnamed namespace grouping behaves as if the unnamed namespace were named with a name that is not used anywhere else in the program, perhaps unique_1. The rest of the file behaves as if it had the directive,
using namespace unique_1;
so that the names from the namespace can be used in the file, but are unavailable in any other file.
4. False
This might work for a time, but for some future version of your C++ compiler, this will stop working. This use of the keyword static in C++ is being phased out. It is being replaced by unnamed namespaces. Some future version of the C++ compiler will give an error when compiling such code. (Programmers say, “Some later version of the compiler will break your code.”)

Computer Science & Information Technology

You might also like to view...

The equivalent postfix expression for the infix expression a + b is + a b.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Web mail is an example of PaaS

Indicate whether the statement is true or false

Computer Science & Information Technology

State five kinds of information that can be represented with four bytes of information. Be creative, recall information discussed in previous chapters, and explain each kind in detail.

What will be an ideal response?

Computer Science & Information Technology

Transaction files:

A) are large files, containing all main information about an entity. B) are used to update master files and produce reports. C) cannot contain several record types. D) are always stored using indexed-sequential organization.

Computer Science & Information Technology