Deck 7: Using Classes

ملء الشاشة (f)
exit full mode
سؤال
When a class field is ____, only one memory location is allocated, no matter how many objects of the class you instantiate.

A) const
B) static
C) void
D) private
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
Programmers sometimes refer to ____ as an example of using a "black box."

A) polymorphism
B) encapsulation
C) instantiation
D) abstraction
سؤال
You ____ assign a value to a field in a class definition.

A) can
B) cannot
C) should
D) should not
سؤال
To ____ an object is to declare or create it.

A) instantiate
B) encapsulate
C) abstract
D) overload
سؤال
The access modifier ____ means a class member cannot be accessed using any statements in any functions that are not also part of the class.

A) public
B) private
C) protected
D) static
سؤال
You must use both the class name and the ____ operator when you implement a member function, because they tie the function to the class and allow every instantiated object to use the function name.

A) address
B) dot
C) scope resolution
D) pointer-to-member
سؤال
The scope resolution operator is ____.

A) &
B) ::
C) *
D) ->
سؤال
To use the function displayStudentData() of the object aSophmore that belongs to the class Student , the correct syntax is ____.

A) aSophmore.displayStudentData();
B) Student.displayStudentData();
C) aSophmore::displayStudentData();
D) *aSophmore.displayStudentData();
سؤال
C++ is an extensible language.
سؤال
The ____ section of a class contains the class name, variables (attributes), and function prototypes.

A) header
B) definition
C) declaration
D) implementation
سؤال
A C++ ____ is an instantiation of a class that can contain both data members and methods.

A) variable
B) field
C) structure
D) object
سؤال
A(n) ____ language is one to which you can add your own data types.

A) low-level
B) high-level
C) extensible
D) object-oriented
سؤال
You may use the this pointer instead of the class name and scope resolution operator when a local variable and a field name conflict.
سؤال
All members of a class share a single storage location for a static data member of that same class.
سؤال
When you create a class, you usually make data items public.
سؤال
The value of a static field cannot be changed.
سؤال
When you create a class, you usually make the functions private.
سؤال
To ____ components is to contain them.

A) instantiate
B) abstract
C) declare
D) encapsulate
سؤال
An abstract data type is a type defined by C++.
سؤال
A class is a new data type you create that is more complex than the basic data types.
سؤال
Consider the following class:
class Student
{
private:
int idNum;
string lastName;
double gradePointAverage;
};
Add a public function void displayStudentData() to the class definition and then write an implementation for the function.
سؤال
Why should you make class data fields private and not public?
سؤال
A function that is a user of your class is a class ____________________.
سؤال
The ______________________________ is constructed by using a dash followed by a right-angle bracket (or greater-than sign).
سؤال
When may it be a good idea to make data public in a class?
سؤال
____ variables are sometimes called class variables, class fields, or class-wide fields.

A) Public
B) Private
C) Constant
D) Static
سؤال
The only type of class member function that does not have a this pointer is a ____ member function.

A) const
B) static
C) public
D) private
سؤال
Static functions ____ access non-static variables.

A) can
B) cannot
C) should
D) should not
سؤال
Write a class with three private fields and then modify it so that the fields are public. Show both versions.
سؤال
The variable ____ is an example of a correct use of the this pointer.

A) *this.employeeIdNum
B) (*this).employeeIdNum
C) *(this.employeeIdNum)
D) *(this).employeeIdNum
سؤال
Conventionally, object names begin with a(n) ____________________ letter.
سؤال
When you use an object, the ____ operator, and a non-static function of the object's class, you actually pass the specific object's address to the function as an unseen argument.

A) scope resolution
B) conditional
C) dot
D) address
سؤال
When you do not want to declare an object, you can still access a static , class-wide field by using a function that is ____.

A) static
B) const
C) public
D) private
سؤال
The ____ pointer is automatically supplied every time you call a non-static member function of a class.

A) this
B) super
C) const
D) void
سؤال
Conventionally, class names begin with a(n) ____________________ letter.
سؤال
ADT stands for ____________________.
سؤال
____________________ variables belong to the class, and you can use them even if you never instantiate an object.
سؤال
When you create an object, a block of ____________________ is set aside for the data members.
سؤال
The ____ operator is the pointer-to-member operator.

A) ::
B) &
C) *
D) ->
سؤال
A ____ class member exists, even when you have not instantiated any objects of the class.

