Deck 10: Defining Classes

ملء الشاشة (f)
exit full mode
سؤال
The double colon ::)is known as the __________ operator.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
A structure can only be passed to a function as a call-by-value parameter
سؤال
A function may return a structure.
سؤال
Different class may not have member functions with the same name.
سؤال
All constructors for a class must be private.
سؤال
A struct variable is declared differently from a predefined type such as an int.
سؤال
A structure definition ends with the closing brace and a _________.
سؤال
Who can access private members in a class?
سؤال
Two different structure definitions may have the same member names.
سؤال
A class member function may be private.
سؤال
A derived class is more specific than its parent,or base class.
سؤال
Class data members are almost always public.
سؤال
The assignment operator may not be used with objects of a class.
سؤال
A member function that allows the user of the class to change the value of a private data type is called a ____________________.
سؤال
A structure variable is a collection of smaller values called ____________ values
سؤال
It is possible to have multiple private labels in a class definition.
سؤال
The keyword ________ defines a structure type definition.
سؤال
A member function that allows the user of the class to find out the value of a private data type is called a ___________________.
سؤال
When a structure contains another structure variable as one of its members,it is known as a ___________________.
سؤال
When several items variables or variables and functions)are grouped together into a single package,that is known as ______________.
سؤال
If you have a class named myPersonClass,which of the following correctly declare a constructor in the class definition?

A)myPersonClass::myPersonClass);
B)myPersonClass);
C)init);
D)cast);
سؤال
What is wrong with the following structure definition?
Struct MyStruct
{
Int size;
Float weight;
}

A)Nothing
B)Can not have mixed data types in a structure
C)missing semicolon
D)Braces are not needed.
سؤال
A member function that gets called automatically when an object of the class is declared is called a _______________.
سؤال
If class A is derived from class B,then B is a _______ of A.
سؤال
What can a constructor return? _______________
سؤال
You specify an individual member of a struct by using

A)the assignment operator
B)an ampersand
C)an underscore
D)The dot operator
سؤال
A Member function that allows the user of the class to see the value in a data member is known as

A)a mutator function
B)a mutation
C)a manipulator function
D)an accessor function
سؤال
To assign values to a structure variable,you use the

A)equals operator
B)assignment operator
C)extraction operator
D)less than operator
سؤال
The name of a constructor is _____________
سؤال
In a structure definition,the identifiers declared in the braces are called

A)classes
B)structs
C)member names
D)variables
سؤال
A class in which modifications to the implementation appear to be invisible to the user of the class is known as _________________.
سؤال
The constructor of a class that does not have any parameters is called a __________ constructor.
سؤال
If you have a class with a member function called displayostream& out),that will send the values in the class to the parameter stream,and you need to call that function from within another member function,how would you call it to print the data to the screen? ___________________________
سؤال
A member function that allow the user of the class to change the value in a data member is known as

A)a mutator function
B)a mutation
C)a manipulator function
D)an accessor function
سؤال
In the following class constructor definition,the part of the header starting with a single colon is called the ________________.
BankAccount::BankAccount): balance0),interest0.0)
سؤال
A member function of a class should be made private

A)always
B)only if it will never be used
C)if it will only be used by other members of the class
D)never,it is illegal to make a member function private.
سؤال
If you design a class with private data members,and do not provide mutators and accessors,then

A)The private data members can still be accessed from outside the class by using the & operator
B)The data can not be changed or viewed by anyone.
C)None of the above
D)A and B
سؤال
Which of the following is the correct function definition header for the getAge function which is a member of the Person class?

A)int getAge);
B)int getAge)
C)int Person:getAge)
D)int Person::getAge)
سؤال
When defining a class,the class should be composed of the kind of values a variable of the class can contain,and

A)member functions for that class
B)the keyword private
C)other class definitions
D)nothing else
سؤال
A class member function that automatically initializes the data members of a class is called

A)the init function
B)an operator
C)a constructor
D)a cast
سؤال
Member functions of a class

A)may not be in the private section
B)must be in the private section
C)may be in either section
D)can not be called in the main program
سؤال
In a class,all members are ____________ by default

A)public
B)private
C)global
D)all of the above
سؤال
Developing an ADT means that the user of your class does not have to know the details about how the class is implemented.This is known as

A)interface
B)implementation
C)testing and debugging
D)information hiding
سؤال
Data members or member functions of a class that are declared to be private may

A)only be accessed by the main program
B)only be accessed by members of the class
C)not be accessed by the class
D)are considered to be global variables
سؤال
In a struct,all members are ____________ by default

A)public
B)private
C)global
D)all of the above
سؤال
A data type consisting of data members and operations on those members which can be used by a programmer without knowing the implementation details of the data type is called

A)an abstract definition type
B)an available data type
C)an abstract data type
D)a primitive data type
سؤال
Which of the following function declarations will accept either cout or a file stream object as its argument?

A)void output fstream &outFile);
B)void output ofstream &outFile);
C)void output ostream &outFile);
D)void output iostream &outFile);
سؤال
Which part of the ADT tells the programmer using it how to use it?

A)the implementation
B)the interface
C)the abstractness
D)the scope resolution
سؤال
If you are designing a class for an ADT,you can tell if the class is an ADT if

A)when you change the implementation of the class,none of the rest of the program needs to change.
B)when you change the interface of the class,nothing else needs to change.
C)you change the privte part and the rest of the program using the ADT does not compile.
D)everything must be changed.
سؤال
A derived class has access to

