Dot Net Interview questions for 3+ years of experience - Part-4


Previous questions


1) In Singleton Design Pattern, synchronization is essential ?
Ans) In Singleton Design Pattern , synchronization is essential only for the first time when the instance is to be created. When the instance is created then it becomes an overhead for each request.

public class Singleton

{

private static Singleton uniqueinstance;



private Singleton()

{

}
public static Singleton getinstance()

{

if(uniqueinstance == null)

{

uniqueinstance = new Singleton();

}

return uniqueinstance;

}

}


In the above code, when for the first time getinstance method is called, synchronization is needed. After the first instance is created, we no longer need synchronization.
---------------------------------------------------
2) Tell me the exact difference between IQueryable and IEnumerable interface ?
Ans)
IEnumerable is applicable for in-memory data querying, and in contrast IQueryable allows remote execution, like web service or database querying.
---------------------------------------------------------
3)When a dynamic compilation of a website project is bad ?
Ans)
Dynamic compilation happens for a website project not for a web application project.
If the site is very large, dynamic compilation of a Web site project might take a noticeable amount of time. Dynamic compilation occurs when a request for a site resource is received after an update to the site, and the request that triggers compilation might be delayed while the required resources are compiled. If the delay is unacceptable, you can pre-compile the site. However, then some of the advantages of dynamic compilation are lost.


Previous questions

Previous questions


1) In Singleton Design Pattern, synchronization is essential ?
Ans) In Singleton Design Pattern , synchronization is essential only for the first time when the instance is to be created. When the instance is created then it becomes an overhead for each request.

public class Singleton

{

private static Singleton uniqueinstance;



private Singleton()

{

}
public static Singleton getinstance()

{

if(uniqueinstance == null)

{

uniqueinstance = new Singleton();

}

return uniqueinstance;

}

}


In the above code, when for the first time getinstance method is called, synchronization is needed. After the first instance is created, we no longer need synchronization.
---------------------------------------------------
2) Tell me the exact difference between IQueryable and IEnumerable interface ?
Ans)
IEnumerable is applicable for in-memory data querying, and in contrast IQueryable allows remote execution, like web service or database querying.
---------------------------------------------------------
3)When a dynamic compilation of a website project is bad ?
Ans)
Dynamic compilation happens for a website project not for a web application project.
If the site is very large, dynamic compilation of a Web site project might take a noticeable amount of time. Dynamic compilation occurs when a request for a site resource is received after an update to the site, and the request that triggers compilation might be delayed while the required resources are compiled. If the delay is unacceptable, you can pre-compile the site. However, then some of the advantages of dynamic compilation are lost.


Previous questions

IIS level Questinos , Application server

Q1) What is scavenging ?
Ans)
When server running your ASP.NET application runs low on memory resources, items
are removed from cache depending on cache item priority. Cache item priority is set when you add item to cache. By setting the cache item priority controls the items scavenging are removed first.
Q1) What is scavenging ?
Ans)
When server running your ASP.NET application runs low on memory resources, items
are removed from cache depending on cache item priority. Cache item priority is set when you add item to cache. By setting the cache item priority controls the items scavenging are removed first.

Sql Server Experience Questions

Q1) What is MERGE statement?
Ans)
MERGE is new feature in SQL Server 2008 that provide an efficient way to perform multiple operations. In previous version we had to write separate statement to INSERT,DELETE and UPDATE data based on certain conditions, but now using MERGE statement we can include the logic of such data modification in one statement that even checks when the data matched then just update it and when unmatched then insert it. most important advantage of MERGE statement is all the data is read and processed only once.
---------------------
Q2)What is BCP ?
Ans)
BCP is stand for Bulk copy Program in sql server, bulk copy is a tool used to copy huge amount of data from tables and views. BCP does not copy the structure same as source to destination.
Q1) What is MERGE statement?
Ans)
MERGE is new feature in SQL Server 2008 that provide an efficient way to perform multiple operations. In previous version we had to write separate statement to INSERT,DELETE and UPDATE data based on certain conditions, but now using MERGE statement we can include the logic of such data modification in one statement that even checks when the data matched then just update it and when unmatched then insert it. most important advantage of MERGE statement is all the data is read and processed only once.
---------------------
Q2)What is BCP ?
Ans)
BCP is stand for Bulk copy Program in sql server, bulk copy is a tool used to copy huge amount of data from tables and views. BCP does not copy the structure same as source to destination.

Interview Questions for freshers part -3



Q1)What are User Controls and Custom controls?
Ans)

