Deck 3: Pointers and Array-Based Lists

ملء الشاشة (f)
exit full mode
سؤال
The values belonging to pointer data types are the memory addresses of your computer.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
In the line of code int* p,q, p and q are both pointer variables of type int.
سؤال
The ampersand, &, is a binary operator that returns the address of its operand.
سؤال
Two different pointer variables cannot point to same memory location.
سؤال
When * is used as a unary operator, * refers to the object to which the operand of the * (that is, the pointer) points.
سؤال
A declaration such as int *p; allocates memory for p only, not for *p.
سؤال
Pointer variables must be initialized if you want them to point to something.
سؤال
When a program no longer needs a dynamic variable, the operator delete is used.
سؤال
The operator new has two forms: one to allocate a single variable, and another to allocate an array of variables.
سؤال
When a dynamic variable is no longer needed, it can be destroyed; that is, its memory can be deallocated.
سؤال
The increment operator increments the value of a pointer variable by twice the size of the memory to which it is pointing.
سؤال
The decrement operator decrements the value of a pointer variable by the size of the memory to which it is pointing.
سؤال
When an integer is added to a pointer variable, the value of the pointer variable is incremented by the integer times the size of the memory to which the pointer is pointing.
سؤال
When an integer is subtracted from a pointer variable, the value of the pointer variable is decremented by the integer times half the size of the memory to which the pointer is pointing.
سؤال
An array created during the execution of a program is called a dynamic array.
سؤال
In a shallow copy, two pointers of different data types point to the same memory.
سؤال
In a deep copy, two or more pointers have their own data.
سؤال
The copy constructor does not execute when the return value of a function is an object.
سؤال
The length of a list is the number of elements in the list.
سؤال
In order to maintain and process the list in an array, we need the array holding the list elements, a variable to store the length of the list, and a variable to store the size of the array.
سؤال
It is good programming practice to develop separate code for each type of list we need.
سؤال
The time complexity of the function isEmpty in an array list is O(1).
سؤال
The time complexity of the function seqSearch in an array list is O(n2).
سؤال
A ____ variable is a variable whose content is a memory address.

A) class
B) dynamic
C) pointer
D) heap
سؤال
The value of a pointer variable is an ____.

A) address
B) entry in a table
C) array
D) unknown value
سؤال
The general syntax to declare a pointer variable is ____.

A) dataType &identifier;
B) *dataType identifier;
C) &dataType identifier;
D) dataType *identifier;
سؤال
The ampersand, &, is called the ____.

A) address of operator
B) sizeof operator
C) entry operator
D) heap operator
سؤال
The * is commonly referred to as the ____ operator.

A) referencing
B) allocating
C) dereferencing
D) addressing
سؤال
The syntax for accessing a class (struct) member using the operator -> is ____.

A) pointerVariableName.classMemberName
B) pointerVariableName->classMemberName
C) pointerVariableName&->classMemberName
D) &pointerVariableName.classMemberName
سؤال
You can initialize a pointer variable by setting it to ____.

A) EMPTY
B) NULL
C) INIT
D) NONE
سؤال
Variables that are created during program execution are called ____ variables.

A) stack
B) heap
C) dynamic
D) static
سؤال
The statement ____ stores the address of x in p.

A) p = &x;
B) p = &x
C) x = &p;
D) x = &p
سؤال
When a dynamic variable is no longer needed, it can be ____.

A) recycled
B) reassigned
C) reconstructed
D) destroyed
سؤال
A ____ leak is when there is an unused memory space that cannot be allocated.

A) variable
B) function
C) constructor
D) memory
سؤال
The statement ____ declares list to be an array of five integers.

A) int [5] list;
B) int list[5];
C) int list[];
D) int list[]={0,1,2,3,4,5};
سؤال
If p is a pointer variable of type int, then the statement ____ copies the value of list into p.

A) list = p;
B) p.copy(list);
C) p->copy(list);
D) p = list;
سؤال
A pointer variable can be passed as a parameter to a function either by value or by ____.

A) retention
B) reference
C) approximation
D) referral
سؤال
The statement ____ declares board to be a pointer to a pointer.

A) int **board;
B) int *&board;
C) *int *board;
D) **int board;
سؤال
If a class has member variables that are pointers, you must ensure that you implement ____.

A) garbage collection
B) base constructors
C) friend functions
D) a destructor
سؤال
The correct syntax for the destructor of the class tempClass is ____.

A) tempClass::~tempClass()
B) tempClass::~tempClass(x)
C) tempClass::tempClass()
D) tempClass::tempClass(x)
سؤال
The general syntax to include the copy constructor in the definition of a class is ____.

A) className(className& otherObject);
B) className(className otherObject);
C) className(const className& otherObject);
D) className(const className* otherObject);
سؤال
To determine whether the item to be inserted is already in the list, the insert function calls the _____ member function.

A) isEmpty
B) size
C) seqSearch
D) copy
سؤال
In an array list, the time complexity of the isEmpty function is identical to the time complexity of the ____ function.

A) removeAt
B) isFull
C) insertAt
D) print
سؤال
In an array list, the time complexity of the removeAt function is identical to the time complexity of the ____ function.

A) isEmpty
B) seqSearch
C) isFull
D) isItemAtEqual
سؤال
In an array list the time complexity of the remove function is identical to the time complexity of the ____ function.

