30 January 2012

Important Questions in C++

Most of the important questions related to C++ has common pattern. They revolved around the virtual functions and inheritance in C++. 
1. Virtual Functions: If we are clear on how it is implemented in the language, we can answer these questions. For example, what is virtual constructor idiom, why is the virtual destructor is needed at all. What is order of invocation of constructors in case of multiple inheritance, how the order Will be effected in the presence of virtual inheritance in the hierarchy. The following site really helped me in exploring C++. http://www.parashift.com/c++-faq-lite. (This is the FAQ is written by the father of C++(Stroustrup))
2. Real world examples of OOPs
3. Multi threading synchronization problems.
4. There are 100 doors, we will do 100 visits to the doors. On ith VISIT we will flip every ith Door(open it if it is closed or close it if it is opened) At the end how many doors will be opened and how many Will be closed. Initially all the doors are closed. (Only Perfect squares numbered doors will be opened all the other doors will be closed)
5. Which feature of OOPs you liked the most, and explain why did u chose that?
6. Reverse a SLL.
7. Find intersection point of a two linked lists.
8. How to get the IP address of abc.com. What could be reason for the following behavior. We are able to open the http://www.abc.com, where as we could not ping it. (Firewall could be used to block the ping requests)
9. What is the difference between new and malloc.
10. What is the C++ way of implementing atoi function. (Using String streams)
11. Write the class for a String in C++. (define data members, constructor, destructor). Overload + operator for that class.
12. What happens if a base class object is catched when a derived class instance is thrown. Whether it is caught or not? If it is caught then in the catch block if we call a virtual method on that object, which variant of that method is called (Derived or base class variant). What is the behavior of this scenario in the case of catching by reference to base class instead of the object.
13. What is the behavior of the following statement in C++. a=10; b=20; c=a+++++b;
14. How Vector class is implemented.
15. What is Set. Implement Set Class, which data structure would you chose to implement it.
16. What is name mangling in C++?
17. What is dynamic cast and static cast.


Best video tutorials to explore c++ for beginner or experienced is :
http://xoax.net/cpp/index.php
Programs to practice
http://xoax.net/cpp/index.php?type=ref


No comments:

Post a Comment