Resources » Interview Tips » Technical Interviews

.NET interview questions for 5+ years of experience - OOPS, C#, ASP.NET, .NET Fundamentals


Updated: Category: Technical Interviews
Author: Member Level: SilverPoints: 5


Yesterday, I attended interview with Congruent Solutions, Chennai and mode of the interview was face to face. The interviewr mainly concentrated in C#, .NET Fundamentals and OOPs concents. Most of the questions look common but some of the questions are new. Q & A for .Net



Find .NET interview questions on OOPS, C#, ASP.NET, .NET Fundamentals


1. What is stack and heap?
2. Why C# codes are converted to IL and why C++ codes are converted to machine code not IL?
3. struct A
{
int a;
}
A.a.ToString();
What is the output?
4. How does the following code work? DataReader dr; for(DataRow r in dr) {}
5. What are delegates? How will you add more than one method to a delegate?
6. Does the following code work?
class A {}
class B : A {}
A = new B();
7. Two classes: a, b
________ fun()
{
int I = 10;
if(I == 10) return new a();
else return new b();
}
What will be the return parameter?
8. interface A { int print(); }
interface B { int print(); }
class C : A, B
{
int print() { Print "Welcome"; }
}
How will you call B's print method?
9. What is HTTPHandler?
10. What is the purpose of HTTP, SOAP in webservice.
11. How many master pages does a page contain?
12. Is it possible to have nested master pages?
13. What is difference between XAML and XML
14. How will you pass a table returned by a SP as parameter to another SP.
15. Where is the table name stored in SQL Server?
16. Write a query to get all the table names.
17. Consider a subquery is used in more than one query in a SP. How will you achieve this? That is how will you write a query that reuses a subquery?
18. Table A has 5 rows and table B has 7 rows. How many rows does "Select * from A, B" return?


Did you like this resource? Share it with your friends and show your love!

Responses to ".NET interview questions for 5+ years of experience - OOPS, C#, ASP.NET, .NET Fundamentals"
Author: Saurabh Tyagi  25 Apr 2011   Member Level: Gold   Points : 1
will you have the answers of these question? i want the answers of question 2 and 10. if you have please send to my email s.tyagi022@gmail.com

///regards & thanks
SAURABH Tyagi



Author: SIVA RAMAMOORTHY  05 Dec 2011   Member Level: Gold   Points : 2
C++ code after compilation will convert into Machine Code because its platform dependent. It means the application which compiled in windows will not be executed in other operating sys except Windows.

Coming to C#, its a .Net language and this is a platform Independent so it will generate the IL code, which will common for all .Net languages. So we can use this IL code in all other OS with the help of CLR, which will be integrate in .Net Framework



Guest Author: viswa   09 Apr 2012
Please send me the answer for the questions to vichu.it@gmail.com.


Guest Author: simanchal   23 Oct 2012
great questions pls ... if possible send me answer of this questions to simanchalswami@gmail.com


Guest Author: Madan   11 Dec 2012
Please send me the answers at madan.tiwari@gmail.com
thanks



Guest Author: Techi   26 Dec 2012
Please share answers for above questions to techreal9@gmail.com


Guest Author: lohitha   18 Oct 2013
Hi,
Questions are great. I need answers for the above. please do needful



Author: Aswini Aluri  10 Jan 2014   Member Level: Silver   Points : 2
What is HTTP handler?
Ans:It is the process which runs in a response to a http request ,you can use it for generating sitemaps that you submit to search engines or for rendering images or tracking emails or rss feed etc...
Write a query to get all the table names?
Ans:select * from information _schema.tables



Author: Aswini Aluri  10 Jan 2014   Member Level: Silver   Points : 1
11.How many does a page contain?
Ans:we can place more than one master page but it must be nested.



Guest Author: sunil   22 Jan 2014
Table A has 5 rows and table B has 7 rows. How many rows does "Select * from A, B" return?
return 12 rows



Author: AkshithRaj  03 Feb 2014   Member Level: Bronze   Points : 1
16. Write a query to get all the table names.
Ans:- You will get all the tables in your related database.Example

Select * from SYS.TABLES



Author: AkshithRaj  03 Feb 2014   Member Level: Bronze   Points : 2
What is difference between XAML and XML?
Ans:-
XAML stands for Extensible Application Markup Language XML stands for Extensible Markup Language XAML is based on XML, so it uses XML for its markup. If you look at a XAML document, it is also a valid XML document. But any XML document is not XAML.



Guest Author: Ritesh   19 Feb 2014
18. Table A has 5 rows and table B has 7 rows. How many rows does "Select * from A, B" return?

Ans: 5*7 = 35 (Cross Join)



Author: Ritesh  19 Feb 2014   Member Level: Bronze   Points : 0
Question 18. Table A has 5 rows and table B has 7 rows. How many rows does "Select * from A, B" return?

Ans: It is Cross Join (5*7= 35). Answer will be 35.



Author: Sheela  26 May 2014   Member Level: Bronze   Points : 0
Nice If It possible send me answer of this questions to
sheelin84@gmail.com



Guest Author: kaashiv infotech   10 Jun 2014
Super Blog.It provided best interview question which is very useful to me.keep it up.

Thank you,
Venkatesan Prabu.J
KaaShiv InfoTech



Guest Author: ashwini singh   10 Jun 2014
Nice.
If It possible send me answer of this questions to
ashwini.kulkarni82@gmail.com

Thanks for sharing your experience .



Author: Suresh  11 Jun 2014   Member Level: Bronze   Points : 0
Good.
If It possible send me answer of this questions to
suresh.rajagopalnkl@yahoo.com

Thanks for sharing your experience .



