Deck 12: Pointers, Classes, Virtual Functions, Abstract Classes, and Lists

ملء الشاشة (f)
exit full mode
سؤال
In C++,the dot operator has a lower precedence than the dereferencing operator.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
What is the output of the following code? int *p;
Int x;
X = 76;
P = &x;
*p = 43;
Cout << x << "," << *p << endl;

A) 76, 76
B) 76, 43
C) 43, 76
D) 43, 43
سؤال
What is the output of the following code? int *p;
Int x;
X = 12;
P = &x;
Cout << x << ",";
*p = 81;
Cout << *p << endl;

A) 12, 12
B) 12, 81
C) 81, 12
D) 81, 81
سؤال
In the statement
int* p,q;
p and q are pointer variables.
سؤال
The dereferencing operator is also known as the indirection operator and refers to the object to which its operand points.
سؤال
Variables that are created during program execution are called static variables.
سؤال
In C++,you declare a pointer variable by using the ____ symbol.

A) *
B) &
C) #
D) @
سؤال
In C++,pointer variables are declared using the reserved word pointer.
سؤال
Which of the following can be used to initialize a pointer variable?

A) 1
B) NULL
C) "0"
D) '0'
سؤال
If p is a pointer variable,the statement p = p + 1; is valid in C++.
سؤال
A pointer variable is a variable whose content is a memory address.
سؤال
The code int *p; declares p to be a(n)____ variable.

A) new
B) num
C) pointer
D) address
سؤال
The C++ operator ____ is used to destroy dynamic variables.

A) destroy
B) delete
C) *
D) ~
سؤال
What is the output of the following statements? int x = 33;
Int *q;
Q = &x;
Cout << *q << endl;

A) NULL
B) 0
C) 3
D) 33
سؤال
What is the value of x after the following statements execute? int x = 25;
Int *p;
P = &x;
*p = 46;

A) NULL
B) 0
C) 25
D) 46
سؤال
A list is a collection of elements of the same type.
سؤال
In C++,____ is called the address of operator.

A) &
B) *
C) #
D) ->
سؤال
A memory leak is an unused memory space that cannot be allocated.
سؤال
The C++ operator ____ is used to create dynamic variables.

A) dynamic
B) new
C) virtual
D) dereferencing
سؤال
Given the declaration
int *p;
The statement
p = new int[50];
dynamically allocates an array of 50 components of type int and p contains the base address of the array.
سؤال
The ____ operator can be used to return the address of a private data member of a class.

A) dereferencing
B) destructor
C) address of
D) member access
سؤال
Consider the following statement: ptrMemberVarType objectThree(objectOne);
The values of the member variables of objectOne are being copied into the corresponding member variables of objectThree.This initialization is called the ____.

A) member-wise assignment
B) default assignment
C) member-wise initialization
D) default initialization
سؤال
Run-time binding is also known as ____ binding.

A) static
B) shallow
C) dynamic
D) deep
سؤال
A(n)____ is a collection of distinct elements of the same type.

A) class
B) ordered set
C) pointer
D) list
سؤال
A class ____ automatically executes whenever a class object goes out of scope.

A) constructor
B) destructor
C) pointer
D) exception
سؤال
Which of the following operations is allowed on pointer variables?

A) exp
B) %
C) ==
D) /
سؤال
In a(n)____ copy,two or more pointers have their own data.

A) shallow
B) deep
C) static
D) dynamic
سؤال
The statement that declares board to be an array of six pointers wherein each pointer is of type int is: int ____________________;
سؤال
Which of the following arithmetic operations is allowed on pointer variables?

A) increment
B) modulus
C) multiplication
D) division
سؤال
An array created during the execution of a program is called a(n)____ array.

A) list
B) static
C) execution
D) dynamic
سؤال
Given the declaration int *a;,the statement a = new int[50]; dynamically allocates an array of 50 components of the type ____.

A) int
B) int*
C) pointer
D) address
سؤال
Given the statement double *p;,the statement p++; will increment the value of p by ____ byte(s).

A) one
B) two
C) four
D) eight
سؤال
Consider the following statements:
void pointerParameters(int* &p,double *q)
{
.
.
.
}
In the function pointerParameters,the parameter q is a(n)____________________ parameter.
سؤال
In a ____ copy,two or more pointers of the same type point to the same memory.

