Dot Net Technology Que/Ans Set-3

| Tuesday 7 June 2011

21. What is Globalizationa and Localization ? Ans : Globalization is the process of creating an application that meets the needs of users from multiple cultures. It includes using the correct
currency, date and time format, calendar, writing direction, sorting rules, and other issues. Accommodating these cultural differences in an application is called localization.Using classes of System.Globalization namespace, you can set application's current culture.
This can be achieved by using any of the following 3 approaches.
      1.      Detect and redirect
      2.      Run-time adjustment
      3.      Using Satellite assemblies.
     
22. Whate are Resource Files ? How are they used in .NET? Ans : Resource files are the files containing data that is logically deployed with an application.These files can contain data in a number of formats including strings, images and persisted objects. It has the main advantage of If we store data in these files then we don't need to compile these if the data get changed. In .NET we basically require them storing culture specific informations by localizing application's resources. You can deploy your resources using satellite assemblies.
23. Difference between Dispose and Finallize method?
Ans : Finalize method is used to free the memory used by some unmanaged resources like window handles (HWND). It's similar to the destructor syntax in C#. The GC calls this method when it founds no more references to the object. But, In some cases we may need release the memory used by the resources explicitely.To release the memory explicitly we need to implement the Dispose method of IDisposable interface.
24. What is encapsulation ?
Ans : Encapsulation is the ability to hide the internal workings of an object's behavior and its data. For instance, let's say you have a object named Bike and this object has a method named start(). When you create an instance of a Bike object and call its start() method you are not worried about what happens to accomplish this, you just want to make sure the state of the bike is changed to 'running' afterwards. This kind of behavior hiding is encapsulation and it makes programming much easier.
25. How can you prevent your class to be inherated further?
Ans : By setting Sealed - Key word
 public sealed class Planet
 {
             //code goes here
 }
class Moon:Planet
 {
     //Not allowed as base class is sealed
 }
1.      What is GUID and why we need to use it and in what condition?
How this is created.
Ans : A GUID is a 128-bit integer (16 bytes) that can be used across all computers and networks wherever  a unique identifier is required. Such an identifier has a very low probability of being duplicated. Visual Studio .NET IDE has a utility under the tools menu to generate GUIDs.
27. Why do you need to serialize.?
We need to serialize the object,if you want to pass object from one  computer/application domain to another.Process of converting complex objects into stream of bytes that can be persisted or  transported.Namespace for serialization is System.Runtime.Serialization.The  ISerializable interface allows you to make any class Serializable..NET framework features 2 serializing method.
1.Binary Serialization 
2.XML Serialization
28. What is inline schema, how does it works? Ans : Schemas can be included inside of XML file is called Inline Schemas.This is useful  when it is inconvenient to physically seprate the schema and the XML document.A  schema is an XML document that defines the structure, constraints, data types, and  relationships of the elements that constitute the data contained inside the XML  document or in another XML document.Schema can be an external file which uses the  XSD or XDR extension called external schema. Inline schema can take place even when validation is turned off.
29. Describe the advantages of writing a managed code application instead of unmanaged one. What's involved in certain piece of code being managed?
"Advantage includes automatic garbage collection,memory management,security,type checking,versioning
Managed code is compiled for the .NET run-time environment. It runs in the Common Language Runtime (CLR), which is the heart of the .NET Framework. The CLR provides services such as security,
memory management, and cross-language integration. Managed applications written to take advantage of the features of the CLR perform more efficiently and safely, and take better advantage of developers existing expertise in languages that support the .NET Framework.
Unmanaged code includes all code written before the .NET Framework was introduced—this includes code written to use COM, native Win32, and Visual Basic 6. Because it does not run inside the .NET environment, unmanaged code cannot make use of any .NET managed facilities."
30. What are multicast delegates ? give me an example ? Ans : Delegate that can have more than one element in its invocation List.
using System;
namespace SampleMultiCastDelegate
{
  class MultiCast
  {
    public delegate string strMultiCast(string s);
  }
}

MainClass defines the static methods having same signature as delegate.
using System;
namespace SampleMultiCastDelegate
{

  public class MainClass
  {
    public MainClass()
    {
    }
    public static string Jump(string s)
    {
      Console.WriteLine("Jump");
      return String.Empty;
    }
    public static string Run(string s)
    {
      Console.WriteLine("Run");
      return String.Empty;
    }
    public static string Walk(string s)
    {
      Console.WriteLine("Walk");
      return String.Empty;     
    }
  }
}

The Main class:
using System;
using System.Threading;
namespace SampleMultiCastDelegate
{

  public class MainMultiCastDelegate
  {
    public static void Main()
    {
      MultiCast.strMultiCast  Run,Walk,Jump;
      MultiCast.strMultiCast    myDelegate;
       ///here mydelegate used the Combine method of System.MulticastDelegate
      ///and the delegates combine 
      myDelegate=(MultiCast.strMultiCast)System.Delegate.Combine(Run,Walk);
              
    }
  }
}

0 comments:

Post a Comment

Popular Posts

Company Placement Papers

 

Copyright © 2010 All Question Papers Blogger Template by Dzignine