Breaking News

Editors Picks

Sunday, June 27, 2010

Difference between abstract class and interface

1)

Interfaces provide a form of multiple inheritance. A class 
can extend only one other class. 
Interfaces are limited to public methods and constants with 
no implementation. Abstract classes can have a partial 
implementation, protected parts, static methods, etc. 
A Class may implement several interfaces. But in case of 
abstract class, a class may extend only one abstract class. 
Interfaces are slow as it requires extra indirection to to 
find corresponding method in in the actual class. Abstract 
classes are fast.

2)
(1)       An abstract class may contain complete or 
incomplete methods. Interfaces can contain only the 
signature of a method but no body. Thus an abstract class 
can implement methods but an interface can not implement 
methods.
(2)         An abstract class can contain fields, 
constructors, or destructors and implement properties. An 
interface can not contain fields, constructors, or 
destructor and it has only the property's signature but no 
implementation.
(3)         An abstract class cannot support multiple 
inheritance, but an interface can support multiple 
inheritance. Thus a class may inherit several interfaces 
but only one abstract class.
(4)         A class implementing an interface has to 
implement all the methods of the interface, but the same is 
not required in the case of an abstract Class.
(5)       Various access modifiers such as abstract, 
protected, internal, public, virtual, etc. are useful in 
abstract Classes but not in interfaces. 
(6)         Abstract classes are faster than interfaces.

3)

Interface :
1.Interface have only Signature.
2.All the Methods are Public , It doesn't have access Modifier Controls
3.It have used Multiple inheritence in the Object oriented Language
4.All the Methods are Abstract.
5.It does not have Contructor,destructor,Fileds
6.A Class May inherits several Interfaces

Abstract Class:
1.Abstract Class have Method defination and Implementation
2.It have control the Access Modifiers
3.It does not allow multiple Inheritence
4.Some methods are concrete
5. It have Contructor and destructor
6.Only one abstract have to derived 


4)

class, we make use of the abstractkeyword. Such a class cannot be instantiated. Syntax below:
abstract public class Vehicle { } 
Above, an abstract class named Vehicle has been defined. We may use the fields, properties and member functions defined within this abstract class to create child classes like Car,Truck, Bike etc. that inherit the features defined within the abstract class. To prevent directly creating an instance of the class Vehicle, we make use of the abstract keyword. To use the definitions defined in the abstract class, the child class inherits from the abstract class, and then instances of the Child class may be easily created. Further, we may define abstract methods within an abstract class (analogous to C++ pure virtual functions) when we wish to define a method that does not have any default implementation. Its then in the hands of the descendant class to provide the details of the method. There may be any number of abstract methods in an abstract class. We define an abstract method using the abstract keyword. If we do not use the abstract keyword, and use the virtual keyword instead, we may provide an implementation of the method that can be used by the child class, but this is not an abstract method. Remember, abstract class can have an abstract method, that does not have any implementation, for which we use the abstract keyword, OR the abstract class may have a virtual method, that can have an implementation, and can be overriden in the child class as well, using the override keyword. Read example below
Example: Abstract Class with Abstract method namespace Automobiles {  public abstract class Vehicle  {   public abstract void Speed() //No Implementation here, only definition  } } Example: Abstract Class with Virtual method namespace Automobiles {  public abstract class Vehicle  {   public virtual void Speed() //Can have an implementation, that may be overriden in child class   {     ...   }  } Public class Car : Vehicle { Public override void Speed()   //Here, we override whatever implementation is there in the abstract class   {    ... //Child class implementation of the method Speed()  } } }
An Interface is a collection of semantically related abstract members. An interface expresses through the members it defines, the behaviors that a class needs to support. An interface is defined using the keyword interface. The members defined in an interface contain only definition, no implementation. The members of an interface are all public by default, any other access specifier cannot be used. See code below:
Public interface IVehicle //As a convention, an interface is prefixed by letter I {   Boolean HasFourWheels() }
Time to discuss the Difference between Abstract Class and Interface 1) A class may inherit only one abstract class, but may implement multiple number of Interfaces. Say a class named Car needs to inherit some basic features of a vehicle, it may inherit from an Aabstract class named Vehicle. A car may be of any kind, it may be a vintagecar, a sedan, a coupe, or a racing car. For these kind of requirements, say a car needs to have only two seats (means it is a coupe), then the class Car needs to implement a member field from an interface, that we make, say ICoupe. 2) Members of an abstract class may have any access modifier, but members of an interface are public by default, and cant have any other access modifier. 3) Abstract class methods may OR may not have an implementation, while methods in an Interface only have a definition, no implementation.
Read more ...