Custom controls are control build entirely in code. The pro is that you can put them in libraries, add an icon to the toolbox and other fine control.

User controls are more easy to do, and in general is a way to encapsulate things to simplify other pages or when you need to use the same markup in several pages.
--------------------------------------------------------------
Q2)web.config file main two advantages are :-
(1) web.config file cannot be viewed directly in a browser
(2) If the web.config file is changed, you don’t need to re-compile your ASP.NET application

Ans)
Select from following answers:
False
True
Both
Both the above statements are correct.
------------------------------------------------------




Q1)What are User Controls and Custom controls?
Ans)

Custom controls are control build entirely in code. The pro is that you can put them in libraries, add an icon to the toolbox and other fine control.

User controls are more easy to do, and in general is a way to encapsulate things to simplify other pages or when you need to use the same markup in several pages.
--------------------------------------------------------------
Q2)web.config file main two advantages are :-
(1) web.config file cannot be viewed directly in a browser
(2) If the web.config file is changed, you don’t need to re-compile your ASP.NET application

Ans)
Select from following answers:
False
True
Both
Both the above statements are correct.
------------------------------------------------------


Interview Questions for freshers part -2


Q1)difference between array and stack
Ans)
There are two main differences between an array and a stack. Firstly, an array can be multi-dimensional, while a stack is strictly one-dimensional. Secondly, an array allows direct access to any of its elements, whereas with a stack, only the 'top' element is directly accessible; to access other elements of a stack, you must go through them in order, until you get to the one you want
------------------------------------------
Q2)Suppose you have a DataTable having 100,000 rows and 50 columns. Now you've create array of perticular column values, how will you do that?
Ans)
It's simple.
for C#
object[] arr = Array.ConvertAll(dataTable.Select(), (DataRow r) => r[]);
for VB
dim arr as Object() = Array.ConvertAll(Of DataRow, Object)(dataTable.Select(), Function(r as DataRow) r());
------------------------------------------------------------
Q3)Can we assign values to read only variables?if yes then how?
Ans)
yes, we can assign values to read only variables either at a time of declaration or in constructors
-------------------------------------------------------------------
4)Difference between Abstract class and interface?
Ans)
1.Through the abstract class we cannot achieve the multiple inheritance in c-sharp. while by interface we can.
2. We can declare the access modifier in abstract class but not in interface. Because by default everything in interface is public
-----------------------------------------------------------------------
5)You can derive an abstract class from another abstract class. In that case, in the child class it is optional to make the implementation of the abstract methods of the parent class....!
Ans)
Select from following answers:
True
False
No Idea
True
If the derived class is also an abstract class then it is not mandatory to implement the abstract method of the parent class.
-------------------------------------------------------------------------------
6)Can you prevent a class from overriding ?
Ans)Yes you can prevent a class from overriding if you define a class as "Sealed " then you can not inherit the class any further.
------------------------------------------------------------------


Q1)difference between array and stack
Ans)
There are two main differences between an array and a stack. Firstly, an array can be multi-dimensional, while a stack is strictly one-dimensional. Secondly, an array allows direct access to any of its elements, whereas with a stack, only the 'top' element is directly accessible; to access other elements of a stack, you must go through them in order, until you get to the one you want
------------------------------------------
Q2)Suppose you have a DataTable having 100,000 rows and 50 columns. Now you've create array of perticular column values, how will you do that?
Ans)
It's simple.
for C#
object[] arr = Array.ConvertAll(dataTable.Select(), (DataRow r) => r[]);
for VB
dim arr as Object() = Array.ConvertAll(Of DataRow, Object)(dataTable.Select(), Function(r as DataRow) r());
------------------------------------------------------------
Q3)Can we assign values to read only variables?if yes then how?
Ans)
yes, we can assign values to read only variables either at a time of declaration or in constructors
-------------------------------------------------------------------
4)Difference between Abstract class and interface?
Ans)
1.Through the abstract class we cannot achieve the multiple inheritance in c-sharp. while by interface we can.
2. We can declare the access modifier in abstract class but not in interface. Because by default everything in interface is public
-----------------------------------------------------------------------
5)You can derive an abstract class from another abstract class. In that case, in the child class it is optional to make the implementation of the abstract methods of the parent class....!
Ans)
Select from following answers:
True
False
No Idea
True
If the derived class is also an abstract class then it is not mandatory to implement the abstract method of the parent class.
-------------------------------------------------------------------------------
6)Can you prevent a class from overriding ?
Ans)Yes you can prevent a class from overriding if you define a class as "Sealed " then you can not inherit the class any further.
------------------------------------------------------------------

