What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 8192 |  Welcome, Guest!   Register  Login
 Home > Interview Questions > Exclusive Interview Questions > Exclusive .NET Framework Interview Questions
  • A joint initiative from DotNetFunda.Com and Questpond.
  • A one stop place on the internet to get trusted and proven Interview Questions (based on more than a decade of experience in this field) to ensure the success of the candidates.
  • You will find almost all Interview questions from Questpond here and this list is growing day by day with all latest and updated interview questions.

Get Questpond's 500+ .NET Interview preparation videos on discounted price.



Page copy protected against web site content infringement by Copyscape

In this .NET Interview questions interviewer expects two things. First the importance of configuration and second in which scenarios are the above file applicable. So lets answer the question in two parts.


The importance of config files
==================================================
App.config, web.config and machine.config are files which store configuration data in XML


format. We need configuration data at application level or at machine/server level.


Scenarios in which the above config files are used
===================================================
Machine.config file stores configuration information at system level. It can contain configuration information like timeout in ASP.NET application, requestLimit, memoryLimit, and ClientConnectedCheck etc.


Generally we have two kinds of application web application and windows application. Web.config file stores configuration data for web applications and app.config file store configuration information for windows application.


Application level configuration data can be like connection strings,security etc.


Some connected questions from this question which the interviewer can ask
================================================================================
Where do you store connectionstring ?.
How do you encrypt connection string?
How do you read configuration data from web.config or app.config file in .NET ?
Can we have two web.config files for a web application.


Regards,




 


This is again one those typical .NET Interview questions which move around interfaces to confuse the developer.


For providing different implementation you can qualify the method names with interface names as as shown below. A reference to I1 will display "This is I1" and reference to I2 will display "This is I2". Below is the code snippet for the same.

interface I1 
{
void MyMethod();


interface I2 

void MyMethod(); 


class Sample : I1, I2 

public void I1.MyMethod() 


Console.WriteLine("This is I1"); 
}
public void
I2.MyMethod() 

Console.WriteLine("This is I2"); 

}  
}


50 .NET Interview questions and answers 


 


This is a very typical .NET  interview question which confuses most of the .NET professionals. Both abstraction and encapsulation look similiar , but they have huge differences between them.


Abstraction is nothing but simplifying objects while encapsulation is hiding complexity.


Encapsulation implements abstraction. Abstraction is a thought process which happens during planning phase.  While encapsulation implements abstraction by using access modifiers ( private,public, protected,internal and protected internal).


Regards,


Below is a simple customer table with 3 fields code , name and amount. Can you select the customer with second lowest amount. This is one of the favorite questions which is asked to test your SQL Server skills.
























Code Name Amount
1001 pqr 200.00
1002 raju 100.00
1004 shiv 300.00
1007 shaam 400.00

Below is the answer. It can be accomplished by using sub queries. First select the min and then get all records which are more than the min and select top 1 from the same. Below goes the query.

select top 1 * from tbl_Customer touter where touter.Amount > (SELECT
min(tinner.Amount)
  FROM [Customer].[dbo].[tbl_Customer] as
tinner)
  order by touter.Amount asc


Some time interviewers can trick you questions like select the second top. In the subquery we just need to change the same to max.


 


This question is one of the favorites question which comes during c# interviews  and the interviewer is not only expecting which one of them is more efficient. But he is also expecting the reason for the same.


In order to understand the same better lets consider the below scenario where we have two lines of code which does string concantenation.


For a simple string concantenation code shown below it will create 3 copies of string in memory.


 

//The below line of code Creates one copy of the string
string str =
"shiv";

/* The below line of  code creates three copies of string object one for
the concatenation  at right hand side and the other for new value at the
left hand side. The first old allocated memory is sent for garbage
collection.*/
str = str + "shiv";


When you use the string builder for concatenation it will create only one copy of the object.


 

/* The below code uses string builder and only one
object is created as
compared to normal string where we have 3 copies created*/
StringBuilder
objBuilder = new StringBuilder();
objBuilder.Append("shiv");


Ok now summarizing what should we say to the interviewer.


String is immutable. Immutable means once assigned it can not be changed. Thats why it creates more copies of the object as it can not use the same instance.String builder is mutable , in other words the same object will changed rather than creating new objects.


So string builder is more efficient as compared to simple string concatenation.


Regards,


These kind of questions are very generic. Just pick up 5 best tips you know our have implemented and say it before the interviewer. Below goes my 5



  • Use stringbuilder as compared to normal string concatenation.
  • Use stored procedure rather than inline sql code.
  • Use caching for  frequently used data.
  • Use generics collection as compared to simple collection , to avoid boxing / unboxing.
  • Remove unnecessary boxing and unboxing code.
  • In case you are using unmanaged code use the dispose final function for clean up.



When we use normally .NET collection objects there is lot of boxing and unboxing. When we create a  collection which is a generic collection its strongly typed. As its strongly typed boxing and unboxing gets eliminated and thus increasing performance.




This is again a very nice .NET interview question and  the question can be confusing because of the common word "render". Now ASP.NET page has 4 important events. Init , Load , validate , event and render (Remember SILVER).

Now the final render is a actually a two step process.


1- First the ASP.NET UI objects are saved in to view state.
2- loaded viewstate is assembled to create the final HTML.


The first step is pre-render event and the second step is the render event.


Prerender


This is the event in which the objects will be saved to viewstate.This makes the PreRender event the right place for changing properties of controls or changing Control  structure.Once the PreRender phase  is done those changes to objects are locked in and the viewstate can not be changed. The PreRender step can be overridden using OnPreRender event.


