Thursday, March 28, 2013

Experience and Fresher .net or DotNet 2005/2008/2010 Interview Question and Answer




What is the difference between adding reference in solution Explorer and adding references by USING ?
Adding reference in solution explorer is used to add the DLL for that project for reference only. If you want to utilize that DLL methods/functions in our aspx.cs/.cs file etc you must write using that nameclass library name in file.

 Where the assembly is stored in asp.net?.
private are stored in application / bin directory and public are stored in GAC.
How many types of collections are in C#?
5
The .Net framework supports five general types of collectios:
1. Non-Generic
2. Specialized
3. Bit-based
4. Generic
5. Concurrent

What is difference between shalow copy and deep copy in C#
shallow copy copies reference and deep copy copies actual objects data.
Array.Clone() is an example for shallow copy, it copies reference only. Now we have two array references pointing to same memory locations.

Array.CopyTo() is an example for deep copy, it creates new instance for each element's object. Now we will have two different copies of arrays referring to different memory locations.

How we can achieve, while typing text in Text box in upper case it will convert to lowercase automatically

Style="text-transform: lowercase"

What does display="None" will do actually on the control

removes the element completely from the document

What is the first method during the Page Load
Init

In which event we can change the Master Form dynamically?

Page_PreInit

In which event are the controls fully loaded?
Page_Init

Can a class have more than one destructor?

No
No, a class can have only 1 destructor.

Can you explicitly call a destructor?
No

Is it possible to access one aspx page's view state data into another aspx page? If so, How?
possible through cross page post back

In which stage the asp.controls will convert into his equivalent html tags during the page life cycle?
page render 

We have master page and content page then what should be the sequence of events in this scenario.
Content Page PreInit Event
Master Page Init Event
Content Page Init Event
Content Page Load Event
Master Page Load Event

we have master page, content page and a web user control on master page only then what should be the sequence of events in this scenario.
Content Page PreInit Event
Master:UserControl Init Event
Master Page Init Event
Content Page Init Event
Content Page Load Event
Master Page Load Event
Master:UserControl Load Event

we have master page, content page and a web user control on master page and content page on both then what should be the sequence of events in this scenario.
Content Page PreInit Event
Page:UserControl Init Event
Master:UserControl Init Event
Master Page Init Event
Content Page Init Event
Content Page Load Event
Master Page Load Event
Page:UserControl Load Event
Master:UserControl Load Event

How many types of directive are used in asp.net?
11

What are contracts in WCF?

WCF defines four types of contracts.

(1)    Service contracts - Describe which operations the client can perform on the service.
There are two types of Service Contracts.
(a) ServiceContract - This attribute is used to define the Interface.
(b) OperationContract - This attribute is used to define the method inside Interface.
[ServiceContract]
interface IMyContract
{
   [OperationContract]
   string MyMethod( );

}

class MyService : IMyContract
{

   public string MyMethod( )

   {
      return "Hello World";
   }
}       


(2)  Data contracts - Define which data types are passed to and from the service.
There are two types of Data Contracts.
DataContract - attribute used to define the class
DataMember - attribute used to define the properties.

public class Suspension
    {
        [DataMember]
        public int SystemRef { get; set; }

        [DataMember]
        public string Reference { get; set; }

        [DataMember]
        public DateTime? StartDate { get; set; }

        [DataMember]
        public int Contract { get; set; }

    }
If DataMember attributes are not specified for a properties in the class, that property can't be passed to-from web service.

(3)  Fault contracts - Define which errors are raised by the service.
(4)  Message contracts - Allow the service to interact directly with messages.

What was the code name for WCF?
The code name of WCF was Indigo .

Which namespace is used to access WCF service?
System.ServiceModel




New Page – SQL

How can I get data from a database on another server?
If you want to import data only through t-sql query, then either use OPENDATASOURCE function. To repeatedly get data from another server, create a linked server and then use OPENQUERY function or use 4 part naming. If you are not adhered with T-SQL, then better use import/export wizard.

My multilanguage data is not inserting correctly and returning ?. How can I store Multilanguage data in a table?
There are two things to keep in mind while storing unicode data. First, the column must be of unicode data type (nchar, nvarchar, ntext). Second, the value must be prefixed with N while insertion. For example,
INSERT INTO table (Hindi_col) values (N’hindi data’)

What is Difference between GETDATE and SYSDATETIME in SQL Server 2008?
In case of GETDATE, the precision is till milliseconds, and in case of SYSDATETIME, the precision is till nanoseconds

SELECT GETDATE() fn_GetDate, SYSDATETIME() fn_SysDateTime


How to Get SQL Server Version ?

@@VERSION

 

Query to Get List of Views?

select * from information_schema.views

 

No comments:

Post a Comment