Thursday, 13 November 2008
Value types VS Reference types C#
What is difference between Value types and Reference types in VB.NET or C# (Value types VS Reference types)C# provides two types�class and struct, class is a reference type while the other is a value type. Here is difference between Value types and Reference types.Value types directly contain their data which are either allocated on the stack or allocated in-line in a structure. Reference types
Wednesday, 12 November 2008
XML Interview Questions
What determines the validity of an XML document?
Document Type Definition(DTD) or an XML Schema determines the validity of an XML document.
What is a valid XML document?XML documents are compared to rules that are specified in a DTD or schema. A well-formed XML document that meets all of the requirements of one or more specifications is called a valid XML Document.
What are the 2 types of XML parsers?
Nonvalidating Parsers - Parsers that don�t support validation
Validating Parsers - Parsers that support validation
Can you combine both Schema and DTD references in a single XML document?Yes
Are DTD's well-formed XML documents?
No, DTDs are not well-formed XML documents. This is because they follow DTD syntax rules rather than XML document syntax.
Are XML schema's well-formed XML documents?Yes.
What is the difference between an XML schema and a DTD?
The XML Schema is the officially sanctioned Schema definition. Unlike DTDs, the format of XML Schemas follows the rules of well-formed XML documents. The Schema also allows for much more granular control over the data that is being described. Because of the XML format and the detailed format controls, Schemas tend to be very complex and often much longer than the XML documents that they are describing. Schemas are often much more easy for developers to read and follow,due to the less cryptic nature of the references in Schemas versus DTDs.
How do you define references to schemas in an XML document?References to schemas are defined by creating an instance of the XMLSchemainstance namespace. An example is shown below.
<rootelement xmlns:xsi=�http://www.w3.org/2001/XMLSchemainstance� xsi:noNamespaceSchemaLocation=�schemafile.xsd�>
The namespace declaration reference to http://www.w3.org/2001/XMLSchemainstance resolves to an actual document at that location, which is a brief description of the way that the W3C Schema should be referenced. The noNamespaceSchemaLocation value tells us that there is no predefined namespace for the Schema. This means that all of the elements in the XML document should be validated against the schema specified. The location of the Schema is schemafile.xsd. Because there is no path defined, the file containing the schema should be located in the same directory as the XML file to be validated by the Schema.
You can also define the schema location, and map it to a specific namespace by using the schemaLocation attribute declaration instead of noNamespace SchemaLocation. If you do so, you have to declare a namespace that matches the schemaLocation attribute value. The declaration must be made before you reference the schema in a schemaLocation attribute assignment.
Document Type Definition(DTD) or an XML Schema determines the validity of an XML document.
What is a valid XML document?XML documents are compared to rules that are specified in a DTD or schema. A well-formed XML document that meets all of the requirements of one or more specifications is called a valid XML Document.
What are the 2 types of XML parsers?
Nonvalidating Parsers - Parsers that don�t support validation
Validating Parsers - Parsers that support validation
Can you combine both Schema and DTD references in a single XML document?Yes
Are DTD's well-formed XML documents?
No, DTDs are not well-formed XML documents. This is because they follow DTD syntax rules rather than XML document syntax.
Are XML schema's well-formed XML documents?Yes.
What is the difference between an XML schema and a DTD?
The XML Schema is the officially sanctioned Schema definition. Unlike DTDs, the format of XML Schemas follows the rules of well-formed XML documents. The Schema also allows for much more granular control over the data that is being described. Because of the XML format and the detailed format controls, Schemas tend to be very complex and often much longer than the XML documents that they are describing. Schemas are often much more easy for developers to read and follow,due to the less cryptic nature of the references in Schemas versus DTDs.
How do you define references to schemas in an XML document?References to schemas are defined by creating an instance of the XMLSchemainstance namespace. An example is shown below.
<rootelement xmlns:xsi=�http://www.w3.org/2001/XMLSchemainstance� xsi:noNamespaceSchemaLocation=�schemafile.xsd�>
The namespace declaration reference to http://www.w3.org/2001/XMLSchemainstance resolves to an actual document at that location, which is a brief description of the way that the W3C Schema should be referenced. The noNamespaceSchemaLocation value tells us that there is no predefined namespace for the Schema. This means that all of the elements in the XML document should be validated against the schema specified. The location of the Schema is schemafile.xsd. Because there is no path defined, the file containing the schema should be located in the same directory as the XML file to be validated by the Schema.
You can also define the schema location, and map it to a specific namespace by using the schemaLocation attribute declaration instead of noNamespace SchemaLocation. If you do so, you have to declare a namespace that matches the schemaLocation attribute value. The declaration must be made before you reference the schema in a schemaLocation attribute assignment.
Tuesday, 11 November 2008
XML related Interview Questions
Click here for all C# Interview Questions
Click here for all ASP.NET Interview Questions
What Is XML?
XML stands for Extensible Markup Language, and it is used to describe documents and data in a standardized, text-based format that can be easily transported via standard Internet protocols. XML, like HTML, is based on, Standard Generalized Markup Language (SGML).
What are Well-formed XML documents?
XML, is very strict about a small core of format requirements that make the difference between a text document containing a bunch of tags and an actual XML document. XML documents that meet W3C XML document formatting recommendations are described as being well-formed XML documents. Well-formed XML documents can contain elements, attributes, and text.
What is an empty XML element?
Elements with no attributes or text are called as empty XML element. Empty XML elements can be represented in an XML document as shown below:
<element/>
What is meant by XML document declaration?Most XML documents start with an <?xml?> element at the top of the page. This is called an XML document declaration. An XML document declaration is an optional element that is useful to determine the version of XML and the encoding type of the source data. It is not a required element for an XML document to be well formed. Most common XML document declaration is shown below:
<?xml version=�1.0� encoding=�UTF-8�?>
What does UTF stands for?
UTF stands for Universal Character Set Transformation Format.
Should every XML document have a root element?Yes.
Can an XML document contain multiple root level elements?
No, an XML document can contain only one root level element.
What is the use of XML attributes?XML attributes are used for adding more information and descriptions to the values of elements,and the text associated with elements.
Is XML case sensitive?
Yes
How do you comment lines in XML?You can comment lines in XML as shown below.
<! -- This is commented line in an XML document -->
What are XML namespaces?
Namespaces are a method for separating and identifying duplicate XML element names in an XML document. Namespaces can also be used as identifiers to describe data types and other information. Namespace declarations can be compared to defining a short variable name for a long variable (such as pi=3.14159....) in programming languages. In XML, the variable assignment is defined by an attribute declaration. The variable name is the attribute name, and the variable value is the attribute value. In order to identify namespace declarations versus other types of attribute declarations, a reserved xmlns: prefix is used when declaring a namespace name and value. The attribute name after the xmlns: prefix identifies the name for the defined namespace. The value of the attribute provides the unique identifier for the namespace. Once the namespace is declared, the namespace name can be used as a prefix in element names.
Why is it a good idea to use a URL as the XML namespace value?
Although the namespace declaration value does not need to be a URL or resolve to an actual URL destination, it is a good idea to use a URL anyway, and to choose a URL that could resolve to an actual destination, just in case developers want to add documentation for the namespace to the URL in the future.
When to use namespaces?Namespaces are optional components of basic XML documents. However, namespace declarations are recommended if your XML documents have any current or future potential of being shared with other XML documents that may share the same element names. Also, newer XML-based technologies such as XML Schemas,SOAP, and WSDL make heavy use of XML namespaces to identify data encoding types and important elements of their structure.
Click here for all C# Interview Questions
Click here for all ASP.NET Interview Questions
Click here for all ASP.NET Interview Questions
What Is XML?
XML stands for Extensible Markup Language, and it is used to describe documents and data in a standardized, text-based format that can be easily transported via standard Internet protocols. XML, like HTML, is based on, Standard Generalized Markup Language (SGML).
What are Well-formed XML documents?
XML, is very strict about a small core of format requirements that make the difference between a text document containing a bunch of tags and an actual XML document. XML documents that meet W3C XML document formatting recommendations are described as being well-formed XML documents. Well-formed XML documents can contain elements, attributes, and text.
What is an empty XML element?
Elements with no attributes or text are called as empty XML element. Empty XML elements can be represented in an XML document as shown below:
<element/>
What is meant by XML document declaration?Most XML documents start with an <?xml?> element at the top of the page. This is called an XML document declaration. An XML document declaration is an optional element that is useful to determine the version of XML and the encoding type of the source data. It is not a required element for an XML document to be well formed. Most common XML document declaration is shown below:
<?xml version=�1.0� encoding=�UTF-8�?>
What does UTF stands for?
UTF stands for Universal Character Set Transformation Format.
Should every XML document have a root element?Yes.
Can an XML document contain multiple root level elements?
No, an XML document can contain only one root level element.
What is the use of XML attributes?XML attributes are used for adding more information and descriptions to the values of elements,and the text associated with elements.
Is XML case sensitive?
Yes
How do you comment lines in XML?You can comment lines in XML as shown below.
<! -- This is commented line in an XML document -->
What are XML namespaces?
Namespaces are a method for separating and identifying duplicate XML element names in an XML document. Namespaces can also be used as identifiers to describe data types and other information. Namespace declarations can be compared to defining a short variable name for a long variable (such as pi=3.14159....) in programming languages. In XML, the variable assignment is defined by an attribute declaration. The variable name is the attribute name, and the variable value is the attribute value. In order to identify namespace declarations versus other types of attribute declarations, a reserved xmlns: prefix is used when declaring a namespace name and value. The attribute name after the xmlns: prefix identifies the name for the defined namespace. The value of the attribute provides the unique identifier for the namespace. Once the namespace is declared, the namespace name can be used as a prefix in element names.
Why is it a good idea to use a URL as the XML namespace value?
Although the namespace declaration value does not need to be a URL or resolve to an actual URL destination, it is a good idea to use a URL anyway, and to choose a URL that could resolve to an actual destination, just in case developers want to add documentation for the namespace to the URL in the future.
When to use namespaces?Namespaces are optional components of basic XML documents. However, namespace declarations are recommended if your XML documents have any current or future potential of being shared with other XML documents that may share the same element names. Also, newer XML-based technologies such as XML Schemas,SOAP, and WSDL make heavy use of XML namespaces to identify data encoding types and important elements of their structure.
Click here for all C# Interview Questions
Click here for all ASP.NET Interview Questions
Monday, 10 November 2008
When not to use Design Patterns
Do not use design patterns in any of the following situations.
� When the software being designed would not change with time.
� When the requirements of the source code of the application are unique.
If any of the above applies in the current software design, there is no need to apply design patterns in the current design and increase unnecessary complexity in the design.
� When the software being designed would not change with time.
� When the requirements of the source code of the application are unique.
If any of the above applies in the current software design, there is no need to apply design patterns in the current design and increase unnecessary complexity in the design.
When to use Design Patterns
Design Patterns are particularly useful in one of the following scenarios.
� When the software application would change in due course of time.
� When the application contains source code that involves object creation and event notification.
� When the software application would change in due course of time.
� When the application contains source code that involves object creation and event notification.
Benefits of Design Patterns
The following are some of the major advantages of using Design Patterns in software development.
� Flexibility
� Adaptability to change
� Reusability
� Flexibility
� Adaptability to change
� Reusability
What are Design Patterns?
A Design Pattern essentially consists of a problem in a software design and a solution to the same. In Design Patterns each pattern is described with its name, the motivation behind the pattern and its applicability.
According to MSDN, "A design pattern is a description of a set of interacting classes that provide a framework for a solution to a generalized problem in a specific context or environment. In other words, a pattern suggests a solution to a particular problem or issue in object-oriented software development.
According to MSDN, "A design pattern is a description of a set of interacting classes that provide a framework for a solution to a generalized problem in a specific context or environment. In other words, a pattern suggests a solution to a particular problem or issue in object-oriented software development.
Subscribe to:
Posts (Atom)