developper Asp.Net C# interview Questions for freshers
Q. Which string method is used for concatenation of two strings in c#?
A. “Concat” method of String class is used to concatenate two strings. For example,
string.Concat(firstStr, secStr)
Q.Explain Indexers in C# asp.net ?
A. Indexers are used for allowing the classes to be indexed like arrays. Indexers will resemble the property structure but only difference is indexer’s accessors will take parameters. For example,
class MyCollection
{
private S[] myArr = new S[100];
public S this[int s]
{ get
{ return myArr[s]; }
set { myArr[s] = value;
}
}
}
Q. What are the collection types can be used in C#?
A. Here are the collection types in C# -
ArrayList
Stack
Queue
SortedList
HashTable
Bit Array
Q. Explain Attributes in C#?
A. Attributes are used to convey the info for runtime about the behavior of elements like – “methods”, “classes”, “enums” etc.
Attributes can be used to add metadata like – comments, classes, compiler instruction etc.
Q. List out the pre defined attributes in C# ?
A. Here are the predefined attributes in C#
Conditional
Obsolete
Attribute Usage
Q. What is Thread in C# asp.net?
A. Thread is an execution path of a program. Thread is used to define the different or unique flow of control. If our application involves some time consuming processes then it’s better to use Multithreading., which involves multiple threads.