OOPS Interview Questions
Questions Answers Views Company eMail

if u write a class do u write Assignment operator and copy constructor

Siemens,

1 5215

how do u initialize the constant variables

IBM, Siemens,

5 10098

when my application exe is running nad i don't want to create another exe what should i do

HCL,

2 4924

what is the use of mutable key word

HCL,

3 8602

different types of castings

Siemens,

3 11074

the difference between new and malloc

Siemens,

5 12941

difference between overloading and overridding

11 13411

why destructor is not over loaded?

5 16964

Why many objects can working together? How objects working togetherM I want to see example code.

2 4148

suppose A is a base class and B is the derved class. Both have a method foo which is defined as a virtual method in the base class. You have a pointer of classs B and you typecast it to A. Now when you call pointer->foo, which method gets called? The next part of the question is, how does the compiler know which method to call?

EA Electronic Arts,

3 8358

Which is faster post increment or pre increment ? and in which cases should u use either - to increase speed?

EA Electronic Arts,

4 12567

i hav very low percentage in 12th n BSCwhich is around 50.......coz it was just imposed on me 2 b a science graduate,nw m doin MCA n hav aggregate 74% ....what shud i answer if company's HR ask me about dis much low previous percentage??????

Infosys,

3 12429

i ahve v low % in 12th n BSC which is aroun 50 coz science was imposed on me......nw m doin MCA n my aggregate in above 74%,what shud i say if asked about low previous percentage??????

4 5195

sir plz send me a set of questions that been frequently held in written examination during campus selection.

TCS,

1527

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

TCS,

1641


Post New OOPS Questions

Un-Answered Questions { OOPS }

What is polymorphism and example?

563


What is the diamond problem in inheritance?

551


just right the logic of it 1--> If few people are electing then every time ur candidate should win 2--> arrange books in box, if box carry weight == books weight then take another box..... find the no of box required.

6459


What are oops methods?

541


What is class encapsulation?

566






What are the benefits of polymorphism?

587


Write a program to reverse a string using recursive function?

1770


How Do you Code Composition and Aggregation in C++ ?

24145


can we make game by using c

3388


Are polymorphisms mutations?

677


Can you name some types of inheritance?

622


What is oops?what is its use in software engineering?

532


What is encapsulation with real life example?

549


How do you define social class?

583


when to use 'mutable' keyword and when to use 'const cast' in c++

1623