Exception handling Questions

Q1)How to use Exception Handling?
Ans)
What is Exception?
An Exception is an unexpected error or problem.
What is Exception Handling?
It is a method to handle the error and solution to recover from it which makes the program to work smoothly.

What is try Block?
The try block consists of the code that might generate an error.
This try block must be associated with one or more catch blocks or by finally block.
The try block may not have a catch block associated with it every time but in this case,it must have a finally block associated with it instead of catch block.

Example:

Format1



try

{

//Code that might generate error

}

catch(Exception error)

{

}



Format2



try

{

//Code that might generate error

}

catch(ExceptionA error)

{

}

catch(ExceptionB error)

{

}



Format3



try

{

//Code that might generate error

}

finally

{

}



What is catch Block?
catch block is used to recover from error generated in the try block.
In case of multiple catch blocks,only the first matching catch block is excecuted.
you need to arrange the multiple catch blocks from specific exception type to more generic type.
If none of the matching catch blocks are able to handle the exception, the default behaviour of web page is to terminate the processing of the web page.

Example:

Format1



try

{

//Code that might generate error

}

catch(Exception error)

{

//Code that handle errors occurred in try block

}



Format2:



try

{

//Code that might generate error

}

catch(DivideByZeroException error)

{

//Code that handle errors occurred in try block

//It is the most specific error we are trying to catch

}

catch(Exception error)

{

//Code that handle errors occurred in try block

//It is not specific error we are catching

}

catch

{

//Code that handle errors occurred in try block

//It is the least specific error in hierarchy

}



What is finally Block?
The finally block contains the code that executes,whether an exception occurs or not.
The finally block is used to write code to close files,database connections,etc.
Only one finally block is associated with each try block.
finally block must appear only after the catch block.
If there are any control statements such as goto,break or continue in either try or catch block,the transfer happens only after the code in the finally block is excecuted.
If the control statements are used in finally block,there occurs a compile time error.

Example:

Format1



try

{

//Code that might generate error

}

catch(Exception error)

{

//Code that handle errors occurred in try block

}

finally

{

//Code to dispose all allocated resources

}



Format2



try

{

//Code that might generate error

}

finally

{

//Code to dispose all allocated resources

}
-----------------------------------------------
Q2)"Viewstate information does not automatically transfer from page to page. It cannot be tracked across pages". Is the statement true ?
Ans)
Select from following answers:

Yes
No
Maybe


Yes, the above statement is true.

Viewstate information cannot be tracked across pages. You can use session or querystring to track anything from one page to another.

Note: Do not store large amount of data on the page using viewstate because it will slow down the page load process.
------------------------------------------------
Q3) What is the use of throw statement?
Ans)
A throw statement is used to generate exception explicitly.
This throw statement is generally used in recording error in event log or sending an Email notification about the error.
Avoid using throw statement as it degrades the speed.

Example:

try

{

//Code that might generate error

}

catch(Exception error)

{

//Code that handle errors occurred in try block



throw; //Re throw of exception to add exception details in event log or sending email

}



//Code that handle errors occurred in try block

}

finally

{

//Code to dispose all allocated resources

}



Format2



try

{

//Code that might generate error

}

finally

{

//Code to dispose all allocated resources

}
----------------------------------------------------------

4)How to manage unhandled Exception?
Ans)
You can manage unhandled exception by configuring the element in web.config file.
It has 2 attributes:

Mode Attribute:It specifies how the custom error page should be displayed.
It has 3 values:
on - Displays custom error pages at both the local and remote client.
off - Disables custom error pages at both the local and remote client.
RemoteOnly - Displays custom error pages only at the remote client as it displays default asp.net error page for local machine.This is default setting in web.config file.
defaultRedirect:It is an optional attribute to specify the custom error page to be displayedwhen an error occurs.
The custom error page is displayed based on http error statusCode using error element inside the customError element.
If none of the specific statusCode matches with it, it will redirect to defaultRedirect page.
-----------------------------------------------
5)Difference between catch(Exception error) and catch
Ans)
The code below explains the difference between catch(Exception error) and catch


try

{

//Code that might generate error

}



catch(Exception error)

{

//Catches all Cls-complaint exceptions

}



catch

{

//Catches all other exception including the Non-Cls complaint exceptions

}