What is difference between dll and exe?

1) 

.Exe
1.These are outbound file.
2.Only one .exe file exists per application.
3. .Exe cannot be shared with other applications.

.dll
1.These are inbund file .
2.Many .dll files may exists in one application.
3. .dll can be shared with other applications.


2)
EXE..
1.Its a executable file
2.There is only single main entry
3.When a system launches new exe, a new process is created
4.The entry thread is called in context of main thread of that process.

DLL..
1.Its a Dynamic Link Library
2.There are many entry points.
3.The system loads a DLL into the context of an existing thread



3)
DLL

1. It can be reused.
2. It can be versioned.
3. It is not self executable
4. It doesn't have main function

.EXE
1. It cannot be reused
2. It cannot be versioned.
3. It is self executable.
4. It will have main
function.

D


4)

DLL:
1)it has versioning
2)it is not self executable
3)it runs in application process memory
4)it has no entry point
5)it is reusable

Exe:
1)it is self executable
2)it has no versioning
3)it runs in own memory
4)it have main function(Entry point)
5)it is self executable
5)

DLL:
1)it has versioning
2)it is not self executable
3)it runs in application process memory
4)it has no entry point
5)it is reusable
6)Out Process Server

Exe:
1)it is self executable
2)it has no versioning
3)it runs in own memory
4)it have main function(Entry point)
5)it is self executable
6) In Process Server
Read more ...

