Deck 12: Separate Compilation and Namespaces
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/41
العب
ملء الشاشة (f)
Deck 12: Separate Compilation and Namespaces
1
The statement using namespace std and the statement using std::cin are the same.
False
2
ADTs should be defined and implemented in separate files
True
3
The global namespace and the unnamed namespace are the same.
False
4
Given the following code, what namespace does display3 belong to?
namespace ns1
{
void print);
void display1){};
}
namespace ns2
{
void print);
void display2){};
}
namespace
{
void display3);
}
int main)
{
using namespace ns1;
using namespace ns2;
display1);
display2);
return 0;
}
namespace
{
void display3)
{
}
}
namespace ns1
{
void print);
void display1){};
}
namespace ns2
{
void print);
void display2){};
}
namespace
{
void display3);
}
int main)
{
using namespace ns1;
using namespace ns2;
display1);
display2);
return 0;
}
namespace
{
void display3)
{
}
}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
5
If a name is defined in an unnamed namespace in a different compilation unit, it may not be accessed outside of that compilation unit.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
6
:: is called the ___________________
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
7
In a program with no user defined namespaces, all names are defined in the global namespace
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
8
All names are defined in some namespace
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
9
Classes must always be defined in separate files
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
10
The statement using namespace std is called _______________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
11
Given the following code, what namespace does display3 belong to?
namespace ns1
{
void print);
void display1){};
}
namespace ns2
{
void print);
void display2){};
}
void display3);
int main)
{
using namespace ns1;
using namespace ns2;
display1);
display2);
return 0;
}
void display3)
{
}
namespace ns1
{
void print);
void display1){};
}
namespace ns2
{
void print);
void display2){};
}
void display3);
int main)
{
using namespace ns1;
using namespace ns2;
display1);
display2);
return 0;
}
void display3)
{
}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
12
In the statement std::cin, what does the :: mean?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
13
The unspecified namespace is named _________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
14
The file that contains the definitions of the member functions of a class is called the ________________
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
15
In the implementation file for a class name myClass, you have the following statement:
void myClass::display)
{
//code here
}
What does the :: mean here?
void myClass::display)
{
//code here
}
What does the :: mean here?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
16
Names that are defined outside of a namespace are part of the unnamed namespace
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
17
cin and cout are part of the ________________ namespace.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
18
You may not use multiple namespaces in the same program.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
19
The statement using std::cin is called a ______________
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
20
All code is in some namespace.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
21
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
A) Is a syntax error
B) Applies to the entire file
C) Applies only to the first block
D) Hides all other namespace directives
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
22
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
A) The interface
B) The application
C) The Implementation
D) All files
E) B and C
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
23
Which file name will end in a .h?
A) Implementation
B) Application
C) All input files
D) Interface File
E) A and B
A) Implementation
B) Application
C) All input files
D) Interface File
E) A and B
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
24
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
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
25
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
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
26
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
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
27
cin and cout are defined in the _________ namespace
A) iostream
B) std
C) standard
D) global
A) iostream
B) std
C) standard
D) global
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
28
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
A) The interface
B) The application
C) The Implementation
D) All files
E) B and C
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
29
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
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
30
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"
A) #include
B) #include myfile.h
C) #include
D) #include "myfile.h"
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
31
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
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
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
A) compiling
B) assembling
C) linking
D) debugging
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
33
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
A) The interface
B) The application
C) The Implementation
D) All files
E) B and C
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
34
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
A) Implementation File
B) Application File
C) All input files
D) Interface File
E) A and B
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
35
The file that contains the definition of the class is called the _____________
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
36
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
A) Only to that block
B) From that point to the end of the file
C) Everywhere
D) Only if the namespace is std
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
37
All the code between
#ifndef MYCLASS_H
And
#endf
Is ____________ if MYCLASS_H is defined.
A) skipped
B) executed
C) compiled
D) debugged
#ifndef MYCLASS_H
And
#endf
Is ____________ if MYCLASS_H is defined.
A) skipped
B) executed
C) compiled
D) debugged
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
38
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
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
39
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
}
A) namespace student {
//code goes here
}
B) { namespace student
//code goes here
}
C) student namespace {
//code goes here
}
D) { student namespace
//code goes here
}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
40
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
A) the implementation file
B) the interface file
C) the application file
D) the specification file
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
41
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
A) global
B) std
C) class
D) unnamed
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck