Interview Tips Interview Tips, Interview Questions and Answers

11May/100

Explain about Serialization in .NET. Explain binary serialization and XML serialization

Explain about Serialization in .NET. Explain binary serialization and XML serialization

System.Runtime.Serialization namespace provides Serialization in .NET.
The IFormatter interface in the namespace contains Serialize and De-serialize methods that save and load data of a stream.
So we need stream as a container for the serialized object(s) and a formatter that serializes these objects onto the stream to implement serialization in .net.

Binary serialization is a mechanism that creates exact binary copy of the object onto the storage media by writing the data to the output stream such that it can be used to re-construct the object automatically.

XML serialization results in strongly typed classes with public properties and fields that are converted to a serial format for storage or transport. This XML stream conforms to a specific XML Schema definition language (XSD) document.

Explain why Serialization.

An object is stored in a file, a database or even in the memory. However, data to be transferred over a network needs to be in a linear form for which serialization and deserialization are used.

Advantage of serialization is the ability of an object to be serialized into a persistent or a non-persistent storage media and then reconstructing the same object later by de-serializing the object.

Remoting and Web Services depend heavily on Serialization and De-serialization.

Explain the components that comprise the binary serialization architecture.

To binary serialize an object we need a FileStream object,
Constructor: FileStream(file_name, FileMode.Create);

And

BinaryFormatter
Constructor: binaryFormatter.Serialize(fileStreamObject, object1);

18Apr/100

.NET interview: Serialization in .NET

Explain about Serialization in .NET. Explain binary serialization and XML serialization

System.Runtime.Serialization namespace provides Serialization in .NET.
The IFormatter interface in the namespace contains Serialize and De-serialize methods that save and load data of a stream.
So we need stream as a container for the serialized object(s) and a formatter that serializes these objects onto the stream to implement serialization in .net.

Binary serialization is a mechanism that creates exact binary copy of the object onto the storage media by writing the data to the output stream such that it can be used to re-construct the object automatically.

XML serialization results in strongly typed classes with public properties and fields that are converted to a serial format for storage or transport. This XML stream conforms to a specific XML Schema definition language (XSD) document.

Explain why Serialization.

An object is stored in a file, a database or even in the memory. However, data to be transferred over a network needs to be in a linear form for which serialization and deserialization are used.

Advantage of serialization is the ability of an object to be serialized into a persistent or a non-persistent storage media and then reconstructing the same object later by de-serializing the object.

Remoting and Web Services depend heavily on Serialization and De-serialization.

Explain the components that comprise the binary serialization architecture.

To binary serialize an object we need a FileStream object,
Constructor: FileStream(file_name, FileMode.Create);

And

BinaryFormatter
Constructor: binaryFormatter.Serialize(fileStreamObject, object1);

What is Formatters? Explain the binary formatter and the SOAP formatter.

A formatter determines the serialization format for objects.

.NET framework provides Binary formatter and SOAP formatter which inherit from the IFormatter interface

The Binary Formatter

It provides binary encoding for compact serialization for storage or socket-based network streams.
It is not appropriate for data to be passed through a firewall.

The SOAP Formatter

It provides formatting that can be used to enable objects to be serialized using the SOAP protocol.
The class is used for serialization through firewalls or diverse systems.

21Dec/090

Interview questions for ASP.NET (UI) Developers

    1. What three Session State providers are available in ASP.NET 1.1? What are the pros and cons of each?
    2. What is Web Gardening? How would using it affect a design?
    3. Given one ASP.NET application, how many application objects does it have on a single proc box? A dual? A dual with Web Gardening enabled? How would this affect a design?
    4. Describe how a browser-based Form POST becomes a Server-Side event like Button1_OnClick.
    5. What is a PostBack?
    6. What is ViewState? How is it encoded? Is it encrypted? Who uses ViewState?
    7. What is the <machinekey> element and what two ASP.NET technologies is it used for?
    8. Describe ways to present an arbitrary endpoint (URL) and route requests to that endpoint to ASP.NET.
    9. Explain how cookies work. Give an example of Cookie abuse.
    10. Explain the importance of HttpRequest.ValidateInput()?
    11. How does VaryByCustom work?
    12. How would one implement ASP.NET HTML output caching, caching outgoing versions of pages generated via all values of q= except where q=5 (as in http://localhost/page.aspx?q=5)?
    13. What kind of data is passed via HTTP Headers?
    14. Juxtapose the HTTP verbs GET and POST. What is HEAD?
    15. Name and describe at least a half dozen HTTP Status Codes and what they express to the requesting client.
    16. How does if-not-modified-since work? How can it be programmatically implemented with ASP.NET?
      Explain <@OutputCache%> and the usage of VaryByParam, VaryByHeader.
    17. Are threads reused in ASP.NET between reqeusts? Does every HttpRequest get its own thread? Should you use Thread Local storage with ASP.NET?
    18. Is the [ThreadStatic] attribute useful in ASP.NET? Are there side effects? Good or bad?
    19. Give an example of how using an HttpHandler could simplify an existing design that serves Check Images from an .aspx page.
    20. What kinds of events can an HttpModule subscribe to? What influence can they have on an implementation? What can be done without recompiling the ASP.NET Application?
21Dec/090

Basic interview questions for C# Component Developers

    1. Explain the differences between public, protected, private and internal.
    2. What benefit do you get from using a Primary Interop Assembly (PIA)?
    3. By what mechanism does NUnit know what methods to test?
    4. What is the difference between typeof(foo) and myFoo.GetType()?
    5. Explain what’s happening in the first constructor: public class c{ public c(string a) : this() {;}; public c() {;} } How is this construct useful?
    6. What is this? Can this be used within a static method?
    7. Explain the importance and use of each component of this string: Foo.Bar, Version=2.0.205.0, Culture=neutral, PublicKeyToken=593777ae2d274679d
    8. What is the difference between: catch(Exception e){throw e;} and catch(Exception e){throw;}
    9. Juxtapose the use of override with new. What is shadowing?
    10. Explain the use of virtual, sealed, override, and abstract.