Buy Questpond's video subscriptions on
huge discount
.
Online: 8050
Home
Articles
Interviews
Forums
For Beginners
Popular Questions
ITIL Career Advice
PMP Career Advice
Career Advices
Codes
Videos
ASP.NET
ASP.NET MVC
Android Intel XDK
Sql Server
AngularJS
Bootstrap
Backbone.JS
MongoDB
LESS (CSS)
jQuery
WPF
WWF
SSIS
LightSwitch
Tutorials
News
ASP.NET MVC
|
Be Interview Ready
|
Top Performers
|
DNF MVP
|
Top Posts
|
Winners
|
Subscribe
|
Catalogs
Welcome Guest !
Register
Login
Home
>
Exclusive Interviews
> C#
C# Exclusive Interview Questions and Answers (453) - Page 21
A joint initiative from DotNetFunda.Com and Questpond.
A one stop place on the internet to get trusted and proven Interview Questions (based on more than a decade of experience in this field) to ensure the success of the candidates.
You will find almost all Interview questions from Questpond here and this list is growing day by day with all latest and updated interview questions.
453 records found.
Post Interview
|
Interview Experiences
|
Interview FAQs
|
Online Interviews
|
Interviews Home
Get 650+ Questpond's Interview videos on discount
Loading ...
________ to check whether the thread is dead or alive.
NOTE: This is objective type question, Please click question title for correct answer.
____________________ is a block of code which can be executed by only one thread at any given instance of time.
NOTE: This is objective type question, Please click question title for correct answer.
Locking _________ throughput.
NOTE: This is objective type question, Please click question title for correct answer.
___________________ is a synchronized resource managed by the OS.
NOTE: This is objective type question, Please click question title for correct answer.
What are the advantages of Generics
1. Generics solve the problem of type safety
2. Code Reusability: if we write a Generic Class or method once we can use that through out our program. hence it is code reuse
3. Performance: By using Generics performance increases ,this is because we are not using the concept of Boxing
4 Generic methods can often be called without employing any special syntax by using a feature called type inference
What are Generics in C#.Net
The generics feature in C# has been introduced with version 2.0 of the .NET Framework and these arejust like templates in C++. Using generics we can
create classes,methods, events, delegates which work with any type (like int, string, myclass etc). The Advantages with Generics are Performance will
increase, Code Reusability and Type Safety.
What is Generic class ? What is the purpose of Generic class
Generic class is not specific to any particular Data Type, but the instance of
that class is specific to the data type at the time of creating the
instance of the class.
For every data type the generic class is generated, a separate instance of the class is loaded by the class loader in CLR.
Define Collections in .NET and briefly explain its types
From a .NET perspective, a collection could be defined as an object that
implements one or more of the System.Collections.ICollection,
System.Collections.IDictionary, and System.Collections.IList interfaces.
This definition leads to my classification of the "built-in"
collections found in the System.Collections namespace into three broad
categories:
•Ordered collections: Collections that implement only the
ICollection interface are usually distinguished by the fact that
insertion order controls the order in which objects may be retrieved
from the collection. The System.Collections.Stack and
System.Collections.Queue classes are both examples of ICollection
collections.
•Indexed collections: IList-implementing collections are
distinguished by the fact that their contents can be retrieved via a
zero-based numeric index, like an array. The
System.Collections.ArrayList object is one example of an indexed
collection.
•Keyed collections: Collections implementing the IDictionary
interface contain items that can be retrieved by an associated key value
of some kind. The contents of IDictionary collections are also usually
sorted in some fashion based on the key value and can be retrieved in
sorted order by enumeration. The System.Collections.HashTable class
implements the IDictionary interface
What is IEnumerable interface
IEnumerable interface exposes the enumerator, which supports a simple iteration over a non-generic collection and it is forward only.
What is Array List in .Net
Array list is a type which similar to an Array. We will specify the size for
the Array which will never going to change in its life time. But In
Array List, the size gets dynamically increases when needed.
Example:
Using System.Collections;
Public static void main(String[] args)
{
ArrayList arrList = new ArrayList();
arrList.Add(11);
arrList.Add(12);
arrList.Add(13);
arrList.Add(14);
foreach(int num in arrList)
{
Console.WriteLine(num);
}
}
How to use Dictionary class in Systems.Collections.Generic
Create a Dictionary object and populate it and enumerate it to display key value pairs.
Example if we want to have integer as key and string as value. we can create dictionary object in the following way:
Dictionary<int,string> dictNames =new Dictionary<int,string>();
dicNames.Add(1,”Raj”);
dicNames.Add(3,”Ravi”);
dicNames.Add(5,”Kevin”);
In order to retrieve above value enumerate it i.e use foreach loop
and use KeyValuePair object as the elements are retrieved as
KeyValuePair objects
foreach(KeyValuePair<int,string> kvpName in dictNames)
Console.WriteLine(kvpName.Key+” “+kvpName.Value);
list some of the Similarities and Difference between Hashtable and arraylist
Both are used to store objects. mostly In arraylist elements are accessed
using index where as in Hashtable elements are accessed using keys
What is meant by Constraint in Generics
Constraints allow additional contextual information to be added to the type
parameters of generic types. The constraints limit the range of types
that are allowed to be used as type arguments, but at the same time,
they add information about those type parameters.
Which namespace has to be added for using generic list (List
, where T is datatype) in C#
using System.Collections.Generic
What is the drawback of arraylist compared with Generic list
In an Arraylist, As Each item is stored as an object, During Sorting and
traversing the list, it must be typed at runtime, and then compared for sorting/searching wheareas Generic list has all items typed compile
time, which saves a lot of workload during sorting and searching.
How to Serialize the generic types
[Serializable]
public class TestClass<T>
What is Bit Array and properties of Bit Array
The BitArray class manages an array of bit values.
These bit values are boolean in nature,i.e., true (1) or false (0).
Properties
•Count - Gets the number of elements contained in the BitArray.
•IsReadOnly - Gets a value indicating whether the BitArray is read-only.
•Item - Gets or sets the value of the bit at a specific position in the BitArray.
•Length - Gets or sets the number of elements in the BitArray.
what is dictionary? How to use
Dictionary<K,V> is a generic collection that contains data in Key/Value pairs, it
is just like the nongeneric collection Hashtable.
Ex:-Dictionary<string, string> dictionary = new Dictionary<string, string>();
dictionary.Add("Key", "Value"); //Add the specified key and value to the
// dictionary
dictionary.Remove("Key"); //Removes the value with the specified
// key from the dictionary
int count = dictionary.Count; //get the number of the Key/Value pairs
// contained in the dictionary
What are Nested Types in Generics
A type that is nested in a generic type can depend on the type parameters
of the enclosing generic type. The common language runtime considers
nested types to be generic, even if they do not have generic type
parameters of their own. When you create an instance of a nested type,
you must specify type arguments for all enclosing generic types.
what is the advantage of TrimToSize in array list
By this we can decrease the capacity of array List i.e.,we can set capacity to the actual number of elements in the array List.
1
...
14
15
16
17
18
19
20
21
22
23
More C# Interview Questions & Answers here
Found this useful, bookmark this page to the blog or social networking websites.
Bookmark It
Exclusive Interview Questions and Answers Categories
.NET Certifications
.NET Core
.NET Framework
ADO.NET
AI ML
Android
Angular
AngularJS 1x
Aptitute Test
ASP.NET
ASP.NET AJAX
ASP.NET Core
ASP.NET MVC
ASP.NET Web API
Aurelia
Azure
Best Practices
BizTalk Server
Bootstrap
C#
Cloud
CMS
CSS 3
Data Structures & Algorithms
Design Pattern & Practices
DotNetFunda.Com
Entity Framework
Error and Solution
F#
Function Points (FPA)
HR
HTML 5
IIS
Interview Questions
JavaScript
jQuery
Kinect
LightSwitch
LINQ
Management
Mobile Development
MSBI (SSIS, SSRS, SSAS)
Mule
Networking
News and Community
Node.js
NoSql
OOPS
Oracle
Others
PostgreSQL
PowerShell
Product Reviews
Project Management
Python
QA (Testing)
R Language
Regular Expressions
SEO
SharePoint
SignalR
Silverlight
Sql Server
TypeScript
UML
VB.NET
Visual Studio
WCF
Web Analytics
Web Services, Remoting
Windows 8
Windows Forms
Windows Metro
Windows Phone
WPF
WWF
XML