Sunday, July 12, 2009

Dot Net FAQs

ExecuteNonQuery-returns number of rows effected
ExecuteReader-It will return SQLDatareader(Set of records)
ExecuteScalar-It will return last inserted row value.

GAC- C:\WINDOWS\assembly
ILDASM.EXE- C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin
Q)IS there any way to restrict the Developer to delete a assembly? How can i do? pros and cons?
Ans.Yes,By placing the assembly in to GAC.

System.GC.AddMemoryPressure(200024);
System.GC.RemoveMemoryPressure(200024);
This statements will be usefull while uploading large files from .Net to server
System.GC.Collect()- forces garbage collector to run

1) What are situations when you register .NET assembly in GAC ?

2) What’s the difference between Cache object and application object ?

The main difference between the Cache and Application objects is that the Cache object
provides cache-specific features, such as dependencies and expiration policies.

3) When we use Cache object and when we use application object?

4) How can get access to cache object ?

You can get a reference
to the Cache object by using the Cache property of the HttpContext class

5) Where do you specify session state mode in ASP.NET ?

6)What are benefits and limitations of using Cookies?

7)How u define the cookie in ASP.Net?
Request.Cookies.Add(New HttpCookie(“name”, “user1”))

8)How cross page posting can be achieved in ASP.Net?
PostBackUrl="~/nextpage.aspx" Text="Post to nextpage" />

9)How delegates used for event handling?

10)Can you prevent a class from overriding ?

11)What is the significance of Finalize method in .NET?

12)When we required System.StringBuilder classes?

13)How can we skip some set of code from the Page PostBack?

14)Where is ViewState information stored ?
In HTML Hidden Fields.


15)How can you enable automatic paging in DataGrid ?


16)What is the method to customize columns in DataGrid?
Use the template column.

17)What are major events in GLOBAL.ASAX file ?What order they are triggered ?

18)where do we enable tracing ?
<%@ Page Trace="true" %>


19) How to kill a session in asp.net?

Session.abandon

20) How can I track event in checkbox which is one of the columns of a datagrid ?

21) What is difference between Constant and readonly properties?

get accessor in property implemantation.

22) Is structure can be inherited?

23) what is difference between static variable and private variable?

24) What is use of virtual method in a base class?

25) When we require interface? when we require abstract?

26) what is use of out parameter in c#?

27) what is the scope of extern variable?

28) what is use of static constructor?

29) What is the difference between is and as?
The AS operator is used to perform certain type of conversion between compatible reference types.
IS checks if object is compatiable with a given type.

30) What is scope of access modifers like internal,protected?

31) what is the use of partial classes?

32) What is the use of “OverRides” and “Overridable” keywords ?
Overridable is used in parent class to indicate that a method can be overridden. Overrides
is used in the child class to indicate that you are overriding a method


33)In what instances you will declare a constructor to be private?
When we create a private constructor, we can not create object of the class directly from
a client. So you will use private constructors when you do not want instances of the class
to be created by any external client. Example UTILITY functions in project will have no
instance and be used with out creating instance, as creating instances of the class would
be waste of memory.

34)Can two catch blocks be executed?
No, once the proper catch section is executed the control goes finally to block. So there
will not be any scenarios in which multiple catch blocks will be executed.

35)What is impersonation in ASP.NET ?
By default, ASP.NET executes in the security context of a restricted user account on the
local machine. Sometimes you need to access network resources such as a file on a shared
drive, which requires additional permissions. One way to overcome this restriction is to
use impersonation. With impersonation, ASP.NET can execute the request using the
identity of the client who is making the request, or ASP.NET can impersonate a specific
account you specify in web.config.


