Interview Tips Interview Tips, Interview Questions and Answers

4Jul/100

Describe the differences between XML and HTML.

It’s amazing how many developers claim to be proficient programming
with XML, yet do not understand the basic differences between XML
and HTML. Anyone with a fundamental grasp of XML should be able
describe some of the main differences outlined in the table below.

XML
User definable tags

Content driven
End tags required for well formed documents
Quotes required around attributes values
Slash required in empty tags

HTML
Defined set of tags designed for web display

Format driven
End tags not required
Quotes not required
Slash not required

18May/100

Questions on XSLT and xPath in .NET

Define XSLT.

XSLT language is used for transforming XML documents into XHTML documents. It also transforms XML into another XML document.

What is XPATH?

XPath is a language that is used to navigate through XML documents.It can find information in an XML document like elements and attributes.

Define XMLReader Class.

The XMLReader Class (Assembly: System.Xml.dll) represents a reader that provides fast, non-cached, forward-only access to XML data.

Define XMLValidatingReader class.

The XMLValidatingReader class (Assembly: System.Xml.dll) represents a reader that provides:

- Document type definition (DTD),
- XML-Data Reduced (XDR) schema, and
- XML Schema definition language (XSD) validation

15May/100

.NET Object Serialization – Difference between the SoapFormatter and the XmlSerializer

What is the difference between the SoapFormatter and the XmlSerializer?

SoapFormatter

SOAP formatter will actually take the field values of an object and store all of that information in the stream passed.

SoapFormatter is better to serialize arbitrary data

XmlSerializer

XML Serialization would just serialize the public properties of an object.

The XML Serializer is used typically for serializing simple types across web services

xmlserializer is better, more flexible and faster

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);

21Apr/100

.NET interview: What is the difference between the SoapFormatter and the XmlSerializer

SoapFormatter

SOAP formatter will actually take the field values of an object and store all of that information in the stream passed.

SoapFormatter is better to serialize arbitrary data

XmlSerializer

XML Serialization would just serialize the public properties of an object.

The XML Serializer is used typically for serializing simple types across web services

xmlserializer is better, more flexible and faster

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 Developers using XML

    1. Describe the difference between pull-style parsers (XmlReader) and eventing-readers (Sax)
    2. What is the difference between XPathDocument and XmlDocument? Describe situations where one should be used over the other.
    3. What is the difference between an XML "Fragment" and an XML "Document."
    4. What is the purpose of XML Namespaces?
    5. When is the DOM appropriate for use? When is it not? Are there size limitations?
    6. What is the WS-I Basic Profile and why is it important?
    7. What does it meant to say “the canonical” form of XML?
    8. Does System.Xml support DTDs? How?
    9. Can any XML Schema be represented as an object graph? Vice versa?
    10. Write a small XML document that uses a default namespace and a qualified (prefixed) namespace. Include elements from both namespace.
    11. What is the one fundamental difference between Elements and Attributes?
    12. What is the difference between Well-Formed XML and Valid XML?
    13. How would you validate XML using .NET?
    14. Why is this almost always a bad idea? When is it a good idea? myXmlDocument.SelectNodes("//mynode");
    15. Why is the XML InfoSet specification different from the Xml DOM? What does the InfoSet attempt to solve?
    16. Contrast DTDs versus XSDs. What are their similarities and differences? Which is preferred and why?