Why data in an RDBMS needs to be normalized ?

Normalsation is the process of analysing the given relation schemas based on their functional dependency and primary keys to achieve the desirable properties of minimising redundancy and minimising insertion, deletion and update anomalies. Unsatisfactory relation schemas that do not meet certain conditions (called normal form tests) are decomposed into smaller relations that meet the tests and hence possess the desirable property.

Through normalisation we can achieve the following benefits:

1. Minimise redundancy
2. Minimise insertion abnormalities
3. Minimise deletion abnormalities
4. Minimise update abnormalities

Consider a relation which contain employee details and departments. There are certain problems in this type of data base. If we want to insert a new department without employees it can cause difficulties. Normally employee identification number ( or social security number etc.) may be a key value. We cannot keep it null. But if we have separate employee and department tables then such a problem will not raise. New department can be inserted in the department table and new employee will be entered into employee table and they do not interfere with each other.

What are the advantages of storing data pertaining to an application in a database management system compared to storing data in a file?

Storing data in a file system has the following disadvantages:

1. Data Redundancy and Inconsistency: There is a possibility that same data may be stored in several files. Various copies of same data in files may not agree leading to inconsistencies.

2. Difficulty in Accessing Data: It is difficult to access data from file systems. If data is stored in different files and if we want to access them from different places we need to manually access them from different files. Conventional file processing environment do not allow needed data to be retrieved in a convenient and efficient manner.

3. Data Isolation: Since data are scattered in various files and files may be in different formats, it is difficult to write new application programs to retrieve the appropriate data.

4. Atomicity Problem: It is difficult to perform roll back of partial transaction in case of failures in a file system. This leads to automicity problems.

5. Concurrent Access Anomalies: In file systems it is very difficult to implement concurrent access where multiple users are allowed to update the data simultaneously.

6. Security: Not all users must be allowed to access all the information. The users must be allowed to access only the relevant data. It is difficult to implement such things in classical file system.

Database systems are developed to overcome these difficulties. DBMS consist of a collection of interrelated data and a collection of programs to access data. The primary goal of DBMS is to provided an environment that is both convenient and efficient for people to use in retrieving and storing information.

What do you understand by Method Overloading ?

Method overloading is a logical method of calling several functions with arguments and data types that perform basically identical things by the same name. Suppose we want to find average of integers and floating point numbers, we can give same name. Also, we can have function with same name but different number of arguments.

What is the difference between call by reference and call by the value mechanisms?

There are two basic methods to pass arguments in functions. They are:

1. Function arguments passed by value.
2. Function arguments passed by reference.

When arguments are passed by value, the called function creates a new variable of same type as the argument and copies the arguments value in it. The function cannot access the original variable in the calling program. It can access only the copy it created. Passing arguments by value is useful when the function need not modify the original variable in the calling program.

Passing arguments by reference uses a different mechanism. Instead of a value being passed to the function, a reference to the original variable in the calling program is passed. It is the memory address of the variable that is passed. The advantage of passing by reference is that the function can access the actual variables in the calling program. Using this method, more than one value can be passed to the function. For passing objects call by reference is used.