Deck 12: Separate Compilation and Namespaces

Full screen (f)
exit full mode
Question
The statement using namespace std is called _______________.
Use Space or
up arrow
down arrow
to flip the card.
Question
In the implementation file for a class name myClass,you have the following statement:
void myClass::display)
{
//code here
}
What does the :: mean here?
Question
The statement using namespace std and the statement using std::cin are the same.
Question
In order to make a user-defined ADT available that is defined in the file myfile.h,you would

A)#include
B)#include myfile.h
C)#include
D)#include "myfile.h"
Question
In the statement std::cin,what does the :: mean?
Question
You may not use multiple namespaces in the same program.
Question
The statement using std::cin is called a ______________
Question
The file that contains the main portion of your program is called

A)the implementation file
B)the interface file
C)the application file
D)the specification file
Question
The unspecified namespace is named _________.
Question
The file that contains the definition of the class is called the _____________
Question
ADTs should be defined and implemented in separate files
Question
The global namespace and the unnamed namespace are the same.
Question
If a name is defined in an unnamed namespace in a different compilation unit,it may not be accessed outside of that compilation unit.
Question
Classes must always be defined in separate files
Question
cin and cout are part of the ________________ namespace.
Question
Names that are defined outside of a namespace are part of the unnamed namespace
Question
All code is in some namespace.
Question
The file that contains the definitions of the member functions of a class is called the ________________
Question
In a program with no user defined namespaces,all names are defined in the global namespace
Question
All names are defined in some namespace
Question
If you have a class defined in separate files,and change the way a member function is defined the body of the function),which files need to be re-compiled?

A)The interface
B)The application
C)The Implementation
D)All files
E)B and C
Question
We use the #ifndef,#define,and #endif

A)to prevent multiple definitions of a class
B)when we use separate files
C)whenever we use a class
D)none of the above
E)A and B
Question
Why will the following code not compile?
Namespace ns1
{
Void print);
Void display1){};
}
Namespace ns2
{
Void print);
Void display2){};
}
Int main)
{
Using namespace ns1;
Using namespace ns2;
Display1);
Display2);
Print);
Return 0;
}

A)The call to print is ambiguous
B)We have not included the iostream library
C)We have not used namespace std
D)It will compile
Question
Which file name will end in a .cpp?

A)Implementation File
B)Application File
C)All input files
D)Interface File
E)A and B
Question
In order to create a namespace called student,you use

A)namespace student {
//code goes here
}
B){ namespace student
//code goes here
}
C)student namespace {
//code goes here
}
D){ student namespace
//code goes here
}
Question
The identifier used in the #ifndef directive should be

A)the name of the class in upper case letters
B)Your name in upper case letters
C)The file name in uppercase letters with an _ instead of a .)
D)whatever you want it to be
Question
Which file name will end in a .h?

A)Implementation
B)Application
C)All input files
D)Interface File
E)A and B
Question
In order to hide functions that are defined in the implementation file,they should be part of the ______________ namespace.

A)global
B)std
C)class
D)unnamed
Question
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
Question
cin and cout are defined in the _________ namespace

A)iostream
B)std
C)standard
D)global
Question
All the code between
#ifndef MYCLASS_H
And
#endf
Is ____________ if MYCLASS_H is defined.

A)skipped
B)executed
C)compiled
D)debugged
Question
Connecting the application and implementation files together to form an executable file is called

A)compiling
B)assembling
C)linking
D)debugging
Question
If you have a class defined in separate files,and change the main program,which files need to be re-compiled?

A)The interface
B)The application
C)The Implementation
D)All files
E)B and C
Question
What is the difference between an ADT and a class in C++?

A)In an ADT,the user does not have access to the implementation details
B)In an ADT,the user can change the implementation details
C)There is no difference
D)A class must always be in a separate file
Question
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
Question
If you have a class defined in separate files,and change the way a class is defined,which files need to be re-compiled?

A)The interface
B)The application
C)The Implementation
D)All files
E)B and C
Question
A using directive that is at the start of the file

A)Is a syntax error
B)Applies to the entire file
C)Applies only to the first block
D)Hides all other namespace directives
Question
A using directive that appears inside a set of braces applies