Q1)How to use Exception Handling?
Ans)
What is Exception?
An Exception is an unexpected error or problem.
What is Exception Handling?
It is a method to handle the error and solution to recover from it which makes the program to work smoothly.

What is try Block?
The try block consists of the code that might generate an error.
This try block must be associated with one or more catch blocks or by finally block.
The try block may not have a catch block associated with it every time but in this case,it must have a finally block associated with it instead of catch block.

Example:

Format1



try

{

//Code that might generate error

}

catch(Exception error)

{

}



Format2



try

{

//Code that might generate error

}

catch(ExceptionA error)

{

}

catch(ExceptionB error)

{

}



Format3



try

{

//Code that might generate error

}

finally

{

}



What is catch Block?
catch block is used to recover from error generated in the try block.
In case of multiple catch blocks,only the first matching catch block is excecuted.
you need to arrange the multiple catch blocks from specific exception type to more generic type.
If none of the matching catch blocks are able to handle the exception, the default behaviour of web page is to terminate the processing of the web page.

Example:

Format1



try

{

//Code that might generate error

}

catch(Exception error)

{

//Code that handle errors occurred in try block

}



Format2:



try

{

//Code that might generate error

}

catch(DivideByZeroException error)

{

//Code that handle errors occurred in try block

//It is the most specific error we are trying to catch

}

catch(Exception error)

{

//Code that handle errors occurred in try block

//It is not specific error we are catching

}

catch

{

//Code that handle errors occurred in try block

//It is the least specific error in hierarchy

}



What is finally Block?
The finally block contains the code that executes,whether an exception occurs or not.
The finally block is used to write code to close files,database connections,etc.
Only one finally block is associated with each try block.
finally block must appear only after the catch block.
If there are any control statements such as goto,break or continue in either try or catch block,the transfer happens only after the code in the finally block is excecuted.
If the control statements are used in finally block,there occurs a compile time error.

Example:

Format1



try

{

//Code that might generate error

}

catch(Exception error)

{

//Code that handle errors occurred in try block

}

finally

{

//Code to dispose all allocated resources

}



Format2



try

{

//Code that might generate error

}

finally

{

//Code to dispose all allocated resources

}
-----------------------------------------------
Q2)"Viewstate information does not automatically transfer from page to page. It cannot be tracked across pages". Is the statement true ?
Ans)
Select from following answers:

Yes
No
Maybe


Yes, the above statement is true.

Viewstate information cannot be tracked across pages. You can use session or querystring to track anything from one page to another.

Note: Do not store large amount of data on the page using viewstate because it will slow down the page load process.
------------------------------------------------
Q3) What is the use of throw statement?
Ans)
A throw statement is used to generate exception explicitly.
This throw statement is generally used in recording error in event log or sending an Email notification about the error.
Avoid using throw statement as it degrades the speed.

Example:

try

{

//Code that might generate error

}

catch(Exception error)

{

//Code that handle errors occurred in try block



throw; //Re throw of exception to add exception details in event log or sending email

}



//Code that handle errors occurred in try block

}

finally

{

//Code to dispose all allocated resources

}



Format2



try

{

//Code that might generate error

}

finally

{

//Code to dispose all allocated resources

}
----------------------------------------------------------

4)How to manage unhandled Exception?
Ans)
You can manage unhandled exception by configuring the element in web.config file.
It has 2 attributes:

Mode Attribute:It specifies how the custom error page should be displayed.
It has 3 values:
on - Displays custom error pages at both the local and remote client.
off - Disables custom error pages at both the local and remote client.
RemoteOnly - Displays custom error pages only at the remote client as it displays default asp.net error page for local machine.This is default setting in web.config file.
defaultRedirect:It is an optional attribute to specify the custom error page to be displayedwhen an error occurs.
The custom error page is displayed based on http error statusCode using error element inside the customError element.
If none of the specific statusCode matches with it, it will redirect to defaultRedirect page.
-----------------------------------------------
5)Difference between catch(Exception error) and catch
Ans)
The code below explains the difference between catch(Exception error) and catch


try

{

//Code that might generate error

}



catch(Exception error)

{

//Catches all Cls-complaint exceptions

}



catch

{

//Catches all other exception including the Non-Cls complaint exceptions

}




For Final Year Students of Computers

Q1) Tell in brief, the difference between Development and Production Environment ?
Ans)

Development Environment – It is the place where we develop our application/product. Here all the coders or programmers develops the application/product by writing code.

Production Environment – When the application/product is ready for release to the end-users. When that application/product executes or run in the target machine live.
Q1) Tell in brief, the difference between Development and Production Environment ?
Ans)

Development Environment – It is the place where we develop our application/product. Here all the coders or programmers develops the application/product by writing code.

Production Environment – When the application/product is ready for release to the end-users. When that application/product executes or run in the target machine live.

WCF Interview Questions Part_3

Previous Questions

7) What is a service contract, operation contract and Data Contract?
Ans)
ServiceContract :
ñ Describes which operation client can perform on the services
ñ Indicates that an interface or a class defines a service contract in a application
operation contract:
ñ Indicates that a method defines an operation that is part of a service contract
Data Contract :
Defines which data type are processed to and from the services, It provides built in contract for implicit type
----------------------------------------------------
8)In WCF, "wsHttpBinding" uses plain unencrypted texts when transmitting messages and is backward compatible with traditional ASP.NET web services (ASMX Web Services) ?
Ans)
Select from following answers:

True
False
Not Aware

False

"wsHttpBinding" is secure (messages are encrypted while being transmitted), and transaction-aware. However, because this is a WS-* standard, some existing applications (for example: a QA tool) may not be able to consume this service. Hence, it is not completely backward compatible.
------------------------------------------
9) Why in WCF, the "httpGetEnabled" attribute is essential ?
Ans)

The attribute "httpGetEnabled" is essential because we want other applications to be able to locate the metadata of this service that we are hosting.


Without the metadata, client applications can't generate the proxy and thus won't be able to use the service.

Previous Questions
Previous Questions

7) What is a service contract, operation contract and Data Contract?
Ans)
ServiceContract :
ñ Describes which operation client can perform on the services
ñ Indicates that an interface or a class defines a service contract in a application
operation contract:
ñ Indicates that a method defines an operation that is part of a service contract
Data Contract :
Defines which data type are processed to and from the services, It provides built in contract for implicit type
----------------------------------------------------
8)In WCF, "wsHttpBinding" uses plain unencrypted texts when transmitting messages and is backward compatible with traditional ASP.NET web services (ASMX Web Services) ?
Ans)
Select from following answers:

True
False
Not Aware

False

"wsHttpBinding" is secure (messages are encrypted while being transmitted), and transaction-aware. However, because this is a WS-* standard, some existing applications (for example: a QA tool) may not be able to consume this service. Hence, it is not completely backward compatible.
------------------------------------------
9) Why in WCF, the "httpGetEnabled" attribute is essential ?
Ans)

The attribute "httpGetEnabled" is essential because we want other applications to be able to locate the metadata of this service that we are hosting.


Without the metadata, client applications can't generate the proxy and thus won't be able to use the service.

Previous Questions

Interview Questions for freshers


1)What is CDN and how jQuery is related to it?
Ans)
CDN - It stands for Content Distribution Network or Content Delivery Network.

Generally, a group of systems at various places connected to transfer data files between them to increase its bandwidth while accessing data. The typical architecture is designed in such a way that a client access a file copy from its nearest client rather than accessing it from a centralized server.

So we can load this jQuery file from that CDN so that the efficiency of all the clients working under that network will be increased.

Example :

We can load jQuery from Google libraries API

-------------------------------------------------
2)What is the advantage of using the minified version of JQuery rather than using the conventional one?
Ans)
The advantage of using a minified version of JQuery file is Efficiency of the web page increases.

The normal version jQuery-x.x.x.js has a file size of 178KB

but the minified version jQuery.x.x.x-min.js has 76.7 KB.

The reduction in size makes the page to load more faster than you use a conventional jQuery file with 178KB
-------------------------------------------------
3) Do we need to add the JQuery file both at the Master page and Content page as well?
Ans)

No, if the Jquery file has been added to the master page then we can access the content page directly without adding any reference to it.

This can be done using this simple example

------------------------------------------------
4)What is the use of Using Statement ?
Ans)
Using statement is used similar to finally block that is to dispose the object.
It declares that you are using a disposable object for a short period of time.
Once the using block ends,the CLR releases the corresponding object immediately by calling its dispose() method.

Example:

//Write code to allocate some resource

//List the allocated resource in a comma-separated list inside

//the parenthesis of the using block



using(...)

{

//use the allocated resource

}



//Here dispose() method is called for all the object referenced without writing any additional code.
-------------------------------------------------


1)What is CDN and how jQuery is related to it?
Ans)
CDN - It stands for Content Distribution Network or Content Delivery Network.