ASP.NET

  1. What do I need to create and run an ASP.NET application?
  • Windows 2000, Windows Server 2003 or Windows XP.
  • ASP.NET, which can be either the redistributable (included in the .NET SDK) or Visual Studio .NET


    • Microsoft provides Visual Studio 2005 Express Edition Beta for free. Of particular interest to the ASP.NET developers would be the Visual Web Developer 2005 Express Edition Beta 2 available as a free download.
    • The ASP.NET Web Matrix Project (supported by Microsoft) is a free IDE for developing ASP.NET applications and is available here.
    • There is also a free open-source UNIX version of the Microsoft .NET development platform called Mono available for download here.
    • Another increasingly popular Open Source Development Environment for .NET is the #develop (short for SharpDevelop) available for downloadhere.
  1. When was ASP.NET released?ASP.NET is a part of the .NET framework which was released as a software platform in 2002.
  2. Is a new version coming up?ASP.NET 2.0, Visual Studio 2005 (Whidbey), Visual Web Developer 2005 Express Edition are the next releases of Microsoft's Web platform and tools. They have already been released as Beta versions. They are scheduled to be released in the week of November 7, 2005.
  3. Explain Namespace.Namespaces are logical groupings of names used within a program. There may be multiple namespaces in a single application code, grouped based on the identifiers’ use. The name of any given identifier must appear only once in its namespace.
  4. List the types of Authentication supported by ASP.NET.
    • Windows (default)
    • Forms
    • Passport
    • None (Security disabled)
  5. What is CLR?Common Language Runtime (CLR) is a run-time environment that manages the execution of .NET code and provides services like memory management, debugging, security, etc. The CLR is also known as Virtual Execution System (VES).
  6. What is CLI?The CLI is a set of specifications for a runtime environment, including a common type system, base class library, and a machine-independent intermediate code known as the Common Intermediate Language (CIL). (Source: Wikipedia.)
  7. List the various stages of Page-Load lifecycle.
    • Init()
    • Load()
    • PreRender()
    • Unload()
  8. Explain Assembly and Manifest.An assembly is a collection of one or more files and one of them (DLL or EXE) contains a special metadata called Assembly Manifest. The manifest is stored as binary data and contains details like versioning requirements for the assembly, the author, security permissions, and list of files forming the assembly. An assembly is created whenever a DLL is built. The manifest can be viewed programmatically by making use of classes from the System.Reflectionnamespace. The tool Intermediate Language Disassembler (ILDASM) can be used for this purpose. It can be launched from the command prompt or via Start> Run.
  9. What is Shadow Copy?In order to replace a COM component on a live web server, it was necessary to stop the entire website, copy the new files and then restart the website. This is not feasible for the web servers that need to be always running. .NET components are different. They can be overwritten at any time using a mechanism called Shadow Copy. It prevents the Portable Executable (PE) files like DLLs and EXEs from being locked. Whenever new versions of the PEs are released, they are automatically detected by the CLR and the changed components will be automatically loaded. They will be used to process all new requests not currently executing, while the older version still runs the currently executing requests. By bleeding out the older version, the update is completed.
  10. What is DLL Hell?DLL hell is the problem that occurs when an installation of a newer application might break or hinder other applications as newer DLLs are copied into the system and the older applications do not support or are not compatible with them. .NET overcomes this problem by supporting multiple versions of an assembly at any given time. This is also called side-by-side component versioning.
  11. Explain Web Services.Web services are programmable business logic components that provide access to functionality through the Internet. Standard protocols like HTTP can be used to access them. Web services are based on the Simple Object Access Protocol (SOAP), which is an application of XML. Web services are given the .asmxextension.
  12. Explain Windows Forms.Windows Forms is employed for developing Windows GUI applications. It is a class library that gives developers access to Windows Common Controls with rich functionality. It is a common GUI library for all the languages supported by the .NET Framework.
  13. What is Postback?When an action occurs (like button click), the page containing all the controls within the tag performs an HTTP POST, while having itself as the target URL. This is called Postback.
  14. Explain the differences between server-side and client-side code?Server side scripting means that all the script will be executed by the server and interpreted as needed. Client side scripting means that the script will be executed immediately in the browser such as form field validation, clock, email validation, etc. Client side scripting is usually done in VBScript or JavaScript. Since the code is included in the HTML page, anyone can see the code by viewing the page source. It also poses as a possible security hazard for the client computer.
  15. Enumerate the types of Directives.
    • @ Page directive
    • @ Import directive
    • @ Implements directive
    • @ Register directive
    • @ Assembly directive
    • @ OutputCache directive
    • @ Reference directive
  16. What is Code-Behind?Code-Behind is a concept where the contents of a page are in one file and the server-side code is in another. This allows different people to work on the same page at the same time and also allows either part of the page to be easily redesigned, with no changes required in the other. An Inherits attribute is added to the @ Page directive to specify the location of the Code-Behind file to the ASP.NET page.
  17. Describe the difference between inline and code behind.Inline code is written along side the HTML in a page. There is no separate distinction between design code and logic code. Code-behind is code written in a separate file and referenced by the .aspx page.
  18. List the ASP.NET validation controls?
    • RequiredFieldValidator
    • RangeValidator
    • CompareValidator
    • RegularExpressionValidator
    • CustomValidator
    • ValidationSummary
  19. What is Data Binding?Data binding is a way used to connect values from a collection of data (e.g.DataSet) to the controls on a web form. The values from the dataset are automatically displayed in the controls without having to write separate code to display them.
  20. Describe Paging in ASP.NET.The DataGrid control in ASP.NET enables easy paging of the data. TheAllowPaging property of the DataGrid can be set to True to perform paging. ASP.NET automatically performs paging and provides the hyperlinks to the other pages in different styles, based on the property that has been set forPagerStyle.Mode.
  21. Should user input data validation occur server-side or client-side? Why?All user input data validation should occur on the server and minimally on the client-side, though it is a good way to reduce server load and network traffic because we can ensure that only data of the appropriate type is submitted from the form. It is totally insecure. The user can view the code used for validation and create a workaround for it. Secondly, the URL of the page that handles the data is freely visible in the original form page. This will allow unscrupulous users to send data from their own forms to your application. Client-side validation can sometimes be performed where deemed appropriate and feasible to provide a richer, more responsive experience for the user.
  22. What is the difference between Server.Transfer and Response.Redirect?
    • Response.Redirect: This tells the browser that the requested page can be found at a new location. The browser then initiates another request to the new page loading its contents in the browser. This results in two requests by the browser.
    • Server.Transfer: It transfers execution from the first page to the second page on the server. As far as the browser client is concerned, it made one request and the initial page is the one responding with content. The benefit of this approach is one less round trip to the server from the client browser. Also, any posted form variables and query string parameters are available to the second page as well.
