Saturday, January 16, 2010

Points about OOPS

1. Abstraction is the process of highlighting the essential, inherent aspects of an entity while ignoring irrelevant details.
2. Encapsulation (or information hiding) is the process of separating the external aspects of an objects from the internal implementation details which should be hidden from other objects.
3. Modularity is the process of dividing a problem into smaller pieces so that each smaller module can be dealt with individually.
4. Organizing a set of abstractions from most general to least is known as inheritance hierarchy.
5. Object-oriented programming is a paradigm in which a system is modeled as a set of objects that interact with each other.
6. In C++ an abstraction is formed by creating a class. A class encapsulates the attributes and behaviors of an object.
7. The data members of a class represent the attributes of a class. And the member functions of a class represents the behaviors of a class.
8. Polymorphism is the capability of something to assumediferent forms. In an object-oriented language, polymorphism is provided by allowing a message or member function to mean different things depending on the type of object that receives the message.
9. All C++ program begin executing from the main. Function main returns an integer value that indicates whether the program executed successfullly or not. A value of ) indicates successful execution, while the value 1 indicates that a problem or error occurred during the execution of the program.
10. A variable must be defined before it can be used. Smart programmers give a variable an initial value when it is defined.
11. A pointer is a variable whose value is the address of another variable.
12. Pointers should be different type for each type of variable. There are even pointer types whose variable are pointers to other pointers.
13. The location of a variable can be obtained using the address operator &.
14. Pointer operators may be compared using the equality and relational operators.
15. The increment and decrement operators may be applied to pointer objects.
16. Pointers can be passed as reference parameters by using the indirection operator.
17. Command-line parameters are communicated to programs using pointers.
18. We can define variables that are pointers to functions. Such variables are typically used as function parameters. This type of parameter enables the function that uses it to have greater flexibility in accomplishing its task.
19. A reference variable must be initialized when it is declared.
20. When a reference parameter is used, instead of passing a copy of the variable, a reference to the original variable is passed. Any modifications made to the parameter by the called function change the original variable.
21. A reason to use reference parameter is for efficiency. When a class object is passed by value, a copy of the object is passed. If the object is large, making a copy of it can be expensive in terms of execution time and memory space. thus, objects that are large, or objects whose size is not known are often passed by reference. We can ensure that the objects are not modified by using the const modifier.
22. Constructors initialize objects of the class type. It is standard practice to ensure that every object has all of its data members appropriately initializes.
23. A default constructor is a constructor that requires no parameters.
24. A copy constructor initialize a new object to be a duplicate of a previously defined source object. If a class does not define a copy constructor, the compiler automatically supplies version.
25. A class constructor, if defined, is called whenever a program creates an object of that class.
26. An inline function must be defined before it is called.
27. An inline function reduces the function call overhead. Small functions are best declared inline within a class.

Thursday, January 14, 2010

Database System-III

1. What is a "primary key"?
Ans : A PRIMARY INDEX or PRIMARY KEY is something which comes mainly from database theory. From its behavior is almost the same as an UNIQUE INDEX, i.e. there may only be one of each value in this column. If you call such an INDEX PRIMARY instead of UNIQUE, you say something about your table design, which I am not able to explain in few words. Primary Key is a type of a constraint enforcing uniqueness and data integrity for each row of a table. All columns participating in a primary key constraint must possess the NOT NULL property.

2. What is a "functional dependency"? How does it relate to database table design?
Ans : Functional dependency relates to how one object depends upon the other in the database. for example, procedure/function sp2 may be called by procedure sp1. Then we say that sp1 has functional dependency on sp2.

3. What is a "trigger"?
Ans : Triggers are stored procedures created in order to enforce integrity rules in a database. A trigger is executed every time a data-modification operation occurs (i.e., insert, update or delete). Triggers are executed automatically on occurance of one of the data-modification operations. A trigger is a database object directly associated with a particular table. It fires whenever a specific statement/type of statement is issued against that table. The types of statements are insert,update,delete and query statements. Basically, trigger is a set of SQL statements A trigger is a solution to the restrictions of a constraint. For instance: 1.A database column cannot carry PSEUDO columns as criteria where a trigger can. 2. A database constraint cannot refer old and new values for a row where a trigger can.

4. Why can a "group by" or "order by" clause be expensive to process?
Ans : Processing of "group by" or "order by" clause often requires creation of Temporary tables to process the results of the query. Which depending of the result set can be very expensive.

5. What is "index covering" of a query?
Ans : Index covering means that "Data can be found only using indexes, without touching the tables"


6. What is a SQL view?
Ans : An output of a query can be stored as a view. View acts like small table which meets our criterion. View is a precomplied SQL query which is used to select data from one or more tables. A view is like a table but it doesn’t physically take any space. View is a good way to present data in a particular format if you use that query quite often. View can also be used to restrict users from accessing the tables directly.


7. What are two methods of retrieving SQL?
Ans : Use SELECT Query and Projection Relational Algebra to retrieve SQL.


8. What cursor type do you use to retrieve multiple recordsets?
Ans : Explicit Cursor has been used to retrieve multiple records at a time.


9. What types of join algorithms can you have?
Ans : Natural Join, Equi Join, Inner Join, Outer Join (Left Outer Join ,Right Outer Join, Full Outer Join), Cross Join, Self Join, etc.

Search Aptipedia