Posts

Showing posts from November, 2013

C++ INTERVIEW QUESTIONS FOR FRESHERS WITH ANSWERS PAPER 5

What is overloading?? With the C++ language, you can overload functions and operators. Overloading is the practice of supplying more than one definition for a given function name in the same scope. - Any two functions in a set of overloaded functions must have different argument lists. - Overloading functions with argument lists of the same types, based on return type alone, is an error.  What is Overriding? To override a method, a subclass of the class that originally declared the method must declare a method with the same name, return type (or a subclass of that return type), and same parameter list. The definition of the method overriding is: · Must have same method name. · Must have same data type. · Must have same argument list. Overriding a method means that replacing a method functionality in child class. To imply overriding functionality we need parent and child classes. In the child class you define the same method signature as one defined in the parent class.

C++ INTERVIEW QUESTIONS FOR FRESHERS WITH ANSWERS PAPER 4

What is constructor or ctor? Constructor creates an object and initializes it. It also creates vtable for virtual functions. It is different from other methods in a class. What is destructor? Destructor usually deletes any extra resources allocated by the object.  What is default constructor? Constructor with no arguments or all the arguments has default values. What is copy constructor? Constructor which initializes the it's object member variables ( by shallow copying) with another object of the same class. If you don't implement one in your class then compiler implements one for you. for example: Boo Obj1(10); // calling Boo constructor Boo Obj2(Obj1); // calling boo copy constructor Boo Obj2 = Obj1;// calling boo copy constructor When are copy constructors called? Copy constructors are called in following cases: a) when a function returns an object of that class by value b) when the object of that class is passed by value as an argument to

C++ INTERVIEW QUESTIONS FOR FRESHERS WITH ANSWERS PAPER 3

41. Name the operators that cannot be overloaded? Ans: sizeof, ., .*, .->, ::, ?: 42. What is an adaptor class or Wrapper class? Ans: A class that has no functionality of its own. Its member functions hide the use of a third party software component or an object with the non-compatible interface or a non-object-oriented implementation. 43. What is a Null object? Ans: It is an object of some class whose purpose is to indicate that a real object of that class does not exist. One common use for a null object is a return value from a member function that is supposed  to return  an object with some specified properties but cannot find such an object. 44. What is class invariant? Ans: A class invariant is a condition that defines all valid states for an object. It is a logical condition to ensure the correct working of a class. Class invariants must hold when an object is created, and they must be preserved under all operations of the class. In particular all class invariants are

C++ INTERVIEW QUESTIONS FOR FRESHERS WITH ANSWERS 2

1. What is a class? Ans: The objects with the same data structure (attributes) and behavior (operations) are called class. 2. What is an object? Ans: It is an entity which may correspond to real-world entities such as students, employees, bank account. It may be concrete such as file system or conceptual such as scheduling policies in multiprocessor operating system. Every object will have data structures called attributes and behavior called operations. 3. What is the difference between an object and a class? Ans: All objects possessing similar properties are grouped into class. Example :–person is a class, ram, hari are objects of person class. All have similar attributes like name, age, sex and similar operations like speak, walk. Class person { private: char name[20]; int age; char sex; public: speak(); walk(); }; 4. What is the difference between class and structure? Ans: In class the data members by default are private but in structure they are by default public 5. Define obj

C++ INTERVIEW QUESTIONS FOR FRESHERS WITH ANSWERS PAPER 1

C++ INTERVIEW QUESTIONS FOR FRESHERS WITH ANSWERS PAPER  What do you mean by polymorphism? Poly" means "many" and "morph" means "form". Polymorphism is the ability of an object (or reference) to assume (be replaced by) or become many different forms of object. Example: function overloading, function overriding, virtual functions. Another example can be a plus ‘+’ sign, used for adding two integers or for using it to concatenate two strings. it is the important concept of OOP, from the greek concept 'poly' means many 'morphism' form ,from this the definition is "the ability to take more than one form"   EXAMPLE: method overloading(static polymorphism...early binding) method overriding(dynamic polymorphism...late binding)   There are two types of polymorphism one is compile time polymorphism and the other is run time polymorphism. Compile time polymorphism is functions and operators overloading. Runtime time

Accenture latest interview experience

Hi all. I appeared for aptitude test for Accenture. I am sharing an overview of their test pattern. Hope it helps you. The test comprised of 3 sections - Analytical, verbal and quantitative-each comprising of 25 question and the total time was 90 mins. The verbal section comprised of English questions- like antonyms, synonyms, passage type questions (1 passage was given & 4-5 questions were asked on that) , meanings of phrases, blood relations etc. What I felt was that if you have a more than normal command over English, you can crack this section very well. Next is analytical section. I comprised of comparatively easier questions and I am sure if you have practiced well for aptitude, you'll be able to solve all of them. The last was quantitative section, the & most difficult and tricky one. Personally speaking, I wasn't able to solve even half of them. You really need to practice a lot for this particular section if you want to clear it. It comprised of questions fro