Monday, September 15, 2014

Web Services .Net Interview Question And Answer

Why do we need .Net Web Services?
We have a number of heterogeneous technologies available on internet. The demand for reusable components across platforms and programming languages are high. Most of the components have the limitation that they can't share or exchange data across different platforms, they are mostly language specific or platform specific.

What is .Net Web Service?

Web services are the components that can be used by other applications
Web services are built on XML standard and use SOAP protocol that allows them to communicate across different platforms and programming languages.

What is SOAP?

SOAP, Simple Object Access Protocol is a communication protocol, a way to structure data before transmitting it, is based on XML standard. It is developed to allow communication between applications of different platforms and programming languages via internet.
It can use range of protocols such as HTTP, FTP, SMTP, Post office protocol 3(POP3) to carry documents.
Http-Get, Http-Post works with name/value pair which means transferring complex object is not possible with these protocols, whereas SOAP serializes complex structure, such as ASP.NET DataSets, complex arrays, custom types and XML nodes before transmitting and thus allows exchange of complex objects between applications.
Two components can easily communicate using Remote Procedure Calls protocol. But because of their compatibility and security issues, most of firewalls and proxy server block this type of messages. SOAP uses HTTP channel to transport which makes it widely accepted protocol over the internet.

What is WSDL?

WSDL stands for Web Services Description Language, an XML-based language that describes Web services and how to access and locate them.

What is UDDI?

UDDI stands for Universal Description, Discovery and Integration. It is an open, Internet-based specification that offers directory service for storing information about web services. 
Web services vs. CORBA and DCOM.
Web services
Web services use HTTP protocol for sending and receiving messages between the applications.
The data encoding in web services is based on XML.
Web services are defined using WSDL (Web Services Description Language).
  • Web services are discovered using UDDI (Universal Description, Discovery and Integration).
  • Web services are firewalls friendly.
  • Web services supports interoperability i.e. cross platform integration is possible.
CORBA and DCOM
  • These technologies use non-standard protocol, i.e. CORBA uses IIOP (Inter Internet Object Protocol), and DCOM uses RPC (Remote Procedure Calls)
  • CORBA components are defined using CORBA Interface Description Language; DCOM components are defined using Microsoft Interface definition languages
  • CORBA components are discovered using the CORBA registry, DCOM using the Registry.
  • DCOM is a proprietary protocol that does not support interoperability and has firewall problems as DCOM transfers data in binary format and it uses many ports to call remote functions.
  • CORBA uses the IIOP protocol, which is non-Internet friendly.
  • CORBA and DCOM are fine for building enterprise applications that runs on the same platform and not good enough for applications that span platforms and languages.
What is the difference between early binding and late binding?  
Calling a non-virtual method, decided at a compile time is known as early binding. Calling a virtual method (Pure Polymorphism), decided at a runtime is known as late binding.
What is reflection?  
All .NET compilers produce metadata about the types defined in the modules they produce. This metadata is packaged along with the module (modules in turn are packaged together in assemblies), and can be accessed by a mechanism called reflection.
The System.Reflection namespace contains classes that can be used to interrogate the types for a module/assembly.
What is the difference between Server.Transfer and response.Redirect?  
The Server.Transfer () method stops the current page from executing, and runs the content on the specified page, when the execution is complete the control is passed back to the calling page.
While the Response.Redirect () method transfers the control on the specified page and the control is never passed back to calling page after execution.

What’s a bubbled event?

When you have a complex control, like Data Grid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their event handlers, allowing the main Data Grid event handler to take care of its constituents.
Server controls like Grandview, Data List, and Repeater can have other child controls inside e.g., a Grid View can have checkbox inside it. These child controls do not raise their events by themselves, rather they pass the event to the container parent (which can be a Grid View, Data List, Repeater), which passed to the page as 'ItemCommand' event. As the child control send their events to parent this is termed as event bubbling.
What are the difference between Structure and Class?  
  • Structures are value type and Classes are reference type
  • Structures cannot have constructor or destructors.
  • Classes can have both constructor and destructors.
  • Structures do not support Inheritance, while Classes support Inheritance.
What is the difference between Custom Control and User Control?  
Custom Controls are compiled code (Dlls), easier to use, difficult to create, and can be placed in toolbox. Drag and Drop controls. Attributes can be set visually at design time. Can be used by Multiple Applications (If Shared Dlls), Even if Private can copy to bin directory of web application add reference and use. Normally designed to provide common functionality independent of consuming Application.
User Controls are similar to those of ASP include files, easy to create, cannot be placed in the toolbox and dragged - dropped from it. A User Control is shared among the single application files.
What are different types of directives in .NET?  
  • @Page
  • @Control
  • @Import
  • @Implements
  • @Register
  • @Assembly
  • @OutputCache
  • @Reference
What are cookies?
Cookies are small pieces of text, stored on the client’s computer to be used only by the website setting the cookies. This allows web applications to save information for the user, and then re-use it on each page if needed.
How do you turn off cookies for one page in your site?
Cookie.Discard
What is the difference between Managed code and unmanaged code?  
Managed Code: Code that runs under a "contract of cooperation" with the common language runtime. Managed code must supply the metadata necessary for the runtime to provide services such as memory management, cross-language integration, code access security, and automatic lifetime control of objects. All code based on Microsoft intermediate language (MSIL) executes as managed code.

Un-Managed Code: Code that is created without regard for the conventions and requirements of the common language runtime. Unmanaged code executes in the common language runtime environment with minimal services (for example, no garbage collection, limited debugging, and so on).
What is difference between constants, read only, and static?  
  • Constants: The value can’t be changed.
  • Read-only: The value will be initialized only once from the constructor of the class.
  • Static: Value can be initialized once.
What is the difference between System.String and System.StringBuilder classes?  
What’s an interface?  
It’s an abstract class with public abstract methods all of which must be implemented in the inherited classes.
What is event bubbling?  
Server controls like Data grid, Data List, and Repeater can have other child controls inside them. Example Data Grid can have combo box inside data grid. These child control do not raise their events by themselves, rather they pass the event to the container parent (which can be a data grid, data list, repeater), which passed to the page as “ItemCommand” event. As the child control send events to parent it is termed as event bubbling.

No comments:

Post a Comment