36)Can you explain in brief how the ASP.NET authentication process works?
ASP.NET does not run by itself, it runs inside the process of IIS. So there are two
authentication layers which exist in ASP.NET system. First authentication happens at
the IIS level and then at the ASP.NET level depending on the WEB.CONFIG file.
Below is how the whole process works:-
v IIS first checks to make sure the incoming request comes from an IP address
that is allowed access to the domain. If not it denies the request.
v Next IIS performs its own user authentication if it is configured to do so. By
default IIS allows anonymous access, so requests are automatically
authenticated, but you can change this default on a per – application basis
with in IIS.
v If the request is passed to ASP.net with an authenticated user, ASP.net checks
to see whether impersonation is enabled. If impersonation is enabled, ASP.net
acts as though it were the authenticated user. If not ASP.net acts with its own
configured account.
v Finally the identity from step 3 is used to request resources from the operating
system. If ASP.net authentication can obtain all the necessary resources it
grants the users request otherwise it is denied. Resources can include much
more than just the ASP.net page itself you can also use .Net’s code access
security features to extend this authorization step to disk files, Registry keys
and other resources.

37)How can we check if all the validation control are valid
and proper ?
Using the Page.IsValid() property you can check whether all the validation are done


38)What are the two fundamental objects in ADO.NET ?
Datareader and Dataset are the two fundamental objects in ADO.NET.

39)What is the use of command objects ?
They are used to connect connection object to Datareader or dataset. Following are the
methods provided by command object :-
v ExecuteNonQuery :- Executes the command defined in the CommandText
property against the connection defined in the Connection property for a query
that does not return any row (an UPDATE, DELETE or INSERT). Returns
an Integer indicating the number of rows affected by the query.
v ExecuteReader :- Executes the command defined in the CommandText property
against the connection defined in the Connection property. Returns a "reader"
object that is connected to the resulting rowset within the database, allowing
the rows to be retrieved.
v ExecuteScalar :- Executes the command defined in the CommandText property
against the connection defined in the Connection property. Returns only
single value (effectively the first column of the first row of the resulting rowset)
any other returned columns and rows are discarded. It is fast and efficient
when only a "singleton" value is required


What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?
You can use Having Clause with the GROUP BY function in a query and WHERE
Clause is applied to each row before they are part of the GROUP BY function in a query.

(B) What is the difference between UNION and UNION ALL SQL syntax ?
UNION SQL syntax is used to select information from two tables. But it selects only
distinct records from both the table, while UNION ALL selects all records from both the
tables.



When listing product information you might want to draw the user's eye to products that
are out of stock. one way to accomplish this would be to change the back ground colour of those
rows with unit in stock value of 0.

The gridview offers a onRowDataBound event that fires once for each row after the row has been creted
and bound to corresponding record of data from the data source control.

FAQ

1.architecture of .net
2.What is IL and CLR
3.Collections -Arrary, array list , hash array
4.How can we handile exception in .Net and SQL server--
5.Tell me simple steps to bind a grid using sql connection
6.State management-
7.Diff b/w Session and application memory
8.How to swap 2 values with out using temp
9.Overriding and Overloading
10. Dataset and reader...
11. Can we run all versions of .Net applications in same server.
12.One array size is 100, i have entered 99 records(Numbers from 1 to 100) in that array, how can i find missed value.
13.I have 2 arrays with diff size, i want to dispaly matched records and unmatched recores.
14..Net is plat form independent.
15. Tell me what are the namespaces we use to work with ajax. (Ans: System.Web.Extensions, System.Web.Extensions.Design)
16. Can my application can have more that 1 .config files...YES
17.Can i have more that one DLL with same name in my system. Ans)Yes in GAC it is possible
18.Diff b/w EXE and DLL
19.How can we improve asp.net application erformance.
22. architecture of u r current application. how can u support u r architecture is sutable for u r aplication.
23.how can we call webservices.

Tell u have a knowledge on workflows.....which u have..
1.what is workflow.
2.what is the use of workflows

Diff b/w function and SP in SQL
New features in sql 2005 that 2000
what is index in sql and advantages, diss adva?


How to get inserted row identity value from Database in SP?
Ans)
If you are using SQL Server 7.0, simply change the line in the stored procedure from ...

SELECT NEWID = SCOPE_IDENTITY()

... to ...

SELECT NEWID = @@IDENTITY
Loading...