COMPLETE SOLUTIONS VERIFIED GRADED A++
In an array-implemented queue class, what members should be declared as
"public" members?
queue_size
the array of buffer
front and rear index variables
enqueue and dequeue functions
enqueue and dequeue functions
The purpose of the scope resolution operator is to allow a function to be -
implemented using recursion.
placed inside the class.
placed outside the class.
a global function.
placed outside the class.
What are the key features of object orientation in programming languages? Select
all that apply
Dynamic memory allocation
Encapsulation of state
How is Java's garbage collection implemented?
It uses a reference counter to indicate if an object is still referenced by any variable.
,If a function calls another function, the local variables in these two functions use
the memory from?
different stack frames.
same stack frames.
static
heap
different stack frames.
Given the snippet of code:
int x = 7;
int bar(int j) {
int *k = 0, a = 6;k = &a;
return (j+a);
}
void main(void) {
static int i =0;
i++;
i = bar(i) + x; }
Which variables obtain their memory from the stack? Select all that apply
i
j
k
a
x
, j, k, a
What is the best way of deleting a linked list of objects in C++?
Use a loop to delete every object in the linked list.
What is the best way of deleting an array created by "p = new StructType[size];"
in C++?
delete[] p;
What members of a base class can be redefined in the derived classes?
virtual members
In the implementation of the getMax() function in the PriQueue class, we need to
read and write the variables "front" and "rear", which are defined as protected
members in the base class Queue. Are the functions in the derived class allowed
to access the protected members in the base class?
yes, always
If a class needs to inherit from multiple parent classes, the parent classes must?
a)not contain overlapped members.
b)be defined as interface classes only.
c)contain virtual functions only.
d)be inherited as virtual classes.
If A is the base class and B is a class derived from A, and x and y are pointers to
objects of A and B, respectively, which assignment statement can pass the
compiler check?
x=y;