Interview for 5 + years of Experience in .Net
Today I want to present the Interview Questions that are asked in a CMM - Level -3 organisation in Hyderabad. I want to give detailed description with each and every question with an example , which the Interview was recently held in the CMM -LEVEL -3 COMPANY.
1)How can you Initialize a class only once throughout the Application ?
The Answer is Use Singleton class , Using singleton class in the class constructor we can do this.
public class singleton
private static Singleton instbhushan;
public static Singleton Instance
2) cache vs application
My answer : A cache is used for repeated of requested of the same data from the website, instead of going to Database server, the data temporary maintains at one place i.e cache and fetch from there. A large volume of data can be stored in
An application variable is used to store all the users and all the sessions, thus application is store for small amount data and where as cache is used for to store extensive data.
In Cache we can define the time duration where as application state can store a limited data (this is my personal view).
3)Can we use a static members in a non static class
My Answer : We can use static members to a non static class
4) Can we use nonstatic members in a static class
My Answer : No, static classes can't be instantiated, so non static members can never be accessed.
5) ref and out keyword
My Answer : The ref keyword is used to call as an argument in a function and it is initialized where as the out keyword is
used for the same purpose but without any initialization.
public class Testbhushan
public void Exampletest( ref int refval)
public void Exampltest(out int refsval)
Question : delegate with example
My Answer : A delegate is used for reference a method , Encapsulating the methods call from the caller, It can also be called for asynchronously , than interviewer asked can you tell an example of a delegate than i told, Custom paging which dynamically link buttons need to have delegate which we called as event delegate.
lnk.Click += new System.EventHandler(this.lnk_Click);
private void lnk_Click(object sender , System.EventArgs e)
I have unique Ids in my Table Column , the table will have a similar data in the column name, I want the count of that similar data , How can you do it ?
Ans) Two methods can have 1) using Cursors and 2) while loop
Using cursors we need temptable to store the data and check against each so we can have the count of similar data with