A) public
B) private
C) static
D) const
سؤال
Can you modify the this pointer? Why or why not?
سؤال
What is the difference in memory allocation between a static and a non-static variable?
سؤال
Write a class declaration that has three private fields and three functions that can be used to assign values to each of the data fields of the class. Write the implementation of one of the functions.
سؤال
In what situation would you want to use the this pointer?
سؤال
Match between columns
allows the same operation to be carried out differently depending on the object
implementation section
allows the same operation to be carried out differently depending on the object
class variable
allows the same operation to be carried out differently depending on the object
abstract data type
allows the same operation to be carried out differently depending on the object
pointer-to-member operator
allows the same operation to be carried out differently depending on the object
class
allows the same operation to be carried out differently depending on the object
this pointer
allows the same operation to be carried out differently depending on the object
interface
allows the same operation to be carried out differently depending on the object
polymorphism
allows the same operation to be carried out differently depending on the object
access modifier
سؤال
Match between columns
looks like an arrow
implementation section
looks like an arrow
class variable
looks like an arrow
abstract data type
looks like an arrow
pointer-to-member operator
looks like an arrow
class
looks like an arrow
this pointer
looks like an arrow
interface
looks like an arrow
polymorphism
looks like an arrow
access modifier
سؤال
Match between columns
holds the memory address of the current object that is using a class function
implementation section
holds the memory address of the current object that is using a class function
class variable
holds the memory address of the current object that is using a class function
abstract data type
holds the memory address of the current object that is using a class function
pointer-to-member operator
holds the memory address of the current object that is using a class function
class
holds the memory address of the current object that is using a class function
this pointer
holds the memory address of the current object that is using a class function
interface
holds the memory address of the current object that is using a class function
polymorphism
holds the memory address of the current object that is using a class function
access modifier
سؤال
Match between columns
field that does not belong to a specific object
implementation section
field that does not belong to a specific object
class variable
field that does not belong to a specific object
abstract data type
field that does not belong to a specific object
pointer-to-member operator
field that does not belong to a specific object
class
field that does not belong to a specific object
this pointer
field that does not belong to a specific object
interface
field that does not belong to a specific object
polymorphism
field that does not belong to a specific object
access modifier
سؤال
Match between columns
contains the functions of a class
implementation section
contains the functions of a class
class variable
contains the functions of a class
abstract data type
contains the functions of a class
pointer-to-member operator
contains the functions of a class
class
contains the functions of a class
this pointer
contains the functions of a class
interface
contains the functions of a class
polymorphism
contains the functions of a class
access modifier
سؤال
Should static fields always be constant? Explain your answer.
سؤال
Match between columns
intercedes between you and the inner workings of an object
implementation section
intercedes between you and the inner workings of an object
class variable
intercedes between you and the inner workings of an object
abstract data type
intercedes between you and the inner workings of an object
pointer-to-member operator
intercedes between you and the inner workings of an object
class
intercedes between you and the inner workings of an object
this pointer
intercedes between you and the inner workings of an object
interface
intercedes between you and the inner workings of an object
polymorphism
intercedes between you and the inner workings of an object
access modifier
سؤال
Match between columns
assigns accessibility to the declared variables that follow it
implementation section
assigns accessibility to the declared variables that follow it
class variable
assigns accessibility to the declared variables that follow it
abstract data type
assigns accessibility to the declared variables that follow it
pointer-to-member operator
assigns accessibility to the declared variables that follow it
class
assigns accessibility to the declared variables that follow it
this pointer
assigns accessibility to the declared variables that follow it
interface
assigns accessibility to the declared variables that follow it
polymorphism
assigns accessibility to the declared variables that follow it
access modifier
سؤال
Consider the function shown below:
void Customer::setBalance(double balance)
{
Customer::balance = balance;
}
Why is the scope resolution operator needed within the function body?
سؤال
Match between columns
a type you define
implementation section
a type you define
class variable
a type you define
abstract data type
a type you define
pointer-to-member operator
a type you define
class
a type you define
this pointer
a type you define
interface
a type you define
polymorphism
a type you define
access modifier
سؤال
Should you use a static class member with an object name or with the class name?
سؤال
Match between columns
category of objects
implementation section
category of objects
class variable
category of objects
abstract data type
category of objects
pointer-to-member operator
category of objects
class
category of objects
this pointer
category of objects
interface
category of objects
polymorphism
category of objects
access modifier
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/56
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 7: Using Classes
1
When a class field is ____, only one memory location is allocated, no matter how many objects of the class you instantiate.