Render.


Render event assembles the HTML so that it can be sent to the browser.In Render event developers can write custom HTML  and override any HTML which is created till now.The Render method takes an HtmlTextWriter object as a parameter and uses that to output HTML to be streamed to the browser. Changes can still be made at this point, but they are reflected to the client only i.e. the end browser.




Both the above concepts are rarely used by developers but mostly asked in .NET interviews ;-).

The prime  and common goal of HttpHandler and httpModule is to inject pre-processing logic before the ASP.NET request reaches the IIS server.


HttpHandler is a extension based processor in other words pre-processing logic is executed depending on file extensions. For instance sometimes you would like to check that a person should be above age of 18 if he is trying to view any  files with extension *.MP4.


HttpModule is event based processor. ASP.NET engine emits out lot of events as the request traverses over the request pipeline. Just to name some events beginrequest,authorizerequest,authenticaterequest etc. By using HttpModule you can write logic in these events. These logic get executed  as the events fire and before the request reaches IIS server.


So a short answer for the above .NET interview question would be HttpHandler is a extension based processor while HttpModule is a event base processor. Both of them help to inject pre-processing logic before the ASP.NET request reaches the IIS server.




This is again a great c# interview question , but .NET professionals tend to answer this question in one liners like i am a developer , project manager.


In todays world people expect professionals who can do multitasking. The best way to approach the answer is by explaining what things did you do in the complete SDLC cycle. Below goes my version of the answer , you can tailor the same as per your needs.


My main role in the project was coding , unit testing and bug fixing. Said and done that i was involved in all phases of the project.

I worked with the business analyst in the requirement phase to gather requirements and was a active member in writing use cases.

I also assisted the technical architect in design phase. In design phase i helped the architect in proof of concept  and putting down the technical design document.

My main role was in coding phase where i executed project with proper unit testing.

In system integration test and UAT i was actively involved in bug fixing.


Other than the project i help COE team for any kind of RND and POC work.


In case you are doing some extra activities in the company like helping COE , presales team or any other initative do speak about the same.


Regards,


This is again a typical collection .NET interview question. Dictionary is faster than hashtable as dictionary is a generic strong type. Hashtable is slower as it takes object as data type which leads to boxing and unboxing.


Below goes the same code for hashtable and dictionary.


 

Hashtable hashtable = new Hashtable();
hashtable[1] =
"One";
hashtable[2] = "Two";
hashtable[13] = "Thirteen";


 

var dictionary = new Dictionary<string,
int>();
dictionary.Add(i.ToString("00000"),
10);
dictionary.Add(i.ToString("00000"), 11);


 


Regards,




The above c# interview question is asked to ensure if you have used coding standards in your project. All the above 3 things are  nothing but naming conventions which are followed in programming languages to ensure a clean code. Below is the explanation of each naming convention.


Pascal Notation- In this naming convention all starting letter of the words are in Upper Case and other characters are lower case.


Example: SupplierCode


Camel Notation- In this naming convention first character of all words, except the first word are Upper Case and other characters are lower case.


Example: supplierCode


Hungarian notation - In this naming convention the variable name starts with group of small letter which indicate data type.


Example: bLoop ( b indicates its a boolean type),iSum ( i indicated its a integer data type).


Regards,


This is a very general .NET interview question.

Normally properly planned companies have a checklist of what kind of naming convention to follow. In .NET interview its very difficult to speak about the whole checklist as we have limited time.

The expectation of the interviewer is that you should speak about pascal,camel and hungarian naming conventions and where did you use what.So below goes a short answer.


Our organization had a naming convention document which was supposed to be followed by all projects in the organization. As per the document we where using three types of naming conventions across the project :- Pascal , Camel and Hungarian.


All class names , function names , method names , namespace names where using pascal convention. i.e the first letter capital with every first word capital.ex CustomerCode


All variables , input/output variable , local variables , class level variable , global variables where using Camel notation. i.e. the first letter small and then the first letter of the subsequent words capital.ex count , customerData


For the UI obejct we where using hungarian notation. In this the prefix defines the datatypes i.e. txtCode , cmbCountries.


For database we used Hungarian notation where the prefix defines the data base object types. i.e. tblCustomer , uspSelectCustomer,fngetValue,trgInsert.


Regards,


This is a very popular c# interview question.In 3 tier architecture / layer we divide the project in to 3 layers UI , Middle  and DAL.  Due the modular approach we have 2 big advantages


Reusability :- You can reuse the middle layer with different user interfaces like ASP.NET , windows etc. You can also reuse you DAL with different projects.


Maintainability :-  When we change in one layer due to the modular approach it does not have ripple effect on other layers. we have to do less amount of changes in other layer when we change logic of one layer.


Regards,


This is one of those .NET interview question which is asked from the perspective to test if you understand the importance of private constructors in a class.


When we declare a class constructor as private , we can not do 2 things:-



  • We can not create a object of the class.
  • We can not inherit the class.

Now the next question which the interviewer will ask , whats the use of such kind of class which can not be inherited neither instantiated.


Many times we do not want to create instances of certain classes like utility , common routine classes. Rather than calling as shown below


 

clsCommon common = new clsCommon();
common.CheckDate("1/1/2011");


You would like to call it as


 

clsCommon.CheckDate("1/1/2011");




If these Interview Questions helped, link it from your blog/website or share using below social networking websites icon. Page copy protected against web site content infringement by Copyscape

Navigate to Page: 1 | 2 | 3 | 4 |

 More .NET Framework Interview Questions and Answers here


Found interesting? Add this to:


About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/26/2013 5:00:20 AM