Technical Interview Questions and Answers :: Sapient
Tot. Mock Test: 0
Total Qs: 70+
Function overloading: C++ enables several functions of the same name to be defined, as long as these functions have different sets of parameters (at least as far as their types are concerned). This capability is called function overloading. When an overloaded function is called, the C++ compiler elects the proper function by examining the number, types and order of the arguments in the call. Function overloading is commonly used to create several functions of the same name that perform similar tasks but on different data types.
Operator overloading allows existing C++ operators to be redefined so that they work on objects of user-defined classes. Overloaded operators are syntactic sugar for equivalent function calls. They form a pleasant facade that doesn't add anything fundamental to the language (but they can improve understand ability and reduce maintenance costs).
Single entity showing multiple behaviours.
Example: Mobile can be used to take photos , internet usage,text documents creation etc.,
Two types of polymorphism 1.static polymorphism ( method over riding)
2. Dynamic polymorphism ( method over loading)
A virtual function allows derived classes to replace the implementation provided by the base class. The compiler makes sure the replacement is always called whenever the object in question is actually of the derived class, even if the object is accessed by a base pointer rather than a derived pointer. This allows algorithms in the base class to be replaced in the derived class, even if users don't know about the derived class.
Yes, Consider a category table in a e-commerce web site.
Category_Id, Category_Name, Parent_Category_ID. In this table all the parent categories are also categories. When we create a self join category id will be treated as foreign key to the same table.
The PRIMARY KEY is the column(s) used to uniquely identify each row of a table.
A FOREIGN KEY is one or more columns whose values are based on the PRIMARY or CANDITATE KEY values from the database.
A UNIQUE KEY is one or more columns that must be unique for each row of the table.
No Discussion on this question yet!
The domain of an attribute must include only atomic (simple, indivisible) values.
It is based on the concept of full functional dependency. A functional dependency X -> Y is full functional dependency if removal of any attribute A from X means that the dependency does not hold any more.