C++ Interview Questions
Questions Answers Views Company eMail

Check for Balanced Parentheses using Stack?

1 555

What is an Object/Instance?

1 560

What do you mean by C++ access specifiers ?

1 567

What are the basics concepts of OOPS?

1 521

What is the use of volatile keyword in c++? Give an example.

1 497

In how many ways we can initialize an int variable in C++?

1 608

What are C++ inline functions?

1 578

What do you mean by internal linking and external linking in c++?

1 771

How many storage classes are available in C++?

1 674

What is 'Copy Constructor' and when it is called?

1 606

What is realloc() and free()? What is difference between them?

1 520

What is difference between shallow copy and deep copy? Which is default?

1 526

What are virtual functions and what is its use?

1 539

What do you mean by pure virtual functions in C++? Give an example?

1 616

How to create a pure virtual function?

1 749


Un-Answered Questions { C++ }

What are the features of oop?

635


Define namespace in c++?

651


Are vectors passed by reference c++?

517


What are move semantics?

674


Difference between inline functions and macros?

598






What is class and object in oops?

609


How a pointer differs from a reference?

692


Is c++ the best programming language?

536


What are the advantages of c++? Explain

597


What are separators in c++?

622


Question In a class, there is a reference or pointer of an object of another class embedded, and the memory is either allocated or assigned to the new object created for this class. In the constructor, parameters are passed to initialize the data members and the embedded object reference to get inialized. What measures or design change should be advised for proper destruction and avioding memory leaks, getting pointers dangling for the embedded object memory allocation? Please suggest. Question Submitted By :: Sunil Kumar I also faced this Question!! Rank Answer Posted By Re: In a class, there is a reference or pointer of an object of another class embedded, and the memory is either allocated or assigned to the new object created for this class. In the constructor, parameters are passed to initialize the data members and the embedded object reference to get inialized. What measures or design change should be advised for proper destruction and avioding memory leaks, getting pointers dangling for the embedded object memory allocation? Please suggest. Answer # 1 use copy constructors 0 Shanthila There is something to be taken care in destructor, in copy constructor, suppose the memory is assigned to the embedded member object pointer with the parameter passed value, but if some other objects of different class also are pointing to this memory, then if some one deletes the object then this class member pointer object will become dangling, or if the object is not deleted properly then there will be memory leak. Please suggest the design change required to handle or avoid this situation

1659


How can a struct in c++ differs from a struct in c?

614


Write some differences between an external iterator and an internal iterator?

582


What is a c++ vector?

592


. If employee B is the boss of A and C is the boss of B and D is the boss of C and E is the boss of D. Then write a program using the Database such that if an employee name is Asked to Display it also display his bosses with his name. For eg. If C is displayed it should also display D and E with C?

2753