Read more ...

ASP.NET INTERVIEW QUESTIONS


ASP.NET Interview Questions
There are some questions in this list that I do not consider to be good questions for an interview.  However, they do exist on other lists available on the Internet so I felt compelled to keep them here for easy access.
  1. Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process.
    inetinfo.exe is theMicrosoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension), the ISAPI filter aspnet_isapi.dll takes care of it by passing the request tothe actual worker process aspnet_wp.exe.
     
  2. What’s the difference between Response.Write() andResponse.Output.Write()?Response.Output.Write() allows you to write formatted output.
     
  3. What methods are fired during the page load?Init() - when the page is instantiated
    Load() - when the page is loaded into server memory
    PreRender() - the brief moment before the page is displayed to the user as HTML
    Unload() - when page finishes loading.


  4. When during the page processing cycle is ViewState available?
    After the Init() and before the Page_Load(), or OnLoad() for a control. 
  5. What namespace does the Web page belong in the .NET Framework class hierarchy?System.Web.UI.Page
     
  6. Where do you store the information about the user’s locale?System.Web.UI.Page.Culture
     
  7. What’s the difference between Codebehind="MyCode.aspx.cs" andSrc="MyCode.aspx.cs"?CodeBehind is relevant to Visual Studio.NET only.
     
  8. What’s a bubbled event?When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents.
     
  9. Suppose you want a certain ASP.NET function executed on MouseOver for a certain button.  Where do you add an event handler?Add an OnMouseOver attribute to the button.  Example: btnSubmit.Attributes.Add("onmouseover","someClientCodeHere();");
     
  10. What data types do the RangeValidator control support?Integer, String, and Date.
     
  11. Explain the differences between Server-side and Client-side code?Server-side code executes on the server.  Client-side code executes in the client's browser.
     
  12. What type of code (server or client) is found in a Code-Behind class?The answer is server-side code since code-behind is executed on the server.  However, during the code-behind's execution on the server, it can render client-side code such as JavaScript to be processed in the clients browser.  But just to be clear, code-behind executes on the server, thus making it server-side code.
     
  13. Should user input data validation occur server-side or client-side?  Why?All user input data validation should occur on the server at a minimum.  Additionally, client-side validation can be performed where deemed appropriate and feasable to provide a richer, more responsive experience for the user.
     
  14. What is the difference between Server.Transfer and Response.Redirect?  Why would I choose one over the other?Server.Transfer transfers page processing from one page directly to the next page without making a round-trip back to the client's browser.  This provides a faster response with a little less overhead on the server.  Server.Transfer does not update the clients url history list or current url.  Response.Redirect is used to redirect the user's browser to another page or site.  This performas a trip back to the client where the client's browser is redirected to the new page.  The user's browser history list is updated to reflect the new address.
     
  15. Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?Valid answers are:
    ·  A DataSet can represent an entire relational database in memory, complete with tables, relations, and views.
    ·  A DataSet is designed to work without any continuing connection to the original data source.
    ·  Data in a DataSet is bulk-loaded, rather than being loaded on demand.
    ·  There's no concept of cursor types in a DataSet.
    ·  DataSets have no current record pointer You can use For Each loops to move through the data.
    ·  You can store many edits in a DataSet, and write them to the original data source in a single operation.
    ·  Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.
     
  16. What is the Global.asax used for?The Global.asax (including the Global.asax.cs file) is used to implement application and session level events.
     
  17. What are the Application_Start and Session_Start subroutines used for?This is where you can set the specific variables for the Application and Session objects.
     
  18. Can you explain what inheritance is and an example of when you might use it?When you want to inherit (use the functionality of) another class.  Example: With a base class named Employee, a Manager class could be derived from the Employee base class.
     
  19. Whats an assembly?Assemblies are the building blocks of the .NET framework.
     
  20. Describe the difference between inline and code behind.Inline code written along side the html in a page. Code-behind is code written in a separate file and referenced by the .aspx page.
     
  21. Explain what a diffgram is, and a good use for one?The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML.  A good use is reading database data to an XML file to be sent to a Web Service.
     
  22. Whats MSIL, and why should my developers need an appreciation of it if at all?MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL.  MSIL also allows the .NET Framework to JIT compile the assembly on the installed computer.
     
  23. Which method do you invoke on the DataAdapter control to load your generated dataset with data?The Fill() method.
     
  24. Can you edit data in the Repeater control?No, it just reads the information from its data source.
     
  25. Which template must you provide, in order to display data in a Repeater control?ItemTemplate.
     
  26. How can you provide an alternating color scheme in a Repeater control?Use the AlternatingItemTemplate.
     
  27. What property must you set, and what method must you call in your code, in order to bind the data from a data source to the Repeater control?You must set the DataSource property and call the DataBind method.
     
  28. What base class do all Web Forms inherit from?The Page class.
     
  29. Name two properties common in every validation control?ControlToValidate property and Text property.
     
  30. Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box?DataTextField property.
     
  31. Which control would you use if you needed to make sure the values in two different controls matched?CompareValidator control.
     
  32. How many classes can a single .NET DLL contain?It can contain many classes.
     
