1. What is the difference between a Struct and a Class?
When you instantiate a class, it will be allocated on the heap.When you instantiate a struct, it gets created on the stack. You will always be dealing with reference to an
When passing a class to a method, it is passed by
You cannot have instance Field initializers in structs.
Classes can have explicit parameterless constructors.
Classes must be instantiated using the new operator. But structs can be instantiated without using the new operator.
MyStruct aStructObj;aStructObj.myVar=100;// no exception.
Classes support inheritance.But there is no inheritance for structs. ( structs don't support inheritance polymorphism )
class MyClass : MyStruct // Syntax error.
struct MyStruct : MyClass // Syntax error.
Since struct does not support inheritance, access modifier
class MyClass //No error( No matter whether the Field
struct MyStruct // Error ( Field ' MyStruct.myString ' must
Classes are used for complex and large set data. structs are
2. What does the term immutable mean?
temp = temp + "new value"
a new object is created, and values is saved in that.
An object qualifies as being called immutable if its value
3. Can we have private constructor? When can I
Ans. Private constructors would be mainly used for singleton
The idea of the singleton is that you don't have a public
An example below...
// .NET Singleton
Obviously you'd need to add some properties and methods to get something useful, but you get the idea. Watch out for
This link may give more insight: ttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpatterns/html/ImpSingletonInCsharp.asp
4.Explain the differences between Server-side and
5. What type of code (server or client) is found in
6.Should validation (Did the user enter a real date?)
Validation is usually done using client-side script like
.NET provides 5 + 1 controls for validation
7.What does the "EnableViewState" property do? Why
When a form is submitted in classic ASP, all form values
When a form is submitted in ASP .NET, the form reappears in
The status is defined through a hidden field placed on each page
Maintaining the ViewState is the default setting for ASP.NET
8. What is the difference between Server.Transfer and
Ans. Server.Transfer will prevent round trip. it will
Response.Redirect : There is a round trip to process the
A common misconception is the difference between Server.Transfer and Response.Redirect in ASP.NET applications. Redirect and Transfer both cause a new page to be processed, but the interaction between the client (web browser) and server
Redirect: A redirect is just a suggestion – it’s like saying
If you want to pass state from the source page to the new
e.g. Redirect to the new.aspx page, passing an ID on the
Transfer: A transfer happens without the client knowing
Sharing state between pages is much easier using
Context.Items["Message"] = "Your password was changed successfully";
Response.Redirect is more user-friendly, as the site visitor can
Page originalPage = (Page)Context.Handler;
TextBox textBox1 = (TextBox)originalPage.FindControl("textBox1");
9. Can you give an example of when it would be appropriate
Web services are best suite for Hetrogenious
10. Let's say I have an existing application written using
The .NET components, which make use of the COM+ Services, are termed as ServicedComponents. Must read this link to learn more : http://msdn2.microsoft.com/en-us/library/ms973809.aspx
Number of Tables
A dataset usually also contains relationships. A relationship within a dataset is analogous to a foreign-key relationship in a database —that is, it associates rows of the tables with each other. For example, if a dataset contains a table about investors and another table about each investor's stock purchases, it could also contain a relationship connecting each row of the investor table with the corresponding rows of the purchase table. Because the dataset can hold multiple, separate tables and maintain information about relationships between them, it can hold much richer data structures than a recordset, including self-relating tables and tables with many-to-many relationships.
A cursor is a database element that controls record navigation, the ability to update data, and the visibility of changes made to the database by other users. ADO.NET does not have an inherent cursor object, but instead includes data classes that provide the functionality of a traditional cursor. For example, the functionality of a forward-only, read-only cursor is available in the ADO.NET DataReader object. For more information about cursor unctionality, see Data Access Technologies.
Minimized Open Connections
There is one significant difference between disconnected processing in ADO and ADO.NET. In ADO you communicate with the database by making calls to an OLE DB provider. In ADO.NET you communicate with the database through a data adapter (an OleDbDataAdapter, SqlDataAdapter, OdbcDataAdapter, or OracleDataAdapter object), which makes calls to an OLE DB provider or the APIs provided by the underlying data source. The important difference is that in ADO.NET the data adapter allows you to control how the changes to the dataset are transmitted to the database — by optimizing for performance, performing data validation checks, or adding any other extra processing.
Note - Data adapters, data connections, data commands, and data readers are the components that make up a .NET Framework data provider. Microsoft and third-party providers can make available other .NET Framework data providers that can be integrated into Visual Studio. For information on the different .NET Data providers, see .NET Data Providers.
Sharing Data Between Applications
12. Can you give an example of what might be best suited to place in the Application_Start and Session_Start subroutines?
Ans. The Application_Start event is guaranteed to occur only once throughout the lifetime of the application. It’s a good place to initialize global variables. For example, you might want to retrieve a list of products from a database table and place the list in application state or the Cache object. SessionStateModule exposes both Session_Start and Session_End events.
14. What are ASP.NET Web Forms? How is this technology
15. How does VB.NET/C# achieve polymorphism?
Polymorphism by definition means taking many forms. In C# it means the ability for classes to share the same methods (actions) but implement them differently. For instance, say we create a class called "Shape" and this class has a method called .draw() which draws the shape onto the user interface. Then we create two subclasses, using inheritance, of this Shape class. One called Square, the other called Circle. Now obviously a square and circle are two entirely different shapes, yet both classes have the .draw() method. When the Square.draw() method is called it will draw a square on the user interface. When the Circle.draw() method is called, it will draw a circle on the user interface. So both classes can use the same methods but implement them differently.PREV NEXT