CS52 Chapter 12 – Quiz Latest Update
A namespace is
a. a collection of name definitions
b. using std
c. used to distinguish between identical names
d. All of the above
e. A and C - ANSWER e. A and C
A using directive that appears inside a set of braces applies - ANSWER
Only to that block
In order to create a namespace called student, you use " - ANSWER
namespace student
{
//code goes here
}
"
In order to hide functions that are defined in the implementation file, they
should be part of the ________ namespace. - ANSWER unnamed
All code is in some namespace. - ANSWER TRUE
ADTs should be in separate files because
, a. This promotes information hiding
b. This promotes data abstraction
c. This promotes software reusability
d. This results in faster recompilation
e. All of the above - ANSWER e. All of the above
If you want to only use cin and cout (but no other names) from the std
namespace, you would
a. using std::cin;
using std::cout;
b. not be able to do it.
c. cin and cout are not in the std namespace
d. always have to say std::cin and std::cout
e. Either A or D - ANSWER e. Either A or D
A using directive that appears inside a set of braces applies - ANSWER
only to that block
What is the difference between an ADT and a class in C++? - ANSWER In
an ADT, the user does not have access to the implementation details.
In order to make a user-defined ADT available that is defined in the file
myfile.h, you would - ANSWER #include "myfile.h"
A using directive that is at the start of the file - ANSWER applies to the
entire file.
If you have a class defined in separate files, and change the way a class is
defined, which files need to be re-compiled? - ANSWER The
Implementation
A namespace is
a. a collection of name definitions
b. using std
c. used to distinguish between identical names
d. All of the above
e. A and C - ANSWER e. A and C
A using directive that appears inside a set of braces applies - ANSWER
Only to that block
In order to create a namespace called student, you use " - ANSWER
namespace student
{
//code goes here
}
"
In order to hide functions that are defined in the implementation file, they
should be part of the ________ namespace. - ANSWER unnamed
All code is in some namespace. - ANSWER TRUE
ADTs should be in separate files because
, a. This promotes information hiding
b. This promotes data abstraction
c. This promotes software reusability
d. This results in faster recompilation
e. All of the above - ANSWER e. All of the above
If you want to only use cin and cout (but no other names) from the std
namespace, you would
a. using std::cin;
using std::cout;
b. not be able to do it.
c. cin and cout are not in the std namespace
d. always have to say std::cin and std::cout
e. Either A or D - ANSWER e. Either A or D
A using directive that appears inside a set of braces applies - ANSWER
only to that block
What is the difference between an ADT and a class in C++? - ANSWER In
an ADT, the user does not have access to the implementation details.
In order to make a user-defined ADT available that is defined in the file
myfile.h, you would - ANSWER #include "myfile.h"
A using directive that is at the start of the file - ANSWER applies to the
entire file.
If you have a class defined in separate files, and change the way a class is
defined, which files need to be re-compiled? - ANSWER The
Implementation