1/14
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
What are the key features of object orientation in programming languages? Select all that apply.
Encapsulation of state and Dynamic memory allocation
C++ allows a programmer to create an object through ___________ (Select all that apply)
the "new" operation during execution.
declaration in compilation phase.
Using the principle of information hiding in OOP, in an array-implemented queue class, what members should be declared as “public” members?
enqueue and dequeue functions
The purpose of the scope resolution operator is to allow a function to be
placed outside the class.
What is the key difference between a static variable and a global variable?
They have different visibility.
If a function calls another function, the local variables in these two functions use the memory from
different stack frames.
How is Java's garbage collection implemented?
It uses a reference counter to indicate if an object is still referenced by any variable.
Which C/C++ operations will acquire memory from heap? Select all that apply.
new and malloc
Given the snippet of code:
int x = 5;
int bar(int j) {
int *k = 0, m = 5;
k = &m;
return (j+m);
}
void main(void) {
static int i =0;
i++;
i = bar(i) + x;
}
Which variables obtain their memory from the stack? Select all that apply.
k, m, j
Assume that you want to delete the entire linked list pointed to by head. Which of the following deletion operation will cause the most garbage of memory?
head = NULL;
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.
A piece of memory must be explicitly garbage-collected, if it comes from
heap
We need to write a destructor for a class, if
heap memory is used in the constructor of the class.
What memory must be garbage-collected by a destructor?
heap memory created in the constructors in the same class
What is the best way of deleting all the nodes in a binary tree pointed to by the root pointer?
raverse the tree and delete each node individually.