Anup Shah on WPF and Silverlight (Programming Garden)

IT 's For You!!!

Wednesday, February 15, 2012

Ques.


************************************************************
Difference between DataSet and DataReader 
************************************************************
DataReader 
=========== 
DataReader is like a forward only recordset. It fetches one row at a time so very less network cost compare to DataSet(Fethces all the rows at a time). DataReader is readonly so we can't do any transaction on them. DataReader will be the best choice where we need to show the data to the user which requires no transaction. As DataReader is forward only so we can't fetch data randomly. .NET Data Providers optimizes the datareader to handle huge amount of data.
 

DataSet
 
=======
 
DataSet is an in memory representation of a collection of Database objects including tables of a relational database schemas.
 
DataSet is always a bulky object that requires a lot of memory space compare to DataReader. We can say that the DataSet is a small database because it stores the schema and data in the application memory area. DataSet fetches all data from the datasource at a time to its memory area. So we can traverse through the object to get the required data like querying database.







************************************************************
What is the difference between app.config, web.config and machine.config ?
************************************************************

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.


************************************************************
What is Encapsulation?
***********************************************************

  • Encapsulation is one of the fundamental principles of object-oriented programming.
  • Encapsulation is a process of hiding all the internal details of an object from the outside world
  • Encapsulation is the ability to hide its data and methods from outside the world and only expose data and methods that are required
  • Encapsulation is a protective barrier that prevents the code and data being randomly accessed by other code or by outside the class
  • Encapsulation gives us maintainability, flexibility and extensibility to our code.
  • Encapsulation makes implementation inaccessible to other parts of the program and protect from whatever actions might be taken outside the function or class.
  • Encapsulation provides a way to protect data from accidental corruption
  • Encapsulation hides information within an object
  • Encapsulation is the technique or process of making the fields in a class private and providing access to the fields using public methods
  • Encapsulation gives you the ability to validate the values before the object user change or obtain the value
  • Encapsulation allows us to create a "black box" and protects an objects internal state from corruption by its clients.

, ,

No comments:

Post a Comment