hello frds,
 
i'm not that much good at C, but i tried to give answers to ur questions by searching on web. i think its useful for u
 
1. What is Dangling Pointer?
A dangling pointer is a surviving reference to an object that no longer exists at that address. Dangling pointers can occur under automatic memory management, because of a garbage collection bug.
 
2. What is a singleton class and what is the neccessity of making
sucha class (I mean where is it used speciically)?
A singleton is a class that supports the creation of just one object. It's like your computer -- there's just one keyboard. So if you were writing Delphi code that simulated your computer, you would want just one object instance to deal with keyboard read, write, and control activities.
One more example is print pool. when u have single printer in N/W then thr is Q for all the print request. In programming language the examples r servlets and Object pool of container.
 U just go through this site it'll helpful for u 
 
  http://msdn.microsoft.com/library/default.asp?url="">
 
3. Name at least three headers defind in container classes?
i didn't get this question clearly
 
4.
#include<vector>
vector<int> v;
Which of the following statement(s) is true?
1. v[i] is likely to be faster than v.at[i]
2. v.at[i] is range checked and v[i] is not.
3. v.at[i] and v[i] return the same range of values when i is within
the range.
ans : 3

5.
template<class T> void f()
X<T> :: M *p // line 1
In line 1 " X<T>::M " is
1. It is a type.
2. It is an _expression_.
3. It is ambiquous.
4. None off the above.
ans : 1(Its like a template)

6.What is the error in the following code:

template<class T> class Buffer{
public:
Buffer(int size=0):size_(0),buffer_(new T[size]){}
private:
T* buffer_;
int size_;
};

7.There is a protected data member in the Base Class...and a static
function in the derived class,which is derived publically from Base
class. How can the data member of BC be accessed in the DC's static
function?

class BC
{
protected:
int foo;
};

class DC:public BC
{
public:
static void f()
{
cout<<foo;
}
};

void main()
{
DC d;
d.foo();
}

8. How to confirm if a Cpp program will run successfully on 16 bits
adn 32 bits platform?Where can I get More Information on this topic
there are many cpp compilers available.go through the read me file of that same compiler that u r using for this. thats depends on compiler.that should be recompiled in 32bit OS with compatable compiler.

9. What will be the output?......Options given
class BC
{
virtual void f(){cout<<"In BC";}
};

class DC:public BC
{
public:
void f()
{
cout<<"In DC Function";
}
};

void main()
{
BC *bp=new DC; // Line 1
cout<<"f_returned : "<<bp->f()<<endl;
delete bp; // Line 3
}

The options are:
a. In line 1 using static_cast will guarantee correct
assignment of BC pointer.
b. It will random output coz 'f' cannot be correctly
dispatched.
c. Error in Line 3

10. How to initialize the static data member 'pi' in this class
itself?

class C
{
static int pi;
//Other stuff
};

11. The internal Working of Virtual Functions......How does the CPP
Compiler evaluate and excute the concept of virtual
functions......Some concept of Virtual table?
A virtual function is a function member of a class, declared using the "virtual" keyword. A pointer to a derived class object may be assigned to a base class pointer, and a virtual function called through the pointer. If the function is virtual and occurs both in the base class and in derived classes, then the right function will be picked up based on what the base class pointer "really" points at.
Virtual functions typically are implemented by placing a pointer to a jump table in each object instance. This table pointer represents the "real" type of the object, even though the object is being manipulated through a base class pointer.
Because virtual functions usually need to have their function address taken, to store in a table, declaring them inline.
for example u can see http://www.glenmccl.com/virt_cmp.htm

12. What are the bit fields in C?
1) Operator new constructs an object (calls constructor of object), malloc does not. This is the most important difference, at least IMO.

2) operator new is an operator, malloc is a function.

3) operator new can be overloaded, malloc cannot be overloaded.

4) operator new throws an exception if there is not enough memory, malloc returns a NULL.

5) operator new[] requires you to specify the number of objects to allocate, malloc requires you to specify the total number of bytes to allocate.

6) operator new/new[] must be matched with operator delete/delete[] to deallocate memory, malloc() must be matched with free() to deallocate memory.
 
Aparajita

 

Yahoo! India Matrimony: Find your life partner online.

To unsubscribe : [EMAIL PROTECTED]




Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links

Reply via email to