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

1. Any global declarations or definitions can be placed in a namespace.
2. The include statement, #include “file.h” looks first in the system defined directory for file.h then, if the file is not found, it looks in the user’s current directory. (Windows PC and Macintosh users sometimes use “folder” for what I call “directory”.)
3. The include statement, #include looks in the system defined directory for the file, file.h. (Windows PC and Macintosh users sometimes use “folder” for what I call “directory”.)
4. A namespace is a collection of name definitions such as class definitions, variable definitions and function definitions used to permit the same name, or names, to be used both in a library and in your own code.


1. True
It is preferable to place definitions in one or more namespaces where the names may be managed so that name clashes may be prevented.
2. False
The question had it backwards. The #include “file.h” makes the preprocessor look in the user’s current directory first, then in the system defined directory.
3. True
Every system has one or more include directories that C++ compilers search for include files. The < > in #include signal the preprocessor to look in the system directory.
4. True
By qualifying a name from a namespace with the namespace name and the scope resolution operator, the client can specify the name from the namespace.

Computer Science & Information Technology

You might also like to view...

A good reason for overloading an operator is to enable it to

A) outperform its C language counterparts. B) be used with types defined by the programmer. C) operate on more operands than in its standard definition. D) operate on no operands. E) None of the above

Computer Science & Information Technology

A B-tree can be ____ in three ways: inorder, preorder, and postorder.

A. copied B. reversed C. traversed D. inversed

Computer Science & Information Technology

Which type of malicious software types will create multiple pop- ups on a computer?

A. Grayware B. Spyware C. Worms D. Adware

Computer Science & Information Technology

Which statement is false?

a. A List is a Collection. b. A List cannot contain duplicate elements. c. A List is sometimes called a sequence. d. Lists use zero-based indices.

Computer Science & Information Technology