Ads 468x60px


Saturday, 20 April 2013 interview questions with answers for 2 years experience interview questions with answers for 2 years experience
1 :- If I have more than one version of one assemblies, then how will I use old version (how/where to specify version number?) in my application?

Ans.The version number is stored in the following format: …. The assembly manifest can then contain a reference to which version number we want to use.

2  :-  How do you create threading in.NET? What is the namespace for that?

//create new thread using the thread class’s constructor

Thread myThread = new Thread(new ThreadStart (someFunction));

3 : - What do you mean by Serialize and MarshalByRef?
Serialization is the act of saving the state of an object so that it can be recreated (i.e deserialized) at a later date.
The MarshalByRef class is part of the System.Runtime.Remoting namespace and enables us to access and use objects that reside in different application
domains. It is the base class for objects that need to communicate across application domains. MarshalByRef objects are accessed directly within their own
application domain by using a proxy to communicate. With MarshalByValue the a copy of the entire object is passed across the application domain

  4 : - What is the difference between Array and LinkedList?
Ans.An array is a collection of the same type. The size of the array is fixed in its declaration.
A linked list is similar to an array but it doesn’t have a limited size.

8 :-  What is Asynchronous call and how it can be implemented using delegates?
A synchronous call will wait for a method to complete before program flow is resumed. With an asynchronous call the program flow continues whilst the method executes.

//create object
SomeFunction objFunc = new SomeFunction();

//create delegate
SomeDelegate objDel = new SomeDelegate(objFunc.FunctionA);

//invoke the method asynchronously (use interface IAsyncResult)
IAsyncResult asynchCall = SomeDelegate.Invoke();

  9 :- How to create events for a control? What is custom events? How to create it?
An event is a mechanism used in a class that can be used to provide a notification when something interesting happens. (typical evens in a windows application
include: change text in textbox, double click or click a button, select an item in dropdown box).
A custom event is an event created by the user that other developers can use. For example assuming that we have a CashTransaction class and we have a bank
balance property in that class. We may want to set-up an event that provides a notification when the bank balance drops below a certain amount. In order to
produce an event the process would be roughly as follows:
Create the class for the event derived from EventArgs.
Create a delegate with a return type of void.
Create a class containing the method that will activate the event.
Create a class with methods to handle the event.

  10 : - If you want to write your own dot net language, what steps you will you take care?

Ans.We will need to ensure that the high level code is compiled to MSIL (Microsoft intermediate language) so that it can be interpreted by the CLR.

11 : -  Describe the diffeerence between inline and code behind - which is best in a loosely coupled solution?

The term ‘code behind’ refers to application code that is not embedded within the ASPX page and is separated out into a separate file which is then referenced
from the ASPX page. Inline code is the traditional ASP architectural model where business logic code was embedded within the ASP page. Separating the business
logic code from the presentation layer offers several advantages:
1) It allows graphic designers and web developers to work on the presentation layer whilst the application developers concentrate on the business logic.
2) The codebehind file is compiled as a single dll increasing the efficiency of the application,
3) The codebehind model offers a true OO development platform,
4) It speeds up development time as it allows developers to fully maximise the features of the .NET framework such as Cahing, ViewState, Session, Smart Navigation etc.
5) Code is much easier to maintain and susceptible for change.
6) The compiler and VS.NET provides much better support for error checking, intellisense and debugging when using the code behind model.

12 : -  How dot net compiled code will become platform independent?
The raison d’etre for .NET was to cater for multiples languages on a single windows platform whereas the aim of Java was to be a single language on multiple
platforms. The only way that .NET can be platform independent is if there is a version of the .NET framework installed on the target machine.

  13 : - Without modifying source code if we compile again, will it be generated MSIL again?


  14 : - How does you handle this COM components developed in other programming languages in.NET?

use TlbImp.exe to import the COM types into your .NET project. If no type library for the COM component then use System.Runtime.InteropServices
use RegAsm.exe to call a .NET developed component in a COM application.

  15 : - How CCW (Com Callable Wrapper) and RCW (Runtime Callable Wrappers) works?

CCW: When a COM application calls a NET object the CLR creates the CCW as a proxy since the COM application is unable to directly access the .NET object.
RCW: When a .NET application calls a COM object the CLR creates the RCW as a proxy since the .NET application is unable to directly access the .COM object.

  16 :- What are the new thee features of COM+ services, which are not there in COM (MTS)?

