.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!



Home >> Articles >> .Net Framework >> Post New Resource Bookmark and Share   

 Subscribe to Articles

18 most asked .NET , C# interview questions and answers Part 2

Posted By:Shivprasad koirala       Posted Date: May 23, 2011    Points: 200    Category: .Net Framework    URL: http://www.questpond.com  

In our previous article 18 .NET interview questions and answers  we saw some important questions around Arrays , array list , MVC , MVP , MVVM , architecture questions , SQL etc. After that article i got huge response and also added to the responses i got some questions which our readers felt where very important. I just extracted those questions , bundled them and that leads to our part 2 of the article. The above questions are scattered , but I have seen them now then been asked in many
 

18 most asked .NET , C#  interview questions and answers Part 2

By Shivprasad koirala.



Introduction
Question 1 :-What are Authentication, Authorization and it's different types?
Question 2:-What is Serialization in .NET ?
Question 3:-What problem does Ajax solve?
Question 4:-
How can we use XML files to map LINQ attributes to simple .NET classes?
Question 5:-What is the concept of features in SharePoint?
Question 6:-What is Normalization and its different forms?
Question 7:-Can you explain Forms authentication in detail?
Question 8:-What is Collation in SQL Server?
Question 9 :-What's the difference between WebParts in WSS 2.0 and 3.0?
Question 10:- What are Regex / regular expressions ?
Question 11:- What is the difference between unique key and primary key?
Question 12:-What are the various questions asked in C# and .NET interview?
Question 13:-How do we reference HTML controls using Atlas?
Question 14:-What is Shadowing?
Question 15:-How do we write a HttpModule ?
Question 16:-What the difference between Visitor and Strategy Pattern?
Question 17:-Can you explain one way and two way bindings?

Question 18:-How many Types of Relationship Exist in Database Designing?

Introduction

 

In our previous article 18 .NET interview questions and answers  we saw some important questions around Arrays , array list , MVC , MVP , MVVM , architecture questions , SQL etc.  After that article i got huge response and also added  to the responses i got some questions which our readers felt where very important. I just extracted those questions , bundled them and that leads to our part 2 of the article.

The above questions are scattered ,  but I have seen them now then been asked in many interviews. My intention of creating this series is never to show short cuts to developers for getting jobs ,but its more of like quick revision. I have seen .NET developers going to interview completely unprepared  and then you are there with a bit of preparation and you can always win as compared to other developers.

A unprepared and very smart .NET developer can be outperformed by average developer who has done his revision and home work. So lets enjoy the article.

If interested do view my 500 videos on .NET , C# , WCF , Silverlight , design patterns , ASP.NET , UML by click on .NET interview questions

If you want to have a overview of what kind of questions are asked in .NET interviews do click on this link http://youtu.be/pC3aLkf_A98?hd=1 where i have discussed from overall view of different questions asked during .NET and C# interviews,

If you want to understand the physcology of how .NET interviewer conducts interviewer click on this link  http://youtu.be/3PXspVcSSKE?hd=1

 

What are Authentication, Authorization and it's different types?

 You can also see the video on Authentication & Authorization at http://youtu.be/VcQrqqyUA2A
Answer:

Authentication:  Who the user is? or Authentication is process of Identifying the user is valid or not from the database.
Authorization:    To Identify what kind of authority or rights does user has.

Different Types:

In ASP.NET there are three way to do Authentication and Authorization.

1)Windows Authentication:
                                    In this methadology ASP.NET web pages will use local windows users and groups to authenticate and authorize resources.

2)Forms Authentication:
                                   This is a cookie based authentication where user name and password stored on client machine as cookie files or they are sent to URL for every request. Form-based authentication presents the users with an HTML-based web page that prompts the user for credentials.In case browser doesnot support cookies then username and password passed via URL string for every request.

3)Passport Authentication:
                                     Passport authentication is based on passport website provided by the microsoft.So when user logins with credentials it will be reached to the passport website(i.e. hotmail,devhood,windows live etc) where authentication will happen.If authentication is successful it will return a token to your website.