A) insert
B) isEmpty
C) isFull
D) maxListSize
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/45
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 3: Pointers and Array-Based Lists
1
The values belonging to pointer data types are the memory addresses of your computer.
True
2
In the line of code int* p,q, p and q are both pointer variables of type int.
False
3
The ampersand, &, is a binary operator that returns the address of its operand.
False
4
Two different pointer variables cannot point to same memory location.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
5
When * is used as a unary operator, * refers to the object to which the operand of the * (that is, the pointer) points.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
6
A declaration such as int *p; allocates memory for p only, not for *p.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
7
Pointer variables must be initialized if you want them to point to something.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
8
When a program no longer needs a dynamic variable, the operator delete is used.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
9
The operator new has two forms: one to allocate a single variable, and another to allocate an array of variables.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
10
When a dynamic variable is no longer needed, it can be destroyed; that is, its memory can be deallocated.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
11
The increment operator increments the value of a pointer variable by twice the size of the memory to which it is pointing.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
12
The decrement operator decrements the value of a pointer variable by the size of the memory to which it is pointing.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
13
When an integer is added to a pointer variable, the value of the pointer variable is incremented by the integer times the size of the memory to which the pointer is pointing.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
14
When an integer is subtracted from a pointer variable, the value of the pointer variable is decremented by the integer times half the size of the memory to which the pointer is pointing.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
15
An array created during the execution of a program is called a dynamic array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
16
In a shallow copy, two pointers of different data types point to the same memory.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
17
In a deep copy, two or more pointers have their own data.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
18
The copy constructor does not execute when the return value of a function is an object.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
19
The length of a list is the number of elements in the list.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
20
In order to maintain and process the list in an array, we need the array holding the list elements, a variable to store the length of the list, and a variable to store the size of the array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
21
It is good programming practice to develop separate code for each type of list we need.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
22
The time complexity of the function isEmpty in an array list is O(1).
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
23
The time complexity of the function seqSearch in an array list is O(n2).
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
24
A ____ variable is a variable whose content is a memory address.

A) class
B) dynamic
C) pointer
D) heap
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
25
The value of a pointer variable is an ____.

A) address
B) entry in a table
C) array
D) unknown value
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
26
The general syntax to declare a pointer variable is ____.

A) dataType &identifier;
B) *dataType identifier;
C) &dataType identifier;
D) dataType *identifier;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
27
The ampersand, &, is called the ____.

A) address of operator
B) sizeof operator
C) entry operator
D) heap operator
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
28
The * is commonly referred to as the ____ operator.

A) referencing
B) allocating
C) dereferencing
D) addressing
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
29
The syntax for accessing a class (struct) member using the operator -> is ____.

A) pointerVariableName.classMemberName
B) pointerVariableName->classMemberName
C) pointerVariableName&->classMemberName
D) &pointerVariableName.classMemberName
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
30
You can initialize a pointer variable by setting it to ____.

A) EMPTY
B) NULL
C) INIT
D) NONE
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
31
Variables that are created during program execution are called ____ variables.

A) stack
B) heap
C) dynamic
D) static
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
32
The statement ____ stores the address of x in p.

A) p = &x;
B) p = &x
C) x = &p;
D) x = &p
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
33
When a dynamic variable is no longer needed, it can be ____.

A) recycled
B) reassigned
C) reconstructed
D) destroyed
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
34
A ____ leak is when there is an unused memory space that cannot be allocated.

A) variable
B) function
C) constructor
D) memory
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
35
The statement ____ declares list to be an array of five integers.

A) int [5] list;
B) int list[5];
C) int list[];
D) int list[]={0,1,2,3,4,5};
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
36
If p is a pointer variable of type int, then the statement ____ copies the value of list into p.

A) list = p;
B) p.copy(list);
C) p->copy(list);
D) p = list;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
37
A pointer variable can be passed as a parameter to a function either by value or by ____.

A) retention
B) reference
C) approximation
D) referral
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
38
The statement ____ declares board to be a pointer to a pointer.

A) int **board;
B) int *&board;
C) *int *board;
D) **int board;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
39
If a class has member variables that are pointers, you must ensure that you implement ____.

A) garbage collection
B) base constructors
C) friend functions
D) a destructor
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
40
The correct syntax for the destructor of the class tempClass is ____.

A) tempClass::~tempClass()
B) tempClass::~tempClass(x)
C) tempClass::tempClass()
D) tempClass::tempClass(x)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
41
The general syntax to include the copy constructor in the definition of a class is ____.

A) className(className& otherObject);
B) className(className otherObject);
C) className(const className& otherObject);
D) className(const className* otherObject);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
42
To determine whether the item to be inserted is already in the list, the insert function calls the _____ member function.

A) isEmpty
B) size
C) seqSearch
D) copy
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
43
In an array list, the time complexity of the isEmpty function is identical to the time complexity of the ____ function.

A) removeAt
B) isFull
C) insertAt
D) print
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
44
In an array list, the time complexity of the removeAt function is identical to the time complexity of the ____ function.

A) isEmpty
B) seqSearch
C) isFull
D) isItemAtEqual
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
45
In an array list the time complexity of the remove function is identical to the time complexity of the ____ function.

A) insert
B) isEmpty
C) isFull
D) maxListSize
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 45 في هذه المجموعة.