A) static
B) shallow
C) dynamic
D) deep
سؤال
Which of the following would be appropriate syntax for the heading of a copy constructor for a class called rulerType?

A) rulerType(int inches, int centimeters)
B) rulerType()
C) rulerType(const rulerType& myRuler)
D) copy rulerType(int inches, int centimeters)
سؤال
The ____ constructor is executed when an object is declared and initialized by using the value of another object.

A) default
B) copy
C) struct
D) class
سؤال
Consider the following statements:
void pointerParameters(int* &p,double *q)
{
.
.
.
}
In the function pointerParameters,the parameter p is a(n)____________________ parameter.
سؤال
The statement int *p; is equivalent to int * p;,which is also equivalent to the statement ____________________.
سؤال
Consider the following declaration of a struct:
struct studentType
{
char name[26];
double gpa;
int sID;
char grade;
};
studentType student;
studentType *studentPtr;
The statement (*studentPtr).gpa = 2.5; is equivalent to ____________________ = 2.5;.
سؤال
In ____ binding,the necessary code to call a specific function is generated by the compiler.

A) static
B) dynamic
C) shallow
D) deep
سؤال
The ____________________ of a base class automatically makes the destructor of a derived class virtual.
سؤال
Consider the following statements:
int x;
int &y = x;
The second statement declares y to be a(n)____________________ of x.
سؤال
The copy constructor automatically executes when,as a parameter,an object is passed by ____________________.
سؤال
Once a class contains one or more pure virtual functions,then that class is called a(n)____________________ class.
سؤال
For classes with pointer member variables,you should include the copy constructor and the ____________________ in the class.
سؤال
The statement that declares board to be a pointer to a pointer is: int ____________________;
سؤال
The binding of virtual functions occurs at program ____________________ time.
سؤال
The ____________________ of a list is the number of elements in the list.
سؤال
Consider the following statements:
class shape
{
public:
virtual void draw()= 0;
virtual void move(double x,double y)= 0;
.
.
.
};
The code above is an example of a(n)____________________ class definition.
سؤال
An object of the base class type cannot be passed to a(n)____________________ parameter of the derived class type.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/50
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 12: Pointers, Classes, Virtual Functions, Abstract Classes, and Lists
1
In C++,the dot operator has a lower precedence than the dereferencing operator.
False
2
What is the output of the following code? int *p;
Int x;
X = 76;
P = &x;
*p = 43;
Cout << x << "," << *p << endl;

A) 76, 76
B) 76, 43
C) 43, 76
D) 43, 43
D
3
What is the output of the following code? int *p;
Int x;
X = 12;
P = &x;
Cout << x << ",";
*p = 81;
Cout << *p << endl;

A) 12, 12
B) 12, 81
C) 81, 12
D) 81, 81
B
4
In the statement
int* p,q;
p and q are pointer variables.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
5
The dereferencing operator is also known as the indirection operator and refers to the object to which its operand points.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
6
Variables that are created during program execution are called static variables.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
7
In C++,you declare a pointer variable by using the ____ symbol.

A) *
B) &
C) #
D) @
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
8
In C++,pointer variables are declared using the reserved word pointer.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
9
Which of the following can be used to initialize a pointer variable?

A) 1
B) NULL
C) "0"
D) '0'
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
10
If p is a pointer variable,the statement p = p + 1; is valid in C++.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
11
A pointer variable is a variable whose content is a memory address.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
12
The code int *p; declares p to be a(n)____ variable.

A) new
B) num
C) pointer
D) address
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
13
The C++ operator ____ is used to destroy dynamic variables.

A) destroy
B) delete
C) *
D) ~
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
14
What is the output of the following statements? int x = 33;
Int *q;
Q = &x;
Cout << *q << endl;

A) NULL
B) 0
C) 3
D) 33
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
15
What is the value of x after the following statements execute? int x = 25;
Int *p;
P = &x;
*p = 46;

A) NULL
B) 0
C) 25
D) 46
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
16
A list is a collection of elements of the same type.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
17
In C++,____ is called the address of operator.