A) const
B) static
C) void
D) private
B
2
Programmers sometimes refer to ____ as an example of using a "black box."

A) polymorphism
B) encapsulation
C) instantiation
D) abstraction
B
3
You ____ assign a value to a field in a class definition.

A) can
B) cannot
C) should
D) should not
B
4
To ____ an object is to declare or create it.

A) instantiate
B) encapsulate
C) abstract
D) overload
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
5
The access modifier ____ means a class member cannot be accessed using any statements in any functions that are not also part of the class.

A) public
B) private
C) protected
D) static
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
6
You must use both the class name and the ____ operator when you implement a member function, because they tie the function to the class and allow every instantiated object to use the function name.

A) address
B) dot
C) scope resolution
D) pointer-to-member
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
7
The scope resolution operator is ____.

A) &
B) ::
C) *
D) ->
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
8
To use the function displayStudentData() of the object aSophmore that belongs to the class Student , the correct syntax is ____.

A) aSophmore.displayStudentData();
B) Student.displayStudentData();
C) aSophmore::displayStudentData();
D) *aSophmore.displayStudentData();
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
9
C++ is an extensible language.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
10
The ____ section of a class contains the class name, variables (attributes), and function prototypes.

A) header
B) definition
C) declaration
D) implementation
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
11
A C++ ____ is an instantiation of a class that can contain both data members and methods.

A) variable
B) field
C) structure
D) object
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
12
A(n) ____ language is one to which you can add your own data types.

A) low-level
B) high-level
C) extensible
D) object-oriented
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
13
You may use the this pointer instead of the class name and scope resolution operator when a local variable and a field name conflict.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
14
All members of a class share a single storage location for a static data member of that same class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
15
When you create a class, you usually make data items public.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
16
The value of a static field cannot be changed.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
17
When you create a class, you usually make the functions private.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
18
To ____ components is to contain them.

A) instantiate
B) abstract
C) declare
D) encapsulate
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
19
An abstract data type is a type defined by C++.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
20
A class is a new data type you create that is more complex than the basic data types.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
21
Consider the following class:
class Student
{
private:
int idNum;
string lastName;
double gradePointAverage;
};
Add a public function void displayStudentData() to the class definition and then write an implementation for the function.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
22
Why should you make class data fields private and not public?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
23
A function that is a user of your class is a class ____________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
24
The ______________________________ is constructed by using a dash followed by a right-angle bracket (or greater-than sign).
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
25
When may it be a good idea to make data public in a class?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
26
____ variables are sometimes called class variables, class fields, or class-wide fields.

A) Public
B) Private
C) Constant
D) Static
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
27
The only type of class member function that does not have a this pointer is a ____ member function.

A) const
B) static
C) public
D) private
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
28
Static functions ____ access non-static variables.

A) can
B) cannot
C) should
D) should not
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
29
Write a class with three private fields and then modify it so that the fields are public. Show both versions.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
30
The variable ____ is an example of a correct use of the this pointer.

A) *this.employeeIdNum
B) (*this).employeeIdNum
C) *(this.employeeIdNum)
D) *(this).employeeIdNum
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
31
Conventionally, object names begin with a(n) ____________________ letter.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
32
When you use an object, the ____ operator, and a non-static function of the object's class, you actually pass the specific object's address to the function as an unseen argument.

A) scope resolution
B) conditional
C) dot
D) address
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
33
When you do not want to declare an object, you can still access a static , class-wide field by using a function that is ____.

A) static
B) const
C) public
D) private
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
34
The ____ pointer is automatically supplied every time you call a non-static member function of a class.

A) this
B) super
C) const
D) void
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
35
Conventionally, class names begin with a(n) ____________________ letter.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
36
ADT stands for ____________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
37
____________________ variables belong to the class, and you can use them even if you never instantiate an object.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
38
When you create an object, a block of ____________________ is set aside for the data members.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
39
The ____ operator is the pointer-to-member operator.

A) ::
B) &
C) *
D) ->
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
40
A ____ class member exists, even when you have not instantiated any objects of the class.