Web Service Questions
  1. What is the transport protocol you use to call a Web service?SOAP (Simple Object Access Protocol) is the preferred protocol.
     
  2. True or False: A Web service can only be written in .NET?False
     
  3. What does WSDL stand for?Web Services Description Language.
     
  4. Where on the Internet would you look for Web services?from  uddi.org
     
  5. True or False: To test a Web service you must create a Windows application or Web application to consume this service?False, the web service comes with a test page and it provides HTTP-GET method to test.
     
State Management Questions
  1. What is ViewState?ViewState allows the state of objects (serializable) to be stored in a hidden field on the page.  ViewState is transported to the client and back to the server, and is not stored on the server or any other external source.  ViewState is used the retain the state of server-side objects between postabacks.
     
  2. What is the lifespan for items stored in ViewState?Item stored in ViewState exist for the life of the current page.  This includes postbacks (to the same page).
     
  3. What does the "EnableViewState" property do?  Why would I want it on or off?It allows the page to save the users input on a form across postbacks.  It saves the server-side values for a given control into ViewState, which is stored as a hidden value on the page before sending the page to the clients browser.  When the page is posted back to the server the server control is recreated with the state stored in viewstate.
     
  4. What are the different types of Session state management options available with ASP.NET?
    ASP.NET provides In-Process and Out-of-Process state management.  In-Process stores the session in memory on the web server.  This requires the a "sticky-server" (or no load-balancing) so that the user is always reconnected to the same web server.  Out-of-Process Session state management stores data in an external data source.  The external data source may be either a SQL Server or a State Server service.  Out-of-Process state management requires that all objects stored in session are serializable.
Read more ...

Contact Us

Name

Email *

Message *