Role based security.
Neutral apartment threading.
New environment called context which defines the execution environment

  17 : - What are the differences between COM architecture and.NET architecture?

.Net architecture has superseded the old COM architecture providing a flexible rapid application development environment which can be used to create windows,
web and console applications and web services. .NET provides a powerful development environment that can be used to create objects in any .NET compliant language.
.NET addresses the previous problems of dll hell with COM by providing strongly named assemblies and side-by-side execution where two assemblies with the same name can run on the same box.

  18 : - Can we copy a COM dll to GAC folder?

No. It only stores .NET assemblies.

  19 : - What is Shared and Repeatable Inheritance?

Shared Inheritance-: Shared Inheritance-: ITt is multiple times using same class. The mechanism of deriving a new class from an existing class is called inheritance. Shared inheritance introduces a new opportunity of ambiguity and additional implementation complexity. Assume D inherits from B and C, both of which inherits from A. Here A in shared. Single copy made from both derived classes is called shared inheritance.

 20 : - Can you explain what inheritance is and an example of when you might use it?
Inheritance is a fundamental feature of any OO language. It allows us to inherit the members and attributes from a base class to a new derived class. This
leads to increased code reusability and also makes applications easier to develop, maintain and extend as the new derived class can contain new features not
available in the base class whilst at the same time preserving the attributes inherited from the base class.

21 : -  How can you write a class to restrict that only one object of this class can be created (Singleton class)?


Use the singleton design pattern.

 public sealed class Singleton  
   static readonly Singleton Instance=new Singleton();  
      static Singleton()  
      public static Singleton Instance  
                return Instance;  

22 : -. What are virtual destructures?

A constructor can not be virtual but a destructor may. Use virtual destructors when you want to implement polymorphic tearing down of an object.

  23 : - What is close method? How its different from Finalize and Dispose?

finalise is the process that allows the garbage collector to clean up any unmanaged resources before it is destroyed.
The finalise method can not be called directly; it is automatically called by the CLR. In order to allow more control over the release of unmanaged resources
the .NET framework provides a dispose method which unlike finalise can be called directly by code.
Close method is same as dispose. It was added as a convenience.

  24 : - What is Boxing and UnBoxing?

Boxing is the process of converting a value type to a reference type. More specifically it involves encapsulating a copy of the object and moving it from
stack to heap. Unboxing is the reverse process.

  25 : - What is check/uncheck?

checked: used to enable overflow checking for arithmetic and conversion functions.
unchecked: used to disable overflow checking for arithmetic and conversion functions

  26 : -What is the use of base keyword? Tell me a practical example for base keyword’s usage?

The base keyword is used to access members of the base class from within a derived class:
* Call a method on the base class that has been overridden by another method.
* Specify which base-class constructor should be called when creating instances of the derived class.

A base class access is permitted only in a constructor, an instance method, or an instance property accessor.
It is an error to use the base keyword from within a static method.
Example:In this example, both the base class, Person, and the derived class, Employee, have a method named Getinfo. By using the base keyword,
it is possible to call the Getinfo method on the base class, from within the derived class.
// keywords_base.cs
// Accessing base class members
 using System;  
 public class Person  
 protected string ssn = "444-55-6666";  
 protected string name = "John L. Malgraine";  
 public virtual void GetInfo()  
 Console.WriteLine("Name: {0}", name);  
 Console.WriteLine("SSN: {0}", ssn);  
 class Employee: Person  
 public string id = "ABC567EFG";  
 public override void GetInfo()  
 // Calling the base class GetInfo method:  
 Console.WriteLine("Employee ID: {0}", id);  
 class TestClass {  
 public static void Main()  
 Employee E = new Employee();  

27 :- What are the different.NET tools which you used in projects?

Ans:Just read your question once again and thought Interviewer might be asking about the development tool you have used to develop ASP.NET projects.
So your answer can be Visual Studio 2005 or 2008 or 2010 whatever you have used, you may also tell Visual Web Developer or any other tool you might
have used to develop your ASP.NET Projects

Click Here : - More Dotnet Interview Question with Answer

1 comment:



New Updates

Related Posts Plugin for WordPress, Blogger... View My Stats

Related Result