Generally, a group of systems at various places connected to transfer data files between them to increase its bandwidth while accessing data. The typical architecture is designed in such a way that a client access a file copy from its nearest client rather than accessing it from a centralized server.

So we can load this jQuery file from that CDN so that the efficiency of all the clients working under that network will be increased.

Example :

We can load jQuery from Google libraries API

-------------------------------------------------
2)What is the advantage of using the minified version of JQuery rather than using the conventional one?
Ans)
The advantage of using a minified version of JQuery file is Efficiency of the web page increases.

The normal version jQuery-x.x.x.js has a file size of 178KB

but the minified version jQuery.x.x.x-min.js has 76.7 KB.

The reduction in size makes the page to load more faster than you use a conventional jQuery file with 178KB
-------------------------------------------------
3) Do we need to add the JQuery file both at the Master page and Content page as well?
Ans)

No, if the Jquery file has been added to the master page then we can access the content page directly without adding any reference to it.

This can be done using this simple example

------------------------------------------------
4)What is the use of Using Statement ?
Ans)
Using statement is used similar to finally block that is to dispose the object.
It declares that you are using a disposable object for a short period of time.
Once the using block ends,the CLR releases the corresponding object immediately by calling its dispose() method.

Example:

//Write code to allocate some resource

//List the allocated resource in a comma-separated list inside

//the parenthesis of the using block



using(...)

{

//use the allocated resource

}



//Here dispose() method is called for all the object referenced without writing any additional code.
-------------------------------------------------

Sql Server Interview questions part-1

1)Difference between Primary Key and unique key ?
Ans)
Primary Key Restrict duplicate values and null values each table can have only one primary key,default clustered index is the primary key.

unique key restrict duplicate values and allow only one null value. default non clustered index is an unique key
------------------------------------
2)What is the clause that specifies a condition for a group or an aggregate?
Ans)
Select from following answers:
A. Distinct
B. Where clause
C. Exists
D. Having Clause

Having Clause
This is how we can create a condition laid on a group or aggregate

Example :
SELECT column_name, aggregate_function(column_name)
FROM table_name
WHERE column_name operator value
GROUP BY column_name
HAVING aggregate_function(column_name) operator value
------------------------------------------------------------------------
3) Which command removes all the rows from the table without logging individual row deletions ?
Ans)
Select from following answers:
A. Truncate
B. delete
C. drop
D. Alter

Truncate will not log individual row deletion.

Here is an example of how we can count the rows before and after truncate

SELECT COUNT(*) AS BeforeTruncateCount FROM MyTable.MyJob;
TRUNCATE TABLE MyTable.MyJob;
SELECT COUNT(*) AS AfterTruncateCount FROM MyTable.MyJob;
---------------------------------------------------------------------
4) What is the command that is used to set a set of privileges that can be granted to users or different roles?
Ans)
Select from following answers:
A. Create Authority
B. Create Grant
C. Create Role
D. Create Authentication

Role Command is used to set the set of privileges which can be granted to users.

An example:

CREATE ROLE editors AUTHORIZATION db_SecurityServices;
1)Difference between Primary Key and unique key ?
Ans)
Primary Key Restrict duplicate values and null values each table can have only one primary key,default clustered index is the primary key.

unique key restrict duplicate values and allow only one null value. default non clustered index is an unique key
------------------------------------
2)What is the clause that specifies a condition for a group or an aggregate?
Ans)
Select from following answers:
A. Distinct
B. Where clause
C. Exists
D. Having Clause

Having Clause
This is how we can create a condition laid on a group or aggregate

Example :
SELECT column_name, aggregate_function(column_name)
FROM table_name
WHERE column_name operator value
GROUP BY column_name
HAVING aggregate_function(column_name) operator value
------------------------------------------------------------------------
3) Which command removes all the rows from the table without logging individual row deletions ?
Ans)
Select from following answers:
A. Truncate
B. delete
C. drop
D. Alter

Truncate will not log individual row deletion.

Here is an example of how we can count the rows before and after truncate

SELECT COUNT(*) AS BeforeTruncateCount FROM MyTable.MyJob;
TRUNCATE TABLE MyTable.MyJob;
SELECT COUNT(*) AS AfterTruncateCount FROM MyTable.MyJob;
---------------------------------------------------------------------
4) What is the command that is used to set a set of privileges that can be granted to users or different roles?
Ans)
Select from following answers:
A. Create Authority
B. Create Grant
C. Create Role
D. Create Authentication

Role Command is used to set the set of privileges which can be granted to users.

An example:

CREATE ROLE editors AUTHORIZATION db_SecurityServices;

Interview Question part 3

Q 1)Can I deploy the application without deploying the source code on the server?

Ans)yes, After Project Completion we will Publish the Code after published we will give the code deploy the application on the server.
*************************************************************************
Q 2)Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process.

Ans) inetinfo.exe is theMicrosoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension),the ISAPI filter aspnet_isapi.dll takes care of it by passing the request tothe actual worker process aspnet_wp.exe.
*************************************************************************
Q 3) Can we declare event and delegates in an interface?

Ans)No,we cannot declare delegates in interface however we can declare events in interface.
So interface can only contains the signature of the following members
Methods
Properties
Indexers
Events
*************************************************************************

Q4) Difference between catch(Exception error) and catch?
Ans)

The code below explains the difference between catch(Exception error) and catch

try

{

//Code that might generate error

}



catch(Exception error)

{

//Catches all Cls-complaint exceptions

}



catch

{

//Catches all other exception including the Non-Cls complaint exceptions

}
Q 1)Can I deploy the application without deploying the source code on the server?

Ans)yes, After Project Completion we will Publish the Code after published we will give the code deploy the application on the server.
*************************************************************************
Q 2)Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process.

Ans) inetinfo.exe is theMicrosoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension),the ISAPI filter aspnet_isapi.dll takes care of it by passing the request tothe actual worker process aspnet_wp.exe.
*************************************************************************
Q 3) Can we declare event and delegates in an interface?

Ans)No,we cannot declare delegates in interface however we can declare events in interface.
So interface can only contains the signature of the following members
Methods
Properties
Indexers
Events
*************************************************************************

Q4) Difference between catch(Exception error) and catch?
Ans)

The code below explains the difference between catch(Exception error) and catch

try

{

//Code that might generate error

}



catch(Exception error)

{

//Catches all Cls-complaint exceptions

}



catch

{

//Catches all other exception including the Non-Cls complaint exceptions

}

Dot Net Interview questions for 3+ years of experience - Part-3

Previous Questions


Next Questions

1)What is Marshaling?
Ans)

The process of establishing a Remote Proxy Server object which resides at the client side and act as if it was the server.Which in turn handles the communication between the real server object and client object. This process of monitoring is said to be Marshaling.
--------------------------------------------------
2)What is Smart Navigation ?
Ans)
When ever there is a request from a web browser which is IE 5.0 or greater Smart Navigation enhances the user feel of the page.

These are the different functions which this smart navigation performs.

1) It Persists the element focus between navigation's.

2) It also persists the scroll position when user traversing from one page to another.

3) It eliminates the flash content which was caused by navigation.

4) Most important feature is retaining the last page state in the browsers history.

This is how we can set the Smart Navigation :

We can set SmartNavigation attribute at the @ page directive in the .aspx page. So when the page is requested the dynamically generated class sets this attribute.

Note : This property is best useful when a particular web site has frequent postbacks.
---------------------------------------------------
3)In C# how do you find the last error which occurred ?
Ans)

This can be done by implementing a method called GetLastError(). Generally this returns a ASPError object stating the error condition that has occurred. This method will work only before the .ASP page sent any content to the Client.

Sample Code

Exception LastErrorOccured;

String ShowErrMessage;

LastErrorOccured = Server.GetLastError();

if (LastErrorOccured != null)

ShowErrMessage = LastErrorOccured.Message;

else

ShowErrMessage = "No Errors";

Response.Write("Last Error Occured = " + ShowErrMessage);
---------------------------------------------------
4)What is the difference between OLEDB Provider and SqlClient ? Which is more productive to use for Dot Net application?
Ans)
Generally SQLClient .NET classes are highly optimized for the .net / sqlserver combination which in-turn gives accurate results. The SqlClient data provider is fast. It works faster than the Oracle provider, and even more faster than accessing database through the OleDb layer.

Reason for being faster is, it access the native library which generally gives you a better performance and it has also got a lot of support from SQL Server team online.
----------------------------------------------------
5)which is server side state management technical?
Ans)
Select from following answers:
a)cookies
b)hidden fields
c)session
d)view state

session is the server side state management and other 3 r client side state management

6) What is the name given to a type of assembly which contains localized resources?

Ans)

Select from following answers:

A. a) Satellite

B. b)Spoke

C. c)Sputnik

D. d)Hub

satellite

We can deploy our application's resources in satellite assemblies. Generally by definition, satellite assemblies contains only resource files. They do not contain any application code.

In the satellite assembly deployment model, we create an application with one default assembly (which is the main assembly) and several satellite assemblies.

-------------------------------------------------------------------

7) In Singleton Pattern, how will you make sure that threading is done with minimal overhead

Ans)

''''''''''''''''''''''''''''''''''''''''''''''''''''''''

public sealed class Singleton

{

private static volatile Singleton instance;

private static object syncRoot = new Object();

private Singleton() {}

public static Singleton Instance

{

get

{

if (instance == null)

{

lock (syncRoot)

{

if (instance == null)

instance = new Singleton();

}

}

return instance;

}

}

}

'''''''''''''''''''''''''''''''''''''''''''''''''''''

In the above code, when the Singleton instance is created for the first time then it is locked and synchronized but next call or successive calls make sure that the lock is not checked anymore because an instance already exists. This way the overhead of checking the lock minimizes.

The double-check locking approach solves the thread concurrency problems while avoiding an exclusive lock in every call to the Instance property method.



Previous Questions


Next Questions
Previous Questions


Next Questions

1)What is Marshaling?
Ans)

The process of establishing a Remote Proxy Server object which resides at the client side and act as if it was the server.Which in turn handles the communication between the real server object and client object. This process of monitoring is said to be Marshaling.
--------------------------------------------------
2)What is Smart Navigation ?
Ans)
When ever there is a request from a web browser which is IE 5.0 or greater Smart Navigation enhances the user feel of the page.

These are the different functions which this smart navigation performs.

1) It Persists the element focus between navigation's.

2) It also persists the scroll position when user traversing from one page to another.

3) It eliminates the flash content which was caused by navigation.

4) Most important feature is retaining the last page state in the browsers history.

This is how we can set the Smart Navigation :

We can set SmartNavigation attribute at the @ page directive in the .aspx page. So when the page is requested the dynamically generated class sets this attribute.

Note : This property is best useful when a particular web site has frequent postbacks.
---------------------------------------------------
3)In C# how do you find the last error which occurred ?
Ans)

This can be done by implementing a method called GetLastError(). Generally this returns a ASPError object stating the error condition that has occurred. This method will work only before the .ASP page sent any content to the Client.

Sample Code

Exception LastErrorOccured;

String ShowErrMessage;

LastErrorOccured = Server.GetLastError();

if (LastErrorOccured != null)

ShowErrMessage = LastErrorOccured.Message;

else

ShowErrMessage = "No Errors";

Response.Write("Last Error Occured = " + ShowErrMessage);
---------------------------------------------------
4)What is the difference between OLEDB Provider and SqlClient ? Which is more productive to use for Dot Net application?
Ans)
Generally SQLClient .NET classes are highly optimized for the .net / sqlserver combination which in-turn gives accurate results. The SqlClient data provider is fast. It works faster than the Oracle provider, and even more faster than accessing database through the OleDb layer.

Reason for being faster is, it access the native library which generally gives you a better performance and it has also got a lot of support from SQL Server team online.
----------------------------------------------------
5)which is server side state management technical?
Ans)
Select from following answers:
a)cookies
b)hidden fields
c)session
d)view state

session is the server side state management and other 3 r client side state management

6) What is the name given to a type of assembly which contains localized resources?

Ans)

Select from following answers:

A. a) Satellite

B. b)Spoke

C. c)Sputnik

D. d)Hub

satellite

We can deploy our application's resources in satellite assemblies. Generally by definition, satellite assemblies contains only resource files. They do not contain any application code.

In the satellite assembly deployment model, we create an application with one default assembly (which is the main assembly) and several satellite assemblies.

-------------------------------------------------------------------

7) In Singleton Pattern, how will you make sure that threading is done with minimal overhead

Ans)

''''''''''''''''''''''''''''''''''''''''''''''''''''''''

public sealed class Singleton

{

private static volatile Singleton instance;

private static object syncRoot = new Object();

private Singleton() {}

public static Singleton Instance

{

get

{

if (instance == null)

{

lock (syncRoot)

{

if (instance == null)

instance = new Singleton();

}

}

return instance;

}

}

}

'''''''''''''''''''''''''''''''''''''''''''''''''''''

In the above code, when the Singleton instance is created for the first time then it is locked and synchronized but next call or successive calls make sure that the lock is not checked anymore because an instance already exists. This way the overhead of checking the lock minimizes.

The double-check locking approach solves the thread concurrency problems while avoiding an exclusive lock in every call to the Instance property method.



Previous Questions


Next Questions