A) &
B) *
C) #
D) ->
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
18
A memory leak is an unused memory space that cannot be allocated.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
19
The C++ operator ____ is used to create dynamic variables.

A) dynamic
B) new
C) virtual
D) dereferencing
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
20
Given the declaration
int *p;
The statement
p = new int[50];
dynamically allocates an array of 50 components of type int and p contains the base address of the array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
21
The ____ operator can be used to return the address of a private data member of a class.

A) dereferencing
B) destructor
C) address of
D) member access
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
22
Consider the following statement: ptrMemberVarType objectThree(objectOne);
The values of the member variables of objectOne are being copied into the corresponding member variables of objectThree.This initialization is called the ____.

A) member-wise assignment
B) default assignment
C) member-wise initialization
D) default initialization
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
23
Run-time binding is also known as ____ binding.

A) static
B) shallow
C) dynamic
D) deep
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
24
A(n)____ is a collection of distinct elements of the same type.

A) class
B) ordered set
C) pointer
D) list
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
25
A class ____ automatically executes whenever a class object goes out of scope.

A) constructor
B) destructor
C) pointer
D) exception
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
26
Which of the following operations is allowed on pointer variables?

A) exp
B) %
C) ==
D) /
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
27
In a(n)____ copy,two or more pointers have their own data.

A) shallow
B) deep
C) static
D) dynamic
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
28
The statement that declares board to be an array of six pointers wherein each pointer is of type int is: int ____________________;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
29
Which of the following arithmetic operations is allowed on pointer variables?

A) increment
B) modulus
C) multiplication
D) division
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
30
An array created during the execution of a program is called a(n)____ array.

A) list
B) static
C) execution
D) dynamic
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
31
Given the declaration int *a;,the statement a = new int[50]; dynamically allocates an array of 50 components of the type ____.

A) int
B) int*
C) pointer
D) address
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
32
Given the statement double *p;,the statement p++; will increment the value of p by ____ byte(s).

A) one
B) two
C) four
D) eight
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
33
Consider the following statements:
void pointerParameters(int* &p,double *q)
{
.
.
.
}
In the function pointerParameters,the parameter q is a(n)____________________ parameter.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
34
In a ____ copy,two or more pointers of the same type point to the same memory.

A) static
B) shallow
C) dynamic
D) deep
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
35
Which of the following would be appropriate syntax for the heading of a copy constructor for a class called rulerType?

A) rulerType(int inches, int centimeters)
B) rulerType()
C) rulerType(const rulerType& myRuler)
D) copy rulerType(int inches, int centimeters)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
36
The ____ constructor is executed when an object is declared and initialized by using the value of another object.

A) default
B) copy
C) struct
D) class
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
37
Consider the following statements:
void pointerParameters(int* &p,double *q)
{
.
.
.
}
In the function pointerParameters,the parameter p is a(n)____________________ parameter.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
38
The statement int *p; is equivalent to int * p;,which is also equivalent to the statement ____________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
39
Consider the following declaration of a struct:
struct studentType
{
char name[26];
double gpa;
int sID;
char grade;
};
studentType student;
studentType *studentPtr;
The statement (*studentPtr).gpa = 2.5; is equivalent to ____________________ = 2.5;.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
40
In ____ binding,the necessary code to call a specific function is generated by the compiler.

A) static
B) dynamic
C) shallow
D) deep
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
41
The ____________________ of a base class automatically makes the destructor of a derived class virtual.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
42
Consider the following statements:
int x;
int &y = x;
The second statement declares y to be a(n)____________________ of x.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
43
The copy constructor automatically executes when,as a parameter,an object is passed by ____________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
44
Once a class contains one or more pure virtual functions,then that class is called a(n)____________________ class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
45
For classes with pointer member variables,you should include the copy constructor and the ____________________ in the class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
46
The statement that declares board to be a pointer to a pointer is: int ____________________;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
47
The binding of virtual functions occurs at program ____________________ time.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
48
The ____________________ of a list is the number of elements in the list.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
49
Consider the following statements:
class shape
{
public:
virtual void draw()= 0;
virtual void move(double x,double y)= 0;
.
.
.
};
The code above is an example of a(n)____________________ class definition.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
50
An object of the base class type cannot be passed to a(n)____________________ parameter of the derived class type.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.