Author: sreethi  29 Oct 2014   Member Level: Silver   Points : 0
If It possible send me answer of this questions to
b.raadhika1011@gmail.com

Thanks for sharing your experience .



Author: sridhar thota  25 May 2015   Member Level: Gold   Points : 4
10. What is the purpose of HTTP, SOAP in webservice?
a)Client application method call will go to proxy, proxy will convert method call to xml format that is soap message.
Soap message will reach webserver via HTTP protocol.
Webserver will create object of webservice and method is executed.
The result in the form of soap format is given to client back over HTTP.

16. Write a query to get all the table names.
a) For oracle: Select * from tab;
For Sql server: Select * from sys.tables;

Regards

Sridhar.
DNS Member.
"Hope for the best.. Prepare for the worst.."



Author: Rahul Tripathi  31 May 2015   Member Level: Bronze   Points : 0
16. Write a query to get all the table names.
Ans- SELECT name FROM sys.Tables.



Author: Rahul Tripathi  31 May 2015   Member Level: Bronze   Points : 0
16. Write a query to get all the table names.
Ans- SELECT name FROM sys.Tables.



Author: Pawan Awasthi  22 Jun 2015   Member Level: Diamond   Points : 10
Hai Saravanam,
Thanks for posting the questions. Below I am trying to provide the answers of these question. If anyone knows better answers please post them as they will help to all of us:
1. What is stack and heap?
Ans. Stack and Heap are the type to store the data. Stack is value type which stores the data directly while heap is reference type which stores the memory location and at those memory location, the actual data stores.
E.g. of Stack is int, float, char etc
E.g. of Heap is string, Array etc.

2. Why C# codes are converted to IL and why C++ codes are converted to machine code not IL?
Ans. Yes, the C# code first gets converted to the IL(CIL or MSIL) code because the C# is very high level language which cant communicate to the OS directly. The CSC(C# compiler) converts this very high level language to low level language called as IL and then JIT compiler finally convert this to machine language.
C++ is the middle level language so the C++ compiler can directly convert this to machine language which is finally understandable by the OS.

3. struct A
{
int a;
}
A.a.ToString();
What is the output?
Ans. 0 ( default for int)

4. How does the following code work? DataReader dr; for(DataRow r in dr) {}
And. DataReder is forward only read-only record-set.
When we write dr.Read(), it point to next record in the result set to read.

5. What are delegates? How will you add more than one method to a delegate?
Ans. Delegate is the function point which points to another method. We can execute other methods using delegate without concerning the class where the method exists.
To add more and one method, we can create multiple delegate and combine them. Delegate support + and - operators to add and subtract delegates.

6. Does the following code work?
class A {}
class B : A {}
A = new B();
Ans. Yes, this is a type of inheritance which works to assign the child class object to base class reference.
This is frequently used in interfaces.

7. Two classes: a, b
________ fun()
{
int I = 10;
if(I == 10) return new a();
else return new b();
}
What will be the return parameter?
Ans. object

8. interface A { int print(); }
interface B { int print(); }
class C : A, B
{
int print() { Print "Welcome"; }
}
How will you call B's print method?
Ans. When the parent interfaces have the same method and they are inherited to same class, we can call the interface method using external interface implementation.
In this we need to explicitly define the method of the interface as below:
class C : A, B
{
int A.print() { Print "Welcome A"; } // extended interface implementation
int B.print() { Print "Welcome B"; }// extended interface implementation
}

9. What is HTTPHandler?
Ans. HttpHandler is the utility to handle the requests coming in IIS. Handler are the way to filter the request of specific type so that other types of the request will not be entertained.
In case of ASP.Net, when the request comes through IIS, first it checks for the .aspx and if the requested page is html, the request will not come inside the IIS for the further processing.
HttpHandler handles the HTTP request and process it through HttpPipeline.

10. What is the purpose of HTTP, SOAP in web-service.
Ans. HTTP(Hyper Text Transfer Protocol) is the set of slandered for the web requests. SOAP ( Simple Object Access Protocol) is the message format which is used to send and receive data in the specific message format in case of services.
Web Service transmits and receive the data in form of Message and each message should have some format so that it will be understandable by the browser and getting the responses in the same format. SOAP defines the common format of the messages which is XML format and understandably by all the technologies(as XML is platform independent).

11. How many master pages does a page contain?
Ans. A single page can contain multiple master pages but they should be nested.

12. Is it possible to have nested master pages?
Ans. yes

13. What is difference between XAML and XML
Ans. XAML is the new declarative language used in the WPF and Silverlight application and can be used only in developing these type of applications while XML is the platform independent language and used mainly for the transferring of the data, carrying the data over the internet.

14. How will you pass a table returned by a SP as parameter to another SP.
Ans. We can declare a table variable(supported since Sql Server 2005) and then we need to create the column for that table variable and fill the data. After that we can pass the whole table in the stored procedure.

15. Where is the table name stored in SQL Server?
Ans. SYSOBJECTS contains all the database objects where we can search the table as below:
select * from sysobjects where xtype='U' will give all the table names and we can search our table by adding the additional criteria.

16. Write a query to get all the table names.
Ans. select * from sysobjects where xtype='U'

17. Consider a sub-query is used in more than one query in a SP. How will you achieve this? That is how will you write a query that reuses a sub-query?
Ans. We can use the loops inside the stored procedure and calculate the value each time when running the query. The other way could be the cursor.(Not sure about the question's expectations)

18. Table A has 5 rows and table B has 7 rows. How many rows does "Select * from A, B" return?
Ans."Select * from A, B" will return 35 rows(Cross join) where one record of the table A will be the cross product for the table B.



Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Submit Article     Return to Article Index
    Subscribe to Subscribers
    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Talk to Webmaster Tony John

    Online Members

    More...
     
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India