Following is the video for Authentication and Authorization

 

What is Serialization in .NET ?

Answer:
 

Serialization is a process by which we can save the state of the object by converting the object in to stream of bytes.These bytes can then be stored in database, files, memory etc.

Below is a simple code of serializing the object.

 

MyObject objObject = new MyObject();

objObject.Value = 100;              

 

// Serialization using SoapFormatter

SoapFormatter formatter = new SoapFormatter();

Stream objFileStream = new FileStream("c:\\MyFile.xml", FileMode.Create, FileAccess.Write, FileShare.None);

formatter.Serialize(objFileStream, objObject);

objFileStream.Close();

 

Below is simple code which shows how to deserialize an object.

 

//De-Serialization

Stream objNewFileStream = new FileStream("c:\\MyFile.xml", FileMode.Open, FileAccess.Read, FileShare.Read);

MyObject objObject =(MyObject)formatter.Deserialize(objNewFileStream);

objNewFileStream.Close();

 

View my top 21 .NET Interview questions and answers

 

 

What problem does Ajax solve?

Answer:
 

In order to answer this question first lets understand how does browser and server work when we request any website. Below figure depicts pictorially the web environment. When client sends data to the server it post backs form element data, hidden fields,images,cookie information to the server and server make the page and sends the same information back to the browser. The bad part this happens with every request and response.
Below are the issues with the above model:

  • Unnecessary data transfers: - In the above model, unnecessary data is transferred between client and server. For instance, the whole page is posted and refreshed even when we want small data of the page to be refreshed.

.NET Interview questions , C# Interview questions , ASP.NET Interview Questions , SQL Server interview questions

 

Figure :- The problem

  • Synchronous processing: - When a user requests for a page he has to wait until the complete round trip happens. In short, the request / response work on a synchronous model rather than asynchronous which makes user experience very difficult. How many times it has happened that you are requesting a page and you see the below screen.frustrating right.

Figure :- Synchronous processing

  • Unnecessary processing by server: - Because we are posting unnecessary information to the server, the server is overloaded with unnecessary processing.

 

How can we use XML files to map LINQ attributes to simple .NET classes?

Answer:
 

LINQ had provided attribute based XML mapping. So you can have your pure .NET class like the 'clsCustomer' class shown below and you can define the LINQ mapping in a XML file. LINQ engine can then read the mapping from a XML file and apply the same to your simple .NET classes.

 .NET Interview questions , C# Interview questions , ASP.NET Interview Questions , SQL Server interview questions

public class clsCustomer
{
private int _intCustomerId;
private string _strCustomerName;
private string _strCustomerCode;

public int CustomerId
{
set
{
_intCustomerId = value;
}
get
{
return _intCustomerId;
}
}
public string CustomerName
{
set
{
_strCustomerName = value;
}
get
{
return _strCustomerName;
}
}
public string CustomerCode
{
set
{
_strCustomerCode = value;
}
get
{
return _strCustomerCode;
}
}}

We need to then create a simple XML file which defines the mapping with the class members.
 







\
To bind the XML mapping with the simple .NET class we need to first create the XMLMappingSource object as shown in the below code snippet.
 
XmlMappingSource xms = XmlMappingSource.FromUrl(physicalPath + "Mapping.xml");

 We need to pass the XMLMappingSource object to the datacontext class shown in the below code snippet.
 

DataContext objContext = new DataContext(strConn, xms);

Finally we can get the table and loop through the entity objects.
 

var query = from customer in objContext.GetTable()
select customer;

