COMPLETE SOLUTIONS 100% GUARANTEED PASS
Which C/C++ operations will acquire memory from heap?
malloc
new
You DO NOT need to garbage-collect the memory, if it comes from (Select all that
apply)
stack memory
static memory
global memory
NOT heap memory
How is Java's garbage collection implemented?
It uses a reference counter to indicate if an object is still referenced by any variable
What is the key difference between a static variable and a global variable?
They have different visibility
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
m
j
k
What is the best way of deleting an array created by "p = new StructType[size];"
in C++?
delete[] p;
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 all the nodes in a binary tree pointed to by the
root pointer?
Traverse the tree and delete each node individually
A piece of memory must be explicitly garbage-collected, if it comes from
heap
If A is the base class and B is a class derived from A, then
class B has all the members of class A