A)Only to that block
B)From that point to the end of the file
C)Everywhere
D)Only if the namespace is std
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/38
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 12: Separate Compilation and Namespaces
1
The statement using namespace std is called _______________.
a using directive
2
In the implementation file for a class name myClass,you have the following statement:
void myClass::display)
{
//code here
}
What does the :: mean here?
that display is part of the class myClass
3
The statement using namespace std and the statement using std::cin are the same.
False
4
In order to make a user-defined ADT available that is defined in the file myfile.h,you would

A)#include
B)#include myfile.h
C)#include
D)#include "myfile.h"
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
5
In the statement std::cin,what does the :: mean?
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
6
You may not use multiple namespaces in the same program.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
7
The statement using std::cin is called a ______________
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
8
The file that contains the main portion of your program is called

A)the implementation file
B)the interface file
C)the application file
D)the specification file
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
9
The unspecified namespace is named _________.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
10
The file that contains the definition of the class is called the _____________
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
11
ADTs should be defined and implemented in separate files
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
12
The global namespace and the unnamed namespace are the same.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
13
If a name is defined in an unnamed namespace in a different compilation unit,it may not be accessed outside of that compilation unit.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
14
Classes must always be defined in separate files
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
15
cin and cout are part of the ________________ namespace.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
16
Names that are defined outside of a namespace are part of the unnamed namespace
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
17
All code is in some namespace.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
18
The file that contains the definitions of the member functions of a class is called the ________________
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
19
In a program with no user defined namespaces,all names are defined in the global namespace
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
20
All names are defined in some namespace
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
21
If you have a class defined in separate files,and change the way a member function is defined the body of the function),which files need to be re-compiled?

A)The interface
B)The application
C)The Implementation
D)All files
E)B and C
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
22
We use the #ifndef,#define,and #endif

A)to prevent multiple definitions of a class
B)when we use separate files
C)whenever we use a class
D)none of the above
E)A and B
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
23
Why will the following code not compile?
Namespace ns1
{
Void print);
Void display1){};
}
Namespace ns2
{
Void print);
Void display2){};
}
Int main)
{
Using namespace ns1;
Using namespace ns2;
Display1);
Display2);
Print);
Return 0;
}

A)The call to print is ambiguous
B)We have not included the iostream library
C)We have not used namespace std
D)It will compile
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
24
Which file name will end in a .cpp?

A)Implementation File
B)Application File
C)All input files
D)Interface File
E)A and B
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
25
In order to create a namespace called student,you use

A)namespace student {
//code goes here
}
B){ namespace student
//code goes here
}
C)student namespace {
//code goes here
}
D){ student namespace
//code goes here
}
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
26
The identifier used in the #ifndef directive should be

A)the name of the class in upper case letters
B)Your name in upper case letters
C)The file name in uppercase letters with an _ instead of a .)
D)whatever you want it to be
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
27
Which file name will end in a .h?

A)Implementation
B)Application
C)All input files
D)Interface File
E)A and B
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
28
In order to hide functions that are defined in the implementation file,they should be part of the ______________ namespace.

A)global
B)std
C)class
D)unnamed
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
29
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
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
30
cin and cout are defined in the _________ namespace

A)iostream
B)std
C)standard
D)global
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
31
All the code between
#ifndef MYCLASS_H
And
#endf
Is ____________ if MYCLASS_H is defined.

A)skipped
B)executed
C)compiled
D)debugged
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
32
Connecting the application and implementation files together to form an executable file is called

A)compiling
B)assembling
C)linking
D)debugging
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
33
If you have a class defined in separate files,and change the main program,which files need to be re-compiled?

A)The interface
B)The application
C)The Implementation
D)All files
E)B and C
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
34
What is the difference between an ADT and a class in C++?

A)In an ADT,the user does not have access to the implementation details
B)In an ADT,the user can change the implementation details
C)There is no difference
D)A class must always be in a separate file
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
35
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
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
36
If you have a class defined in separate files,and change the way a class is defined,which files need to be re-compiled?

A)The interface
B)The application
C)The Implementation
D)All files
E)B and C
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
37
A using directive that is at the start of the file

A)Is a syntax error
B)Applies to the entire file
C)Applies only to the first block
D)Hides all other namespace directives
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
38
A using directive that appears inside a set of braces applies

A)Only to that block
B)From that point to the end of the file
C)Everywhere
D)Only if the namespace is std
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 38 flashcards in this deck.