Get benefited from interview Q/A and Online Test section. Subscribe to this blog to get updates directly in your mail box.
Best View in Google Crome, Mozilla firefox or IE 7 or above
Showing posts with label Interview Questions. Show all posts
Showing posts with label Interview Questions. Show all posts

Sunday, April 6, 2014

Difference between constructor and method in c#

This is a very basic question mainly asked in Beginner level interviews (1 to 2 years of experience).
The interviewer can twist the question as below as well.


  • Difference between method and constructor in c#
  • Difference between constructor and method in dotnet with example
  • Difference between methods and constructors in object oriented programming


Answer:

Here are few differences between Constructor and methods in bullet points.


Constructor:
1. Name of constructor should be same as class name
2. Constructor is used to initialize class members (variables). It is used to create an instance of  a class.
3. Returns nothing. Hence no return type.
4. Called implicitly at the time of object creation


Method:
1. Name is independent from class name
2. Method is having some functionality. It is used to perform some operations.
3. Must return something. If nothing to return, explicitly return type should be void.
4. Need to be called explicitly


Saturday, February 2, 2013

What is QueryString? What are the advantages and disadvantages of QueryString?

QueryString is a property of Request object in ASP.Net that provides a mechanism to send information to the server in the form of Sting in the URL.

Example: http://www.testsite.com/Webform1.aspx?fname=Alok&lname=Ranjan

In the above example, the destination webform name is Webform1.aspx and the information passed in QueryString is fname=Alok&lname=Ranjan. fname is a variable whose value is Alok, and similarly lname variable has value as Ranjan.

Advantages of QueryString:

  • It's very easy to implement
  • Every browser works with QueryString.
  • It doesn't require server resources. Hence, doesn't put any burden on Server.


Disadvantages of QueryString:

  • There is a limitation in the length of the QueryString as URL length has a limit. If you have to send lot of information, QueryString approach doesn't work.
  • The information passed through QueryString is publicly visible. Hence, it poses security issue. So, QueryString can't be used while sending sensitive info. 
  • QueryString can not be used to send & and space characters.

Monday, July 11, 2011

What is the difference between web.config and machine.config

This is a common question asked in ASP.Net interviews.

Web.config and machine.config are two files used for managing configuration of web applications.

Machine.config:

1. The configurations mentioned in machine.config file are applicable to all the applications hosted in a machine/computer/server.

2. The machine.config file is located in x:\\Microsoft.NET\Framework\\config\machine.config

3. There can be only one machine.config file per machine (per dotnet framework installed).

web.config:

1. web.config file contains configurations for a single application.

2. Web.config files overrides the configurations mentioned in machine.config file.

3. The web configuration file is located in your application's root folder

4. There can be multiple web.config files in a single web application in different sub folders.

Sunday, May 2, 2010

What are Modal and Modeless forms in Windows Forms Application?

Modal Form:

In a modal form Windows application, the last form opened can only be accessed. i.e. the parent form cannot be accessed as long as the child form is open.

Modeless Form:

In case of Modeless form, Parent window generates a child window (as in Modal forms), but the user can access either of the Parent window or Child Window.

Friday, May 15, 2009

Dotnet Framework Interview Questions


This section contains Dotnet Framework Interview Questions that I faced in my interviews at the time of job change. Please post your comments here. Also, post your questions to get an answer.

1. What is an assembly in .Net? What is manifest?

2. What is GAC?

3. If you have two versions of the same assembly in GAC and you want to use the older version, how to achieve this?

4. What is side-by-side execution?

5. What is Reflection?

6. What is a satellite assembly?
Hint: Localization

Many more to come ....

C# Dotnet Interview questions

This section contains C# Dotnet Interview Questions that I faced in my interviews at the time of job change. Please post your comments here. Also, post your questions to get an answer.

1. What are the features of an object oriented programming language?
Ans: I. Abstraction
II. Encapsulation
III. Polymorphism
IV. Inheritance

2. What is the difference between overloading and overriding in C#?

3. What is the difference between Abstract class and Interface?

4. What is the difference between ref and out?

5. What is Generics in C#? List the advantages.

6. What is advantages of using "using" block?
Ans: Using block is a short cut to try{} finally{} block.
Generally used to define connections. It will dispose the connection object automatically once we come out of using block.