A)the private functions and variables of its ancestor classes
B)the public functions and variables of its ancestor classes
C)only the functions and variables defined it its class
D)none of the above
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/50
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 10: Defining Classes
1
The double colon ::)is known as the __________ operator.
scope resolution operator
2
A structure can only be passed to a function as a call-by-value parameter
False
3
A function may return a structure.
True
4
Different class may not have member functions with the same name.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
5
All constructors for a class must be private.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
6
A struct variable is declared differently from a predefined type such as an int.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
7
A structure definition ends with the closing brace and a _________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
8
Who can access private members in a class?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
9
Two different structure definitions may have the same member names.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
10
A class member function may be private.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
11
A derived class is more specific than its parent,or base class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
12
Class data members are almost always public.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
13
The assignment operator may not be used with objects of a class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
14
A member function that allows the user of the class to change the value of a private data type is called a ____________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
15
A structure variable is a collection of smaller values called ____________ values
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
16
It is possible to have multiple private labels in a class definition.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
17
The keyword ________ defines a structure type definition.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
18
A member function that allows the user of the class to find out the value of a private data type is called a ___________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
19
When a structure contains another structure variable as one of its members,it is known as a ___________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
20
When several items variables or variables and functions)are grouped together into a single package,that is known as ______________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
21
If you have a class named myPersonClass,which of the following correctly declare a constructor in the class definition?

A)myPersonClass::myPersonClass);
B)myPersonClass);
C)init);
D)cast);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
22
What is wrong with the following structure definition?
Struct MyStruct
{
Int size;
Float weight;
}

A)Nothing
B)Can not have mixed data types in a structure
C)missing semicolon
D)Braces are not needed.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
23
A member function that gets called automatically when an object of the class is declared is called a _______________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
24
If class A is derived from class B,then B is a _______ of A.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
25
What can a constructor return? _______________
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
26
You specify an individual member of a struct by using

A)the assignment operator
B)an ampersand
C)an underscore
D)The dot operator
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
27
A Member function that allows the user of the class to see the value in a data member is known as

A)a mutator function
B)a mutation
C)a manipulator function
D)an accessor function
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
28
To assign values to a structure variable,you use the

A)equals operator
B)assignment operator
C)extraction operator
D)less than operator
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
29
The name of a constructor is _____________
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
30
In a structure definition,the identifiers declared in the braces are called

A)classes
B)structs
C)member names
D)variables
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
31
A class in which modifications to the implementation appear to be invisible to the user of the class is known as _________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
32
The constructor of a class that does not have any parameters is called a __________ constructor.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
33
If you have a class with a member function called displayostream& out),that will send the values in the class to the parameter stream,and you need to call that function from within another member function,how would you call it to print the data to the screen? ___________________________
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
34
A member function that allow the user of the class to change the value in a data member is known as

A)a mutator function
B)a mutation
C)a manipulator function
D)an accessor function
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
35
In the following class constructor definition,the part of the header starting with a single colon is called the ________________.
BankAccount::BankAccount): balance0),interest0.0)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
36
A member function of a class should be made private

A)always
B)only if it will never be used
C)if it will only be used by other members of the class
D)never,it is illegal to make a member function private.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
37
If you design a class with private data members,and do not provide mutators and accessors,then

A)The private data members can still be accessed from outside the class by using the & operator
B)The data can not be changed or viewed by anyone.
C)None of the above
D)A and B
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
38
Which of the following is the correct function definition header for the getAge function which is a member of the Person class?

A)int getAge);
B)int getAge)
C)int Person:getAge)
D)int Person::getAge)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
39
When defining a class,the class should be composed of the kind of values a variable of the class can contain,and

A)member functions for that class
B)the keyword private
C)other class definitions
D)nothing else
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
40
A class member function that automatically initializes the data members of a class is called

A)the init function
B)an operator
C)a constructor
D)a cast
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
41
Member functions of a class

A)may not be in the private section
B)must be in the private section
C)may be in either section
D)can not be called in the main program
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
42
In a class,all members are ____________ by default

A)public
B)private
C)global
D)all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
43
Developing an ADT means that the user of your class does not have to know the details about how the class is implemented.This is known as

A)interface
B)implementation
C)testing and debugging
D)information hiding
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
44
Data members or member functions of a class that are declared to be private may

A)only be accessed by the main program
B)only be accessed by members of the class
C)not be accessed by the class
D)are considered to be global variables
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
45
In a struct,all members are ____________ by default

A)public
B)private
C)global
D)all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
46
A data type consisting of data members and operations on those members which can be used by a programmer without knowing the implementation details of the data type is called

A)an abstract definition type
B)an available data type
C)an abstract data type
D)a primitive data type
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
47
Which of the following function declarations will accept either cout or a file stream object as its argument?

A)void output fstream &outFile);
B)void output ofstream &outFile);
C)void output ostream &outFile);
D)void output iostream &outFile);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
48
Which part of the ADT tells the programmer using it how to use it?

A)the implementation
B)the interface
C)the abstractness
D)the scope resolution
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
49
If you are designing a class for an ADT,you can tell if the class is an ADT if

A)when you change the implementation of the class,none of the rest of the program needs to change.
B)when you change the interface of the class,nothing else needs to change.
C)you change the privte part and the rest of the program using the ADT does not compile.
D)everything must be changed.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
50
A derived class has access to

A)the private functions and variables of its ancestor classes
B)the public functions and variables of its ancestor classes
C)only the functions and variables defined it its class
D)none of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.