| Back to Questions Page |
| |
| Question |
what is smart pointer & use of the smart pointer ??? |
Rank |
Answer Posted By |
|
Question Submitted By :: Vishnu948923 |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | Smart pointers are objects which store pointers to
dynamically allocated (heap) objects. They behave much like
built-in C++ pointers except that they automatically delete
the object pointed to at the appropriate time. Smart
pointers are particularly useful in the face of exceptions
as they ensure proper destruction of dynamically allocated
objects. They can also be used to keep track of dynamically
allocated objects shared by multiple owners.  |
| Satya |
| |
| |
| Question |
In multilevel inheritance constructors will be executed
from the .... class to ... class |
Rank |
Answer Posted By |
|
Question Submitted By :: Guest |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | Constructors are always executed from the parent to child
ie in the example below:
#include <iostream>
using namespace std;
class base1
{
public:
base1()
{
cout<<"In constructor of base1"<<endl;
}
~base1()
{
cout<<"In destructor of base1"<<endl;
}
};
class base2:public base1
{
public:
base2()
{
cout<<"In constructor of base2"<<endl;
}
~base2()
{
cout<<"In destructor of base2"<<endl;
}
};
class derived :public base2
{
public:
derived()
{
cout<<"In constructor of derived"<<endl;
}
~derived()
{
cout<<"In destructor of derived"<<endl;
}
};
void main()
{
base1 b1;
base2 b2;
derived d1;
}
o/p:
In constructor of base1 --- for object b1
In constructor of base1 --- for object b2
In constructor of base2-----
In constructor of base1-for object d1
In constructor of base2
In constructor of derived  |
| Ps |
| |
| |
| Question |
WILL I GET A guaranteed JOB AFTER DOING bsc()IT) and GNIIT
from an NIIT CENTRE?? |
Rank |
Answer Posted By |
|
Question Submitted By :: Tanuja |
| This Interview Question Asked @ Biocon , MIT |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | There is no guaranteed job available. Infact GNIIT gives
you only job assistance. Only and Only if you perform well
you would be placed. It doesnot matter whether it is GNIIT
from NIIT or ACCP from Aptech.  |
| Mamta |
| |
| |
|
|
| |
| Question |
why we call c++ is object oriented lanaguage |
Rank |
Answer Posted By |
|
Question Submitted By :: Mail |
| This Interview Question Asked @ HCL , Hcl |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | if a language (supports)follows ObjectOrientedProgramming
concepts we can say it is a Object Oriented Programming.
Object Oriented Programing Concepts are:
1.class
2.object
3.Data Abstraction
4.Encapsulation
5.Polymorphism
6.Inheritnace
7.Message Communication  |
| Madhu Kalla |
| |
| |
| Answer | Since it obeys OOPs concepts,it is said to be object
oriented language....  |
| Viji |
| |
| |
| Question |
What are Binay tress and B trees? Diff between them? |
Rank |
Answer Posted By |
|
Question Submitted By :: Priyas |
| This Interview Question Asked @ CTS |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | both binary tree and b tree are same  |
| Sagar Kumar |
| |
| |
| Answer | A B-tree is a method of placing and locating files (called
records or keys) in a database when all the data is known
to be on DISK.
A Binary-tree is a method of placing and locating files
(called records or keys) in a database when all the data is
known to be in RAM.
It takes thousands of times longer to access a data element
from hard disk as compared with accessing it from RAM,
because a disk drive has mechanical parts, which read and
write data far more slowly than purely electronic media.
B-trees save time by using nodes with many branches (called
children), compared with binary trees, in which each node
has only two children. When there are many children per
node, a record can be found by passing through fewer nodes
than if there are two children per node.
Depth of a B-tree is smaller as compared to a binary tree
and hence B-tree allows a desired record to be located
faster, assuming all other system parameters are identical.  |
| Nutan |
| |
| |
| Answer | both b-tree and binary tree are same  |
| S.divya |
| |
| |
| Question |
Write a program to swap 2 chars without using a third
varable?
char *s = "A";
char *p = "B"; |
Rank |
Answer Posted By |
|
Question Submitted By :: Priyas |
| This Interview Question Asked @ CTS |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | void swap(char *s, char *p)
{
if(0 == s || 0 == p)
return;
*s += *p;
*p = *s - *p;
*s = *s - *p;
}
int main()
{
/* Use chars and not strings!! */
char ac = 'A';
char bc = 'B';
char *a = ∾
char *b = &bc;
swap(a,b);
}  |
| Lior |
| |
| |
| Answer | #include <cstdio>
void swap(char *c, char *d)
{
*d = *c^*d; // c = C d = C^D
*c = *c^*d; // c = C^C^D d = C^D
*d = *c^*d; // c = C^C^D d = C^C^D^C^D
}
main()
{
char c = 'c';
char d = 'd';
swap(&c, &d);
}  |
| Dooglus |
| |
| |
| Answer | void swap(A,B)
{
A=*p;
B=*s;
getch();
}  |
| S.divya |
| |
| |
| Question |
How many pointers are required to reverse a link list? |
Rank |
Answer Posted By |
|
Question Submitted By :: Priyas |
| This Interview Question Asked @ CTS |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | Using 3 pointers:
curr, next, result pointers, curr points to current node,
next obviously points to the next node, result points to
the new reversed linked list
void reverse_single_linked_list(struct node** headRef)
{
struct node* result = NULL;
struct node* current = *headRef;
struct node* next;
while (current != NULL)
{
next = current->next; // tricky: note the next node
current->next = result; // move the node onto the result
result = current;
current = next;
}
*headRef = result;
}  |
| Prits |
| |
| |
| Answer | 2 pointers are required....  |
| Selva |
| |
| |
|
| |
|
Back to Questions Page |