21 March 2013

Dot Net -- Questions and Answer:[Difference Between] Part-II

Dot Net -- Questions and Answers:[Difference Between]
Part-II
1.            What is Difference between Namespace and Assembly?
                Namespace is a collection of different classes.
          An assembly is the basic building blocks of the .net framework.
2.            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.
3. What’s the difference between private and shared assembly?
                Private assembly is used inside an application only and does not have to be identified by a strong name.
Shared assemblycan be used by multiple applications and has to have a strong name.
4. What are the difference between Structure and Class?

  •          Structures are value type and Classes are reference type
  •          Structures cannot have constructors or destructors. Classes can have both constructors and destructors.
  •          Structures do not support Inheritance, while Classes support Inheritance.
5. What are the differences between dataset. Clone and dataset. Copy?

  •                 Dataset. Clone copies just the structure of dataset (including all the data tables, schemas, relations and constraints.); however it doesn’t copy the data.
  • Dataset. Copy, copies both the dataset structure and the data.
6. What is the difference between the Debug class and Trace class?
                Use Debug class for debug builds, use Trace class for both debug and release builds.
7. What is the difference between System. String and System.StringBuilder classes?
                System. String is immutable; System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.
8. What is the difference between a Thread and a Process?
                A Process is an instance of a running application. And a thread is the Execution stream of the Process. A process can have multiple Threads.
9. What is difference between MetaData and Manifest?
                Metadata and Manifest forms an integral part of an assembly (dll / exe) in .net framework. Out of which Metadata is a mandatory component, which as the name suggests gives the details about various components of IL code via: Methods, properties, fields, class etc.
10. How is method overriding different from method overloading?
                When overriding a method, you change the behavior of the method for the derived class. Overloading a method simply involves having another method with the same name within the class.
11. What is the difference between Compiler and Interpreter?
                Compiler:  A compiler is a program that translates program (called source code) written in some high level language into object code.
Interpreter:  An interpreter translates high-level instructions into an intermediate form, which it then executes. Interpreter analyzes and executes each line of source code in succession, without looking at the entire program; the advantage of interpreters is that they can execute a program immediately. .
12.          What is the difference between datagrid and gridview?
                            Datagrid is used in windows application and gridview is used in web datagrid we cannot write the code for datagrid properties where as  grid view we can write the code like template column item template etc this will not be done in datagrid.
13.          What is the difference between static or dynamic assemblies?
                                Assemblies can be static or dynamic.

  • Static assemblies:  can include .NET Framework types (interfaces and classes), as well as resources for the assembly (bitmaps, JPEG files, resource files, and so on). Static assemblies are stored on disk in portable executable (PE) files.
  • Dynamic assemblies: which are run directly from memory and are not saved to disk before execution. You can save dynamic assemblies to disk after they have executed.
14.          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).
15.          What is difference between constants, readonly 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.
16.          What is strong-typing versus weak-typing?

  •                 Strong type is checking at the variables in compile time.
  •                Weak type is checking the variables at run-time.
17.   What are all the differences between Dispose and Finalize ()?
  • Finalize method is called by Garbage collector which helps us to make free of unmanaged resources. There are some other resources like window handles, database connections are handled by iDisposable interface.
  • Dispose method is handled by IDisposable interface to explicitly release unused resources. Dsipose can be called even if other references to the object are alive.

18.   What is the difference between int and int32?
Int32 represent 32-bit signed integer whereas int is not a keyword used in VB.Net. 
19.    What is difference between Class & Interface?
  •                 Class: It is logical representation of object. It is collection of data and related sub procedures with definition.
  • Interface:  It is also a class containing methods which is not having any definations.Class does not support multiple inheritances. But interface can support.
20.          What is the difference between compile time polymorphism and run time polymorphism?

  •  Compile time Polymorphism: Compile time Polymorphism also known as method overloading.  Method overloading means having two or more methods with the same name but with different signatures.
  •     Run time Polymorphism:  Run time Polymorphism also known as method overriding. Method overriding means having two or more methods with the same name , same signature but with different implementation.

No comments: