balaaaji140
BAN USER- 0of 0 votes
AnswersFrom the following options, select a statement that is NOT true about immutable objects.
- balaaaji140 in India
You can use immutable objects in multi-threaded programs
You can use a pointer to create a reference copy of an immutable object, instead of creating a copy of the object
Immutable objects cannot be modified after they are created
An object has to be completely mutable or immutable but partial immutability is not very useful in programs| Report Duplicate | Flag | PURGE
Oracle Software Engineer / Developer Object Oriented Design - 0of 0 votes
AnswersWhat features must a programming language and its runtime environment provide in order to support automatic memory management?
- balaaaji140 in India
1. Dynamic memory allocation
2. Explicit deallocation of data
3. Garbage collection
- 1 and 3, but not 2
- 1
- 3
- 2| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 0of 0 votes
AnswersA program uses a queue to visit each of the nodes of a binary tree, starting at its root. After a node is processed its children are added to the the end of the queue. In what order do nodes get processed?
- balaaaji140 in India
Postorder
Breadth-first
Inorder
Preorder| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersSuppose you have the following code:
- balaaaji140 in India
void InsertNode(tNode** node, int i){
if(*node == NULL){
*node = new tNode;
(*node)->pLeft = NULL;
(*node)->data = i;
(*node)->pRight = NULL;
SetRootNode(node);
return;
} else {
if(i < (*node)->data)
InsertNode(&((*node)->pLeft), i);
if(i > (*node)->data)
InsertNode(&((*node)->pRight), i);
return;
}
}
void Func(tNode **node){
if(*node!=NULL){
Func(&(*node)->pLeft);
tNode *temp;
temp = (*node)->pLeft;
(*node)->pLeft= (*node)->pRight;
(*node)->pRight = temp;
Func(&(*node)->pRight);
}
}
void traverse(tNode** nd){
if(*nd!=NULL){
traverse(&((*nd)->pLeft));
traverse(&((*nd)->pRight));
std::cout<<(*nd)->data<<std::endl;
}
}
Let the input given be
98,15,100,10,78,120,5,12,96,110
What would be the output of the following code snippet?
int main(void) {
tree *bT = new tree;
int i = 10;
int data;
while(i--){
std::cout<<"Enter the node"<<std::endl;
std::cin>>data;
bT->InsertNode(bT->GetRootNode(), data);
}
bT->Func(bT->GetRootNode());
bT->InsertNode(bT->GetRootNode(), 99);
bT->Func(bT->GetRootNode());
bT->traverse(bT->GetRootNode());
}
Options
-5,10,12,15,78,96,98,99,100,1
10,120
-5,12,10,99,96,78,15,110,120,
100,98
-5,10,12,15,78,96,99,98,100,1
10,120
-98,100,120,110,15,78,96,99,1
0,12,5| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm