Congratulations to all the winners of April 2013, they have won INR 3400 cash and INR 20147 worth prizes !
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 63313 |  Welcome, Guest!   Register  Login
 Home > Interview Questions > C# Interview Questions

Now you don't need go anywhere to get the best interview questions on Microsoft technology. We are trying to gather all real interview questions asked from MNCs and put them here. You can also assist us in doing so by submitting .net interview questions. These questions are generally different from certification questions however it may help you in that too.



Page copy protected against web site content infringement by Copyscape
Static constructor is used to initialize static data members as soon as the class is referenced first time, whereas an instance constructor is used to create an instance of that class with keyword. A static constructor does not take access modifiers or have parameters and can't access any non-static data member of a class.

It provides a mechanism that synchronizes access to objects.

The Monitor class controls access to objects by granting a lock for an object to a single thread. Object locks provide the ability to restrict access to a block of code, commonly called a critical section. While a thread owns the lock for an object, no other thread can acquire that lock. You can also use Monitor to ensure that no other thread is allowed to access a section of application code being executed by the lock owner, unless the other thread is executing the code using a different locked object.

For more visit http://msdn2.microsoft.com/en-us/library/system.threading.monitor.aspx

Lock ensures that one thread does not enter a critical section of code while another thread is in the critical section. If another thread attempts to enter a locked code, it will wait, block, until the object is released.

NOTE: This is objective type question, Please click question title for correct answer.

You can do this in more than one way but ForEach loop is much better than any other way in terms of cleanliness of the code or performance.

ForEach loop
foreach (DataRow row in dTable.Rows)

{
yourvariable = row["ColumnName"].ToString();
}


For loop

for (int j = 0; j< dTable.Rows.Count; j++)
{
yourvariable = dTable.Rows[j]["ColumnName"].ToString()l
}

An array is a collection of related instance either value or reference types. Array posses an immutable structure in which the number of dimensions and size of the array are fixed at instantiation.

C# Supports Single, Mult dimensional and Jagged Array.

Single Dimensional Array: it is sometimes called vector array consists of single row.

Multi-Dimensional Array: are rectangular & consists of rows and columns.

Jagged Array: also consists of rows & columns but in irregular shaped (like row 1 has 3 column and row 2 has 5 column)

ArrayList is a dynamic array. Elements can be added & removed from an arraylist at the runtime. In this elements are not automatically sorted.

The BitArray collection is a composite of bit values. It stores 1 or 0 where 1 is true and 0 is false. This collection provides an efficient means of storing and retrieving bit values.

A Hashtable is a collection of key-value pairs. Entries in this are instance of DictionaryEntry type. It implements IDictionary, ISerilizable, IDeserializable collback interface.

This is a collection that abstracts FIFO (First In First Out) data structure. The initial capacity is 32 elements. It is ideal for messaging components.

This is a collection that abstracts LIFO (Last In First Out) data structure in which initial capacity is 32.

This is a collection and it is a combination of key/value entries and an ArrayList collection. Where the collection is sorted by key.

A delegate in C# allows you to pass method of one class to objects of other class that can call these methods.

OR

A delegate is an object that holds the reference to a method.

In C++ it is called function pointer.

A collection serves as a container for instances of other classes. All classes implement ICollection interface which intern implement IEnumerable interface.

Reflection is the ability to find the information about types contained in an assembly at runtime.

OR

Reflection is the ability to find out information about objects, the application details (assemblies), its metadata at run-time.

Edited:
See the example: http://www.dotnetfunda.com/articles/article132.aspx

Found this useful, bookmark this page link to the blog or social networking websites. Page copy protected against web site content infringement by Copyscape
Navigate to Page: 1 | 2 | 3 | 4 | 5 | 6 | ... | 37 |

 More Exclusive C# Interview Questions and Answers here


Found interesting? Add this to:


About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/20/2013 11:55:34 AM