A) public
B) private
C) static
D) const
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
41
Can you modify the this pointer? Why or why not?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
42
What is the difference in memory allocation between a static and a non-static variable?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
43
Write a class declaration that has three private fields and three functions that can be used to assign values to each of the data fields of the class. Write the implementation of one of the functions.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
44
In what situation would you want to use the this pointer?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
45
Match between columns
allows the same operation to be carried out differently depending on the object
implementation section
allows the same operation to be carried out differently depending on the object
class variable
allows the same operation to be carried out differently depending on the object
abstract data type
allows the same operation to be carried out differently depending on the object
pointer-to-member operator
allows the same operation to be carried out differently depending on the object
class
allows the same operation to be carried out differently depending on the object
this pointer
allows the same operation to be carried out differently depending on the object
interface
allows the same operation to be carried out differently depending on the object
polymorphism
allows the same operation to be carried out differently depending on the object
access modifier
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
46
Match between columns
looks like an arrow
implementation section
looks like an arrow
class variable
looks like an arrow
abstract data type
looks like an arrow
pointer-to-member operator
looks like an arrow
class
looks like an arrow
this pointer
looks like an arrow
interface
looks like an arrow
polymorphism
looks like an arrow
access modifier
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
47
Match between columns
holds the memory address of the current object that is using a class function
implementation section
holds the memory address of the current object that is using a class function
class variable
holds the memory address of the current object that is using a class function
abstract data type
holds the memory address of the current object that is using a class function
pointer-to-member operator
holds the memory address of the current object that is using a class function
class
holds the memory address of the current object that is using a class function
this pointer
holds the memory address of the current object that is using a class function
interface
holds the memory address of the current object that is using a class function
polymorphism
holds the memory address of the current object that is using a class function
access modifier
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
48
Match between columns
field that does not belong to a specific object
implementation section
field that does not belong to a specific object
class variable
field that does not belong to a specific object
abstract data type
field that does not belong to a specific object
pointer-to-member operator
field that does not belong to a specific object
class
field that does not belong to a specific object
this pointer
field that does not belong to a specific object
interface
field that does not belong to a specific object
polymorphism
field that does not belong to a specific object
access modifier
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
49
Match between columns
contains the functions of a class
implementation section
contains the functions of a class
class variable
contains the functions of a class
abstract data type
contains the functions of a class
pointer-to-member operator
contains the functions of a class
class
contains the functions of a class
this pointer
contains the functions of a class
interface
contains the functions of a class
polymorphism
contains the functions of a class
access modifier
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
50
Should static fields always be constant? Explain your answer.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
51
Match between columns
intercedes between you and the inner workings of an object
implementation section
intercedes between you and the inner workings of an object
class variable
intercedes between you and the inner workings of an object
abstract data type
intercedes between you and the inner workings of an object
pointer-to-member operator
intercedes between you and the inner workings of an object
class
intercedes between you and the inner workings of an object
this pointer
intercedes between you and the inner workings of an object
interface
intercedes between you and the inner workings of an object
polymorphism
intercedes between you and the inner workings of an object
access modifier
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
52
Match between columns
assigns accessibility to the declared variables that follow it
implementation section
assigns accessibility to the declared variables that follow it
class variable
assigns accessibility to the declared variables that follow it
abstract data type
assigns accessibility to the declared variables that follow it
pointer-to-member operator
assigns accessibility to the declared variables that follow it
class
assigns accessibility to the declared variables that follow it
this pointer
assigns accessibility to the declared variables that follow it
interface
assigns accessibility to the declared variables that follow it
polymorphism
assigns accessibility to the declared variables that follow it
access modifier
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
53
Consider the function shown below:
void Customer::setBalance(double balance)
{
Customer::balance = balance;
}
Why is the scope resolution operator needed within the function body?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
54
Match between columns
a type you define
implementation section
a type you define
class variable
a type you define
abstract data type
a type you define
pointer-to-member operator
a type you define
class
a type you define
this pointer
a type you define
interface
a type you define
polymorphism
a type you define
access modifier
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
55
Should you use a static class member with an object name or with the class name?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
56
Match between columns
category of objects
implementation section
category of objects
class variable
category of objects
abstract data type
category of objects
pointer-to-member operator
category of objects
class
category of objects
this pointer
category of objects
interface
category of objects
polymorphism
category of objects
access modifier
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.