7. What is use of a static constructor?

8. Describe the event delegate model in C#.

9. What are partial classes?

10. what is a sealed class?

11. What is the difference between Array and ArrayList? List the advantages.


Many more to come ....

Wednesday, May 13, 2009

SQL Server Interview questions

This section will contain SQL Server Interview Questions and Answers. Please post your comments here. Also, post your questions to get an answer.

1. How to optimize stored procedures in SQL Server?
Ans: I. Use where clause
II. Select only required fields
III. Do join on indexed key fields

2. What is the difference between Stored procedure and User defined functions?

3. Why should we go for Stored Procedures? Why not direct queries?
Ans: SP are precompiled and contain an execution plan with it. Hence, they are faster.

4. How many NULL values we can have in a Unique key field in SQL Server?
Ans: Only one. In case of Oracle, we can have multiple NULL values in a Unique key field.

5. What is correlated subquery?
6. What is an index. What are the types?
Indexes in databases are very much similar to Indexes in Books. Indexes help in searching data faster.

Types: Clustered Index
Non-Clustered Index

7. What is the difference between a clustered index and a non-clustered index?
Clustered Index:
1 Only one clustered index allowed per table
2 Physically rearranges the data
3 For use on columns that are frequently searched for range of data

Non-clustered Index:
1 Upto 249 non-clustered index allowed per table
2 Doesn’t rearrange the data. Keeps a pointer to the data.
3 For use on columns that are searched for single value.

8. What is a join? What are the types of joins?

Joins are used to retrieve data from multiple tables.

Following are the types of joins:
Inner join
Left outer join
Right outer join
Full outer join
Cross join



9. What is a transaction?
A SQL transaction is a sequence of operations performed as a single unit of work. If all the tasks are completed successfully, then the transaction is committed (saved). If a single task fails, the transaction is rolled back (discarded).

10. What is ACID property of transaction?
A SQL transaction must exhibit ACID property, i.e Atomicity, Consistency, Isolation, and Durability.

Atomicity: A transaction is always treated as a single unit of work, i.e. either all the tasks are performed or none of them, no intermediate stage.
Consistency: When a transaction is completed, it must leave all data in a consistent state.
Isolation: Modifications made by a transaction must be isolated from the modifications made by other transactions.
Durability: After a transaction is completed, it’s effects are permanently in place in the system.

11. What is SET NOCOUNT ON?
When we perform a SELECT, INSERT, UPDATE or DELETE query, it returns a COUNT (number of rows affected) when SET NOCOUNT OFF. If SET NOCOUNT ON, it doesn’t return the COUNT.

12. How to delete exactly duplicate records from a table?
There are many ways. Simplest answer is:
i. Let the table tab1 contains duplicate records.
ii. Insert distinct records from tab1 in a temporary table #temp
INSERT INTO #temp
SELECT DISTINCT * FROM tab1
iii. Delete all rows from original table tab1
DELETE FROM tab1
iv. Insert from temporary table
INSERT INTO tab1
SELECT * FROM #temp
Try other solutions yourself.

13. How to get nth highest salary from employee table.
The query below demonstrates how to find the 5th highest salary. Replace 5 with any integer to get nth salary.

SELECT TOP 1 SALARY
FROM (SELECT DISTINCT TOP 5 SALARY
FROM EMPLOYEE ORDER BY SALARY DESC) a
ORDER BY SALARY ASC


Many more to come ....

Dotnet Interview Questions

Hello Friends,

I am going to post all the Interview questions I faced at the time of my job change. The technical discussion in an interview has become very difficult in this recession time.

The interviewer asks each and everything starting from dotnet basics to the core dotnet concepts. So, be well prepared if you are planning a job change.

Also, these extensive list of interview questions and answers will help you face any client interviews in your own organisation.

I will cover Interview Questions related to DotNet Framework, C# Dotnet, ASP.Net, SQL Server, Web services, AJAX, WPF, WCF, Winforms, Webforms and other relevant stuff.

Please post your comments. Also, post your questions to get an answer here.

Regards,
Banshi.

  © Blogger templates Shiny by Ourblogtemplates.com 2008

Back to TOP