foreach (var item in query)
{
Response.Write(item.CustomerCode + "
"); }
What is the concept of features in SharePoint?
Answer:

Whenever we think about SharePoint think in terms of collaboration. One of the much needed features in collaboration is on-demand functionality / feature activation. Feature makes it easier to activate and deactivate functionality in SharePoint.

Some points which you should note about features:-

. All features needs to be copied in "C:\Program Files\Common Files\Microsoft Shared\Web server extensions\12\Template\FEATURES\" directory. Microsoft Share reads the features from this directory. If you open the directory you can find pre-installed features by Share Point as shown below.

.NET Interview questions , C# Interview questions , ASP.NET Interview Questions , SQL Server interview questions

. Every feature will have two XML files one is the 'Feature.xml' and the other is 'ElementManifest.xml'.

.NET Interview questions , C# Interview questions , ASP.NET Interview Questions , SQL Server interview questions

. Share point understands there is a feature by reading the feature XML file from the features folder.
. All features are identified by a unique GUID number.
. Features emit events which can be captured to write custom code. These events are captured in assembly which needs to be registered in a GAC.
kya
. Summarizing what we discussed we have a 'feature.xml' which points to an assembly which captures the feature events for custom code. It also other XML file which defines what exactly this feature will do.

.NET Interview questions , C# Interview questions , ASP.NET Interview Questions , SQL Server interview questions

What is Normalization and its different forms?

Answer:
Normalization is the process of organizing the table's data in proper manner.
In other words Normalization is the process of breaking up data into a logical non-repetitive format that can be easily reassembled as a whole.

Normalization have 3 different forms namely 1Normal Form,2Normal Form,3Normal Form.

1Normal Form:
A table is said to be in 1NF if it satisfies the following rules.
 . The table must not contain any redundant groups of data
 . data must be broken up into the smallest units possible. In addition to breaking data up into the smallest meaningful values.

2Normal Form:
 A table is said to be in 2NF if it satisfies the following rules.
 . The table must be in 1NF
 . All the non-key column must depend on primary key.

3Normal Form:
A table is said to be in 3NF if it satisfies the following rules.
 . The table must be in 2NF
 . A non-key field should not depend on another Non-key field.
 . The data should not be derived further.

For ex:
Below table is in denormalize format:

CustomerName Region Product Quantity PerProduct Total
Shivprasad Bist India,Mumbai Shirt 2 10 20
Raju Bist India,Gujrat Pant 2 30 60
Moosa Shaikh India,Chennai Pant 4 15 60
Feroz Shaikh India,Gujrat Shirt 2 10 20

Applying Normalization on this table.
1NF:After applying 1NF the table look like

CustomerFirstName CustomerLastName Country State Product Quantity PerProduct Total
Shivprasad Bist India Mumbai Shirt 2 10 20
Raju Bist India Gujrat Pant 2 30 60
Moosa Shaikh India Chennai Pant 4 15 60
Feroz Shaikh India Gujrat Shirt 2 10 20

The customer Name is divided into two units like Customer FirstName and Customer LastName.
Region field is also divided into two units like Country and State.

2NF:After applying 2NF the table look like

CustomerFirstName CustomerLastName Country State Product Quantity PerProduct Total
Shivprasad Bist 1 1 2 2 10 20
Raju Bist 1 2 1 2 30 60
Moosa Shaikh 1 3 1 4 15 60
Feroz Shaikh 1 2 2 2 10 20

CountryTable

CountryId CountryName StateId StateName
1    India 1 Mumbai
    2 Gujrat
    3 Chennai

ProductTable

ProductId  ProductName
1 Pant
2 Shirt

For avoiding duplication Create a new master table of Country and Product.

3NF:After applying 3NF the table look like 

CustomerFirstName CustomerLastName Country State Product Quantity PerProduct
Shivprasad Bist 1 1 2 2 10
Raju Bist 1 2 1 2 30
Moosa Shaikh 1 3 1 4 15
Feroz Shaikh 1 2 2 2 10

A non key field Total is removed from the table. 

Can you explain Forms authentication in detail?

Answer: -
In old ASP if you where said to create a login page and do authentication you have to do hell lot of custom coding. Now in ASP.NET that has made easy by introducing Forms authentication. So let us see in detail what form authentication is.
Forms authentication uses a ticket cookie to see that user is authenticated or not. That means when user is authenticated first time a cookie is set to tell that this user is authenticated. If the cookies expire then Forms authentication mechanism sends the user to the login page.

Following are the steps, which defines steps for Forms authentication:-

. Configure Web.config file with forms authentication. As shown below in the config file you can see we have give the cookie name and loginurl page.





loginUrl="login.aspx"
protection="All"
timeout="30"
path="/" />




. Remove anonymous access to the IIS web application, following are changes done to web.config file.








. Create the login page, which will accept user information. You will have create your login page that is the Login.aspx, which will actually take the user data.

. Finally a small coding in the login button.
Let us assume that the login page has two textboxes TX name and txtapssword.
Also, import System.Web.Security and put the following code in login button of the page.

If Page.IsValid Then
If FormsAuthentication.Authenticate(txtName.Text, txtPassword.Text) Then
FormsAuthentication.RedirectFromLoginPage(txtName.Text, False)
Else
lblStatus.Text = "Error not proper user"
End If
End If

 

What is Collation in SQL Server?
Answer:
 

Collation refers to a set of rules that determine how data is sorted and compared. Character data is sorted using rules that define the correct character sequence, with options for specifying case-sensitivity, accent marks, kana character types, and character width.

.NET Interview questions , C# Interview questions , ASP.NET Interview Questions , SQL Server interview questions

Collation according to language

Note: - Different languages will have different sort orders.

Case Sensitivity

If A and a, B and b, etc. are treated in the same way, then it is case-insensitive. A computer treats A and a differently because it uses ASCII code to differentiate the input. The ASCII value of A is 65, while a is 97. The ASCII value of B is 66 and b is 98.

Accent Sensitivity

If a and A, o and O are treated in the same way, then it is accent-insensitive. A computer treats a and A differently because it uses ASCII code for differentiating the input. The ASCII value of a is 97 and A 225. The ASCII value of o is 111 and O is 243.

Kana Sensitivity

When Japanese kana characters Hiragana and Katakana are treated differently, it is called Kana sensitive.

Width Sensitivity

When a single-byte character (half-width) and the same character when represented as a double-byte character (full-width) are treated differently then it is width sensitive.

 

What's the difference between WebParts in WSS 2.0 and 3.0?

Answer:
Ok, first let's talk about a bit of history. 'WebParts' was born when WSS 2.0 was first introduced. In ASP.NET 2.0 framework new version of 'WebPart' was built which can run with out WSS. WSS 3.0 uses the ASP.NET 2.0 'WebPart' framework.

So some quick points:-

  • If you are doing new development using WSS 3.0 you should use ASP.NET 2.0 'WebPart' framework.

  • If you want backward  compatibility you an use 'Microsoft.SharePoint.WebPartPages.WebPart'  class.

So the decision will  be more based on what level of back ward compatibility you are looking for.

Below sheet shows the new WebPart classes as compared to SharePoint Backward compatible class.

 

 

What are Regex / regular expressions ?

Answer:
 

Regex or regular expression helps us describe complex patterns in texts. Once you have described these patterns you can use them to do searching, replacing, extracting and modifying text data.

Below is a simple sample of regex. The first step is to import the namespace for regular expressions.

using  System.Text.Regular Expressions;

 

The next thing is to create the regex object with the pattern. The below pattern specifies to search for alphabets between a-z with 10 length.

Regex obj = new Regex("[a-z]{10}");

 

Finally search the pattern over the data to see if there are matches. In case the pattern is matching the 'IsMatch' will return true.

Message Box. Show(obj.IsMatch("shivkoirala").ToString());

What is the difference between unique key and primary key?
http://youtu.be/8iIvyNPwruU

Answer:
This is a typical SQL Server interview question and below is the comparison sheet.

 

Unique Key

Primary Key

Unique key can have nulls

Primary key cannot have nulls.

In a single table we can create multiple unique keys.

In a single table we can have only one primary key.

It creates a non-clustered index by default.

It created a clustered index by default.

Both unique keys and primary keys can be referenced by foreign key.

 

What are the various questions asked in C# and .NET interview?
Answer:

The following are the 4 basics section for the interview purpose and below is the diagram to understand in better manner.

  • .NET basics
  • New Technologies
  • Architecture
  • Process
     

.NET Interview questions , C# Interview questions , ASP.NET Interview Questions , SQL Server interview questions

.NET basics include the questions on the following sections.

  • Basics of .NET
  • OOPS
  • SQL Server
  • ADO.NET
  • ASP.NET
  • Web Services

New Technologies includes the questions on the following sections.

  • WCF
  • WPF/Silverlight
  • LINQ/Entity framework
  • Azure
  • WWF

Architecture includes the questions on the following sections.

  • Design Patterns
  • MVC MVP MVVM
  • UML
  • Documentation
  • Requirement to design

Process includes the questions on the following sections.

  • Agile Estimation
  • FPA
  • CMMI
  • Six Sigma

.NET basics

Following questions are related to fundamentals of .NET.

  • What is CLR, CTS, CTS, IL Code?
  • What is Value type, Reference type and Stack, Heap Memory?
  • What is Garbage Collector and working of Garbage Collector?
  • What are GAC, Delegate, Event, and JIT?

Following questions are related to object oriented programming system (OOPS).

  • Why we need OOPS concept?
  • What are the different Principals of OOPS?
  • How to implement Abstraction, Encapsulation, Inheritance and Polymorphism?
  • What are Abstract Class and Interface and differences? What are the Classes and Object?

Following questionsis related toSQL Server.

  • What are SQL Queries, Sub Queries?
  • What are Joins and its different types?
  • What are Normalization, Denormalization and Performance Tuning?
  • What are Indexes, Clustered Indexes?

Following questions is related to ADO.NET.

  • What are Dataset, Data Reader and Data Adapter?
  • What are Connection Object and Connection String?

Following questions is related to ASP.NET.

  • What are the Session Variable, Application and Cache Object?
  • What isServer.Transfer and Response.Redirect?
  • Difference between Server.Transfer and Response.Redirect?
  • What is Authentication and Authorization?

Following questions is related to Web Services.

  • What is WSDL?
  • What are ASMX, SOAP?

New Technologies

Following questions is related to WCF.

  • What are Operation Contract, Service Contract and Data Contract?
  • What is Data Member?
  • What are Address Binding and Contract Binding?
  • What do you mean End points?

Following questions is related toWPF/Silverlight.

  • What are XAML, XAP?
  • What is Silverlight Architecture?
  • What is MVVM pattern and RIA Services.

Following questions is related toLINQ/Entity framework.

  • What are the three main components on LINQ?
  • What is the use LINQ and Entity Framework?
  • What are Data Context Object and Entity Object?
  • What are LINQ DBML and LINQ EDMX?

Following questions is related toAzure.

  • What is Cloud Computing?
  • What are blobs, tables and Queues?

Following questions is related toWWF.

  • What areSequential Workflow and State Machine Workflow?

Architecture

Following questions is related to Design Pattern.

  • What is Factory Design Pattern?
  • What areSingleton Design Pattern and Iterator?

Following questions is related to MVC, MVP and MVVM.

  • Define MVC, MVP and MVVM?
  • What is MVC template and when to use?

Following questions is related toUML.

  • What are Use cases?
  • What is Activity diagram and Class diagram?

Following questions is related toDocumentation.

  • What areRequirement document and Design document?
  • What is test plan?
Following questions is related toRequirement Design.
  • How will you go from Requirement to Design?

Process

Following questions is related toAgile.

  • What are Scrum Backlog Template and Simple Backlog Template?

Following questions is related toEstimation FPA.

  • What are EI, EO, EQ and EIF?

Following questions is related toCMMI.

  • What is meant by Key Process Area (KPA)?
  • What are the different five level of CMMI?

Following questions is related toSix Sigma.

  • What is Six Sigma?
  • What is the importance's of Six Sigma?
  • What are Six Sigma Yellow Belt and Black Belt?

 

How do we reference HTML controls using Atlas?

Answer:

You can reference the above HTML defined button using the below code snippet of JavaScript. We have also attached the on click method with the button. This method will be called when we click
 the button.

var btnVisibility = new Sys.UI.Button($('Button1'));
btnVisibility.intialize();
btnVisibility.click.add(onClick);

You can refer other HTML elements like Label, Textbox m Checkbox, Hyperlinks etc using the Sys.UI.

Note: - We have added some extra questions in this edition for Ajax as promised. In CD we have provided 'AtlasSetup'. This you need to install to get the below Ajax project template in VS.NET 2005.

.NET Interview questions , C# Interview questions , ASP.NET Interview Questions , SQL Server interview questions

Figure :- Ajax template

One more thing to ensure before we start Ajax is to add the Ajax controls on the tool box. So do the following right click on the tool box ? click choose items ? click 'Browse' button ? add 'C:\Program Files\Microsoft ASP.NET\Atlas\v2.0.50727\Atlas\Microsoft.Web.Atlas.dll'. Once done you should see some new components as shown in figure 'Ajax controls'. Now we are ready to see how Ajax works.

 

.NET Interview questions , C# Interview questions , ASP.NET Interview Questions , SQL Server interview questions

Figure:-Ajax control

 

What is Shadowing?

Answer:
Shadowing is a concept of altering the behaviour of the base class member. It basically replaces complete element of the parent class like method becomes a variable.

For example: In the below example in class1 'i' is declared as variable whereas in class2 'i' is declared as a method.

class Program
    {
        static void Main(string[] args)
        {
            class1 obj = new class1();
            class2 obj1 = new class2();
            obj1.i();                 //here i is treated as method
            Console.WriteLine(obj.i); //here i is treated as variable
            Console.ReadLine();
        }
    }
    class class1
    {
        public int i=2;
    }
    class class2 : class1
    {
        public void i()
        {
            Console.WriteLine("Hello World");
        }
    }
 

How do we write a HttpModule ?

Answer:
Again a simple .NET Interview question Writing a HttpModule is a two step process.

Create a class which implements IhttpModule.

 

public class clsHttpModule : IHttpModule
{

    public void Init(HttpApplication context)
    {
       this.httpApp = context;
       httpApp.Context.Response.Clear();
       httpApp.AuthenticateRequest += new EventHandler(OnAuthentication);
       httpApp.AuthorizeRequest += new EventHandler(OnAuthorization);
 ....
 ....
 ....
       }
   void OnAuthorization(object sender, EventArgs a)
    {
        //Implementation
    }
    void OnAuthentication(object sender, EventArgs a)
    {
      
        //Implementation
    }
   
}

Make a entry in the web.config file.
 

 

What the difference between Visitor and Strategy Pattern?
 

Answer:
Visitor and strategy look very much similar as they deal with encapsulating complex logic from data. We can say visitor is more general form of strategy.

In strategy we have one context or a single logical data on which multiple algorithms operate. In the previous questions we have explained the fundamentals of strategy and visitor. So let's understand the same by using examples which we have understood previously. In strategy we have a single context and multiple algorithms work on it. Figure 'Strategy' shows how we have a one data context and multiple algorithm work on it.

.NET Interview questions , C# Interview questions , ASP.NET Interview Questions , SQL Server interview questions

                                                                                                                                    Figure: - Strategy

In visitor we have multiple contexts and for every context we have an algorithm. If you remember the visitor example we had written parsing logic for every data context i.e. customer, address and phones object.

.NET Interview questions , C# Interview questions , ASP.NET Interview Questions , SQL Server interview questions

Figure: - Visitor


So in short strategy is a special kind of visitor. In strategy we have one data context and multiple algorithms while in visitor for every data context we have one algorithm associated. The basic criteria of choosing whether to implement strategy or visitor depends on the relationship between context and algorithm. If there is one context and multiple algorithms then we go for strategy. If we have multiple contexts and multiple algorithms then we implement visitor algorithm.

 

Can you explain one way and two way bindings?

Answer:
One way binding

As the name so the behavior. In one way bindings data flows only from object to UI and not vice-versa. For instance you can have a textbox called as 'TxtYear' which is binded with an object having property 'Year'. So when the object value changes it will be reflected on the silverlight UI, but the UI cannot update the year property in the object.

.NET Interview questions , C# Interview questions , ASP.NET Interview Questions , SQL Server interview questions

It's a three step procedure to implement one way binding. First create your class which you want to bind with the silverlight UI.  For instance below is a simple class called as 'ClsDate' with a 'Year' property.

public class clsDate
{
private int _intYear;
public int Year
{
set
{
_intYear = value;
}
get
{
return _intYear;
}
}
}

In the second step you need to tie up the 'Year' property with a silver light UI text box. To bind the property you need to specify 'Binding Path=Year' in the text property of the text box UI object. 'Year' is the property which we are binding with the text box UI object.

The final step is to bind the text box data context with the date object just created.
public partial class Page : UserControl
{
public Page()
{
InitializeComponent();
clsDate objDate = new clsDate();
objDate.Year = DateTime.Now.Year;
txtCurrentYear.DataContext = objDate;
}
}
Two way binding

Two way binding ensure data synchronization of data between UI and Objects. So any change in object is reflected to the UI and any change in UI is reflected in the object. .NET Interview questions , C# Interview questions , ASP.NET Interview Questions , SQL Server interview questions

To implement two way binding there are two extra steps with addition to the steps provided for 'OneWay'.  The first change is we need to specify the mode as 'TwoWay' as shown in the below XAML code snippet.

Second change is we need to implement 'INotifyPropertyChanged' interface. Below is the class which shows how to implement the 'INotifyPropertyChanged' interface. Please note you need to import 'System.ComponentModel' namespace.

public class clsDate : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private int _intYear;
public int Year
{
set
{
_intYear = value;
OnPropertyChanged("Year");
}
get
{
return _intYear;
}
}
private void OnPropertyChanged(string property)
{
if (PropertyChanged != null)
{
PropertyChanged(this,new PropertyChangedEventArgs(property));
}
}}
The binding of data with data context is a compulsory step which needs to be performed.

How many Types of Relationship Exist in Database Designing?

Answer:
There are three major relationship models:
  • One-to-one

    .NET Interview questions , C# Interview questions , ASP.NET Interview Questions , SQL Server interview questions

     One-to-One relationship ER diagram

     

  • One-to-many
    In this many records in one table correspond to the one record in another table.
    Example: Every one customer can have multiple sales. So there exist one-to-many relationships between customer and sales table.

    One Asset can have multiple Maintenance. So Asset entity has one-to-many relationship between them as the ER model shows below.

    .NET Interview questions , C# Interview questions , ASP.NET Interview Questions , SQL Server interview questions

    One-to-Many Relationship ER diagram

     

  • Many-to-many
    In this, one record in one table corresponds to many rows in another table and also vice-versa.
    For instance: In a company, one employee can have many skills like Java , C# etc. and also one skill can belong to many employees.

    Given below is a sample of many-to-many relationship. One employee can have knowledge of multiple Technology. So in order to implement this, we have one more table Employee Technology which is linked to the primary key of Employee and Technology table.

    .NET Interview questions , C# Interview questions , ASP.NET Interview Questions , SQL Server interview questions

     Many-to-Many Relationship ER diagram

 


 Subscribe to Articles

     

Further Readings:

Responses
Author: Sunil Yadav         Company URL: http://www.sunilyadav.net
Posted Date: May 27, 2011

Nice article!

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend