TOP 87 ASP.NET 2.0 Multiple Choice Questions and Answers pdf fresher and experienced

Read the most frequently asked 87 top ASP.NET 2.0 multiple choice questions and answers PDF for freshers and experienced. ASP.NET 2.0 objective questions and answers pdf download free..

ASP.NET 2.0 Multiple Choice Questions and Answers PDF Experienced Freshers


1. How to rename a table using sql queries?
This done by
exec sp_rename 'oldTableName' , 'newTableName'
Use server side for secure validation. Use client side for fast,user friendly validations.
Execute sp_rename 'oldtablename', 'newtableaname'

2. Can a .NET web application consume Java web service?
Yeah Offcourse.Actually Webservices are independent to language. it depends on WSDL and SOAP. so any one can develope the Webservices anddisclose the wsdl and users can cosume the webservices.wsdl and soap both are xml based.. and all languages having xml parsing capability and access to http protocol will be able to work with Webservices

3. How many types of cookies are available in asp?
There are 2 types of cookies
Persistent and Non-persistent
there are 2 types they are
1. inmemory cookies
2. persistent cookies

4. Explain How is a property designated as read-only?
Using Get Accessor
Public ReadOnly property item() as integer Get() Return.item End Get End Property

5. Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box?
DisplayMember and ValueMember Properties need to be set.
DataTextField and DataValueField Property neeeds to be set

6. What tags do you need to add within the asp: datagrid tags to bind columns manually?
<asp:TemplateColumn>
<HeaderTemplate >
Somename
</HeaderTemplate>
<ItemTemplate>
<%# DataBinder.Eval(Container, "DataItem.columnname") %>
</ItemTemplate>
</asp:TemplateColumn>

7. What property do you have to set to tell the grid which page to go to when using the Pager object?
itemCommand

8. Explain What does WSDL stand for?
Web Services Description Language

9. What is the transport protocol you use to call a Web service SOAP?
Web service use only three types of protocal. first HTTP-GET,HTTP-POST and SOAP.
Web Services Description Language

10. Which method do you use to redirect the user to another page without performing a round trip to the client?
Server.Transfer

11. What is the standard you use to wrap up a call to a Web service?
We use Soap standard to wrap calls to web service.Soap stands for Simple Object Access Protocol

12. What tag do you use to add a hyperlink column to the DataGrid?
HyperLink Column
Template column

13. How do you remove duplicates without using remove duplicate stage?
In the target make the column as the key column and run the job.
delete table tablename where rowid not in Select * from tablename group by column name

14. can u explain one critical mapping?
performance issue which one is better? whether connected lookup tranformation or unconnected one?
It depends on your data and the type of operation your doing.
If you need to calculate a value for all the rows or for the maximum rows coming out of the source then go for a connected lookup.Or,if it is not so then go for unconnectd lookup.Specially in conditional case like,we have to get value for a field 'customer' from order tabel or from customer_data table,on the basis of following rule:
If customer_name is null then ,customer=customer_data.ustomer_Id
otherwise
customer=order.customer_name.
So in this case we will go for unconnected lookup

15. What is Difference between DataList and GridView?
Gridview can display based on various colums avl in an single query or table. Also can customize it while can sort, edit, delete, insert. Datalist is a data bound list control that displays items using templates. Mainly it is all control bound.
DataList is using to list of all data in tree structure GridView is using to list of all value in table format

16. What is different in .Net 1.1 and .Net 2.0?
The main difference is that we can add more control over 1.1 for ex we can do master page,themes and generic classes we use 2.0 it can be comes for to add gridview
Concept of partial classes in .NET 2.0

17. Which two properties are on every validation control?
ControlToValidate property and Text property
This is done explicitly by adding the below code Response.Cookies("Name") = "myCookie"
Response.Cookies("Name").Expires = DateAdd("m", 1, Now());
ErrorMessage and ControlToValidate

18. How do you turn off cookies for one page in your site?
By setting the Cookie.Discard property false
cookie.discard=false

19. What property must you set, and what method must you call in your code, in order to bind the data from some data source to the Repeater control?
You must set the DataSource property and call the DataBind method

20. In what order do the events of an ASPX page execute. As a developer is it important to understand these events?
1. Object Initialization
2. Load Viewstate Data
3. LoadPostData Processes Postback Data
4. Object Load
5. Raise PostBack Change Events
6. Process Client-Side PostBack Event
7. Prerender the Objects
8. ViewState Saved
9. Render To HTML
10. Disposal

21. Whats MSIL, and why should my developers need an appreciation of it if at all?
MSIL supports OO programming, so we can have a class which has public and private methods. The entry point of the program needs to be specified. In fact it doesn't really matter whether the method is called Mam or Dad. The only thing that matters here is that .entrypoint is specified inside the method. MSIL programs are compiled with ilasm compiler. Since we are writing a managed assembly code, we have to make sure that no variables are allocated in memory when the program goes out of scope. Here is a more complicated program that, once again, does not do anything but has some dataThe sample MSIL program.method static void main(){ .entrypoint .maxstack 1 ldstr "Hello world!" call void [mscorlib]System.Console::WriteLine(string) ret}

22. How would you get ASP.NET running in Apache web servers - why would you even do this?
The mod_mono Apache module is used to run ASP.NET applications within the Apache (http://httpd.apache.org) web server. Mod_mono is available from (http://www.mono-project.com/Downloads).XSP is a standalone web server written in C# that can be used to run your ASP.NET applications. XSP works under both the Mono and Microsoft runtimes and the code is available from(http://www.mono-project.com/Downloads).

23. Describe session handling in a webfarm, how does it work and what are the > limits?
State Server is used for handling sessions in a web farm. In a web farm, make sure you have the same in all your web servers. Also, make sure your objects are serializable. For session state to be maintained across different web servers in the web farm, the Application Path of the website (For example \LM\W3SVC\2) in the IIS Metabase should be identical in all the web servers in the web farm

24. What are the disadvantages of viewstate/what are the benefits?
Viewstate has lots of advantages and as well as disadvantages, so you need to weigh carefully before making the decision to use it. As view state doesnt require any server resources for its operation. It is passed to the client during every postback as an hidden element. Since it is added with every page, it adds few Kbytes to the page. This effects the loading of the page in the client. Other main problem with Viewstate is, since it is passed as plain text to the client. Anybody can tamper this value, because of this you shouldnt store any important data in the viewstate. View state is one of the most important features of ASP.NET, not so much because of its technical relevance, but more because it makes the magic of the Web Forms model possible. However, if used carelessly, view state can easily become a burden. Although ViewState is freely accessible in a hidden field called __VIEWSTATE, the view state information is not clear text. By default, a machine-specific authentication code is calculated on the data and appended to the view state string. The resulting text is then Base64 encoded only, but not encrypted. In order to make the view state more secure, the ASP.NET @Page directive supports an attribute called EnableViewStateMac whose only purpose is detecting any possible attempt at corrupting original data.

25. Where would you use an iHTTPModule, and what are the limitations of any?
IHttpModule is used when u want to add u r own module or extra module so that when u request u r module also gets called.First and foremost httpmodules are used when u make request for a page.While processing the page some modules gets called.Some example modules are security module etc.If u want add a module to be used when processing request u add/implement ihhtp moduleok "Happy Programming"

26. How do you create a permanent cookie?
Setting a permanent cookie is similar to Session cookie, except give the cookie an expiration date too. It is very common that you don't specify any arbitrary expiration date, but instead expire the cookie relative to the current date, using the DateAdd() function.
Response.Cookies("Name") = "myCookie"
Response.Cookies("Name").Expires = DateAdd("m", 1, Now())
by expiration date in cookie tag...

27. Explain What are delegates?
A delegate is a class that can hold a reference to a method. Unlike other classes, a delegate class has a signature, and it can hold references only to methods that match its signature. A delegate is thus equivalent to a type-safe function pointer or a callback.

28. What is difference between OR and ORElse?
ORELSE - Either of the two expressions is true. If the first expression is True, the second is not evaluated. - ex. are from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/valrfOrElseOperator.asp
Dim A As Integer = 10
Dim B As Integer = 8
Dim C As Integer = 6
Dim myCheck As Boolean
myCheck = A > B OrElse B > C ' True. Second expression is not evaluated.
myCheck = B > A OrElse B > C ' True. Second expression is evaluated.
myCheck = B > A OrElse C > B ' False.

If MyFunction(5) = True OrElse MyOtherFunction(4) = True Then
' If MyFunction(5) is True, MyOtherFunction(4) is not called.
' Insert code to be executed.
End If

ANDALSO -
Instead of doing thisIf(Function1() And Function2()) ThenDo thisIf(Function1() AndAlso Function2()) ThenThe first code will evaluate the result of Function2(), even if Function1() returned false.The second will only evaluate Function2() if Function1() returned true.

29. What is difference between singleton and single call?
Differneces between Single Call & Singleton.Single Call objects service one and only one request coming in. Single Callobjects are useful in scenarios where the objects are required to do afinite amount of work. Single Call objects are usually not required tostore state information, and they cannot hold state information betweenmethod calls. However, Single Call objects can be configured in aload-balanced fashion.Singleton objects are those objects that service multiple clients and henceshare data by storing state information between client invocations. Theyare useful in cases in which data needs to be shared explicitly betweenclients and also in which the overhead of creating and maintaining objectsis substantial.

30. What are client activated objects and server activated objects?
1. Basically for a SAO, the lifetime of the object is controlled by server, whereas for a CAO, the lifetime is controlled by the client.Below are definitions from MSDN. Server activated objects includes Single Call & Singleton.Single Call objects service one and only one request coming in. Single Callobjects are useful in scenarios where the objects are required to do afinite amount of work. Single Call objects are usually not required tostore state information, and they cannot hold state information betweenmethod calls. However, Single Call objects can be configured in aload-balanced fashion.Singleton objects are those objects that service multiple clients and henceshare data by storing state information between client invocations. Theyare useful in cases in which data needs to be shared explicitly betweenclients and also in which the overhead of creating and maintaining objectsis substantial.Client-activated objects (CAO) are server-side objects that are activatedupon request from the client. This way of activating server objects is verysimilar to the classic COM coclass activation. When the client submits arequest for a server object using "new" operator, an activation requestmessage is sent to the remote application. The server then creates aninstance of the requested class and returns an ObjRef back to the clientapplication that invoked it. A proxy is then created on the client sideusing the ObjRef. The client's method calls will be executed on the proxy.Client-activated objects can store state information between method callsfor its specific client and not across different client objects. Eachinvocation of "new" returns a proxy to an independent instance of theserver type.

31. Which namespace is used by ADO.NET?
The System.Data namespace consists mostly of the classes that constitute the ADO.NET architecture. The ADO.NET architecture enables you to build components that efficiently manage data from multiple data sources. In a disconnected scenario (such as the Internet), ADO.NET provides the tools to request, update, and reconcile data in multiple tier systems. The ADO.NET architecture is also implemented in client applications, such as Windows Forms, or HTML pages created by ASP.NET.

32. Explain What is CLR?
First of all, VB.NET provides managed code execution that runs under the Common Language Runtime (CLR), resulting in robust, stable and secure applications. All features of the .NET framework are readily available in VB.NET.
The CLR takes care of garbage collection i.e. the CLR releases resources as soon as an object is no more in use. This relieves the developer from thinking of ways to manage memory. CLR does this for them.

33. Explain What are webservices?
Web services are a core technology provided by the .NET Framework. By using web services, companies can more easily integrate internal applications, but they can also access services exposed by other businesses. By combining web services exposed on the Internet with internally built services, companies can create a wide variety of value-added applications. For example, a company could unify banking, electronic bill payment, stock trading, and insurance services into a single, seamless financial management portal. Another possibility is the integration of inventory control, fulfillment mechanisms and purchase-order tracking into a comprehensive supply chain management system.

34. Describe the difference between inline and code behind - which is best in a?
Inline code written along side the html in a page. Code-behind is code written in a separate file and referenced by the .aspx page.

35. Explain what a diffgram is, and a good use for one?
A DiffGram is an XML format that is used to identify current and original versions of data elements. The DataSet uses the DiffGram format to load and persist its contents, and to serialize its contents for transport across a network connection. When a DataSet is written as a DiffGram, it populates the DiffGram with all the necessary information to accurately recreate the contents, though not the schema, of the DataSet, including column values from both the Original and Current row versions, row error information, and row order.When sending and retrieving a DataSet from an XML Web service, the DiffGram format is implicitly used. Additionally, when loading the contents of a DataSet from XML using the ReadXml method, or when writing the contents of a DataSet in XML using the WriteXml method, you can select that the contents be read or written as a DiffGram

36. If I am developing an application that must accomodate multiple security levels though secure login and my ASP.NET web appplication is spanned across three web-servers (using round-robbin load balancing) what would be the best approach to maintain login-in state for the users?
You can use state server for maintaining session in this case.

37. Can you give an example of what might be best suited to place in the Application_Start and Session_Start subroutines?
To provide individual data for a user during a session, data can be stored with session scope. In the following sample, values for user preferences are initialized in the Session_Start event in the Global.asax file.Sub Session_Start() Session("BackColor") = "beige" ...End Sub'======================================================================In the following sample a file is read in Application_Start (defined in the Global.asax file) and the content is stored in a DataView object in the application state.Sub Application_Start() Dim ds As New DataSet() Dim fs As New FileStream(Server.MapPath("schemadata.xml"),FileMode.Open,FileAccess.Read) Dim reader As New StreamReader(fs) ds.ReadXml(reader) fs.Close() Dim view As New DataView (ds.Tables(0)) Application("Source") = viewEnd Sub

38. What is the life cycle of an asp.net page?
The Life Cycle represents all the Events and Methods that are called from Initializing the Page to Unloading the Page. Stages and corresponding events in the life cycle of the ASP.NET page cycle: Stage Events/Method
Page Initialization Page_InitView State Loading LoadViewStatePostback data processing LoadPostDataPage Loading Page_LoadPostBack Change Notification RaisePostDataChangedEventPostBack Event Handling RaisePostBackEventPage Pre Rendering Phase Page_PreRenderView State Saving SaveViewStatePage Rendering Page_RenderPage Unloading Page_UnLoad

39. Explain What is Viewstate?
The web is a stateless medium - state is not maintained between client requests by default. Technologies must be utilized to provide some form of state management if this is what is required of your application, which will be the case for all but the simplest of web applications. ASP.NET provides several mechanisms to manage state in a more powerful and easier to utilize way than classic ASP.
Page level state is information maintained when an element on the web form page causes a subsequent request to the server for the same page - referred to as 'postback'. This is appropriately called ViewState as the data involved is usually, though not necessarily, shown to the user directly within the page output.
The Control.ViewState property is associated with each server control in your web form and provides a dictionary object for retaining values between such multiple requests for the same page. This is the method that the page uses to preserve page and control property values between round trips.
When the page is processed, the current state of the page and controls is hashed into a string and saved in the page as a hidden field. When the page is posted back to the server, the page parses the view state string at page initialization and restores property information in the page.
ViewState is enabled by default so if you view a web form page in your browser you will see a line similar to the following near the form definition in your rendered HTML:
ViewState offers a substantial improvement over the two competing techniques for state management via the client: standard hidden fields and cookies, in that ViewState is not limited to the storage of simple values. You can use ViewState to store any object as long as it is serializable, and the standard VB.NET types are. Serialization is the process of storing an object's data and other information necessary to reconstruct the object later.

40. How can we implement a Identity (SQL Server) call in an asp.net page?
Try { SqlParameter p0, p1, p2; cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "spo_sample"; //Param: Return Value p0 = cmd.Parameters.Add("@RowCount", SqlDbType.Int); p0.Direction = ParameterDirection.ReturnValue; p1 = new SqlParameter("@Samplename", SqlDbType.VarChar, 200); p1.Value = Samplename.ToString().Trim(); cmd.Parameters.Add(p1); //Param: Output Identity Value p2 = cmd.Parameters.Add("@Identity", SqlDbType.Int, 0, "SampleID"); p2.Direction = ParameterDirection.Output; conn.Open(); cmd.Connection = conn; int cnt = cmd.ExecuteNonQuery(); int rowCount = (int)cmd.Parameters["@RowCount"].Value; int rowIdentity = p2.Value;}

41. How Dataadapter.fill works?
Data Adapter act as amiddleman between the dataset and data Base. The fill method automatically open the connection and when the dataset is filled properly then the coonection is closed. This method fetch the data from the database

42. How do we get only edited/deleted/inserted records from a Dataset?
Data set maintains state of each row. For new entry row state is Inserted, For modified row it is Modifies and for deleted row , the row state is deleted.

43. How do we Sort the data from a Dataset?
Sorting is similar to filtering, in that you specify a sort expression. A typical sort expression is simply the name of the column to sort by. For example, to sort by the OrderDate column, you specify the sort expression OrderDate. However, you can sort by the value of any expression, including calculated values. If you call a table's Select method, you pass the sort expression as a parameter. If you are using data views, you specify the sort expression as the value of the view's "Sort" property.EX:' Visual BasicDim filterExp As String = "Status = 'Active'"Dim sortExp As String = "City"Dim drarray() As DataRowDim i As Integerdrarray = dataSet1.Customers.Select(filterExp, sortExp, DataViewRowState.CurrentRows)For i = 0 To (drarray.Length - 1) listBox1.Items.Add( drarray(i)("City").ToString )Next// C#string filterExp = "Status = 'Active'";string sortExp = "City";DataRow[] drarray;drarray = dataSet1.Customers.Select(filterExp, sortExp, DataViewRowState.CurrentRows);for (int i=0; i < drarray.Length; i++){ listBox1.Items.Add(drarray[i]["City"].ToString());}

44. Diff between Web User Control and Web Custom Control?
Web user controls:1. Easier to create 2. Limited support for consumers who use a visual design tool 3. A separate copy of the control is required in each application 4. Cannot be added to the Toolbox in Visual Studio 5. Good for static layout Web Custom Controls:1. Harder to create2. Full visual design tool support for consumers3. Only a single copy of the control is required, in the global assembly cache4. Can be added to the Toolbox in Visual Studio5. Good for dynamic layout

45. What is diff. between ASP State Management and ASP.NET State Management?(Imp)
How can we pass info between 2 asp.net pages?
In Distributed network architecture ASP has only one Type of Session Management which can be expressed as InProcess Session State, Where as in .NET architecture ASP.NET Session Management can be done is different ways as 1. In-Process Session Management2. Out-Process Session Management3. Sql-Server Session ManagementIn In-Process Session Management both the Application and the Session will run under the Same Process, where as in Out-Process Session Management Application and the Session will run in different processes. Advantage of Out-Process is that event though the Application is Restared due to any reason the Sessions Assosiated with that application will not be destructed but where as in In-Process Session Management the Session State will be Lost along with the Application.In Sql-Server Session Management, the Session is Maintained in SQLSERVER Database.

46. What r the ASP.NET list controls and diff. between them?
ASP.NET List controls ==> There are 3 . 1. DropDownList, 2. ListBox and 3.HTMLSelect.1. System.Web.UI.WebControls.DropDownListthis control renders a drop-down list in the page at runtime. Only the selected item is visible when the user is not interacting with the list, and the other items become visible when the user clicks the control to see the items that can be selected. Only one item can be selected in this control. This control must be inserted into a server side form (runat="server") applied.2. System.Web.UI.WebControls.ListBoxthis control renders a list of items within a scrolling box, multiple items can be selected in this control if required. This control must be inserted into a server side form (runat="server") applied.3. System.Web.UI.HTMLControls.HTMLSelectthis control can be used to render a drop-down list or a scrolling list of items. This control has less built in functionality when compared with controls above (It lacks many of the properties that can be used to influence the display style such as ForeColor and BackColor to name a couple) ,but it is still capable of performing most common uses of a list control. This control can be inserted anywhere, and does not require a server side form.

47. What is versioning in .NET?
Different versions of a same component can run in one computer.we can achieve it by registering the assembly in the global assembly cache.

48. How does u call and execute a SP in .NET?
Public DataSet SampleToExecute_SP_IN_DOTNET() { DataSet DataSetHome = new DataSet(); SqlConnection SqlConnectionHome=new SqlConnection(strConnectionString); SqlCommand SqlCommandHome=new SqlCommand(); SqlCommandHome.Connection = SqlConnectionHomeReportCheck; SqlCommandHome.CommandText = "CLM_getCurYearStatistics"; SqlCommandHome.CommandType = CommandType.StoredProcedure; SqlDataAdapter DataAdapterHome = new SqlDataAdapter(SqlCommandHome); try { DataAdapterHome.Fill (DataSetHome); return DataSetHome; } catch(SqlException ex) { throw(ex); } catch(Exception ex) { throw(ex); } finally { DataAdapterHome.Dispose (); SqlCommandHome.Dispose(); SqlConnectionHome.Close(); } }

49. Explain Why Datareader is useful?
Data Reader is Read only version Data Set,Each record is returned as a Data Reader Object,ExecuteReader method acts directly on the database connection.
There are two versions of the data reader object:
OleDbDataReader and SqlDataReader.
Data reader is used to fetch the records from database in read only and forward.

50. What are ASP.NET Web Forms? How is this technology different than what is available though ASP (1.0-3.0)?
ASP .NET Web form is a tool used to design a web page using the drag and drop feature in VS .NET and is similar to the 'Form' tool in Visual Studio 5.0/6.0. It functions like the Form tag in classic ASP to get or post data from or to the server.
The difference between a classic ASP page and an ASP web Form is as follows:-
A classic ASP has the extension .asp.
An ASP.NET web form has the extension .aspx
-------------
A classic ASP page can be created using a Text editor or programs like DreamWeaver.
An ASP .NET web form is created in a project in the VS.NET environment.
------------
The source of a classic ASP is in VBScript or JavaScript and is visible to the end user.
The source of an ASP.NET web form is written in the code behind file ex: .cs for C# or .vb for VB.net and is invisible to the end user.
-------------
An ASP.NET Web form is Event driven.

51. How does VB.NET/C# achieve polymorphism?
Using Function Overloading and Function Overriding we can achieve polymorphism in .net

52. How would you implement inheritance using VB.NET/C#?
In VB - Inherits
In C# - Colon (:)

53. Explain What is an assembly?
Assembly is a collection of code files , types and resources. It is a unit of deployment,version cotrol and reuse.Assembly is basically collection of exe or dll files which are generated upon successfull compilation of the .Net application

54. What is .NET remoting?
.NET remoting provides a framework that allows objects to interact with one another across application domains. The framework provides a number of services, including activation and lifetime support, as well as communication channels responsible for transporting messages to and from remote applications.for further info refer MSDN

55. Explain Diff between Dataset and Datareader?
Dataset is used to store the data, it contains collections of Datatable.
Datareader is used to connect to the database for retrieving data.

56. Explain Diff. betn Dataset and Recordset?
DataSet can be considered as a logical database as it has the capability to store more than one table and have relations maintained between the tables as in a relational database. Where as a RecordSet can hold only one table at a time.

57. What is the root namespace for all types?
System is the root of al the namespace in .net

58. In order to get assembly info whcih namespace we should import?
System.reflection

59. Can you edit data in the Repeater control?
A Repeater control is a light weight control which can be used for simple reporting purposes. It supports basic event-handling like Init, Load, Unload etc., This also supports some basic formatting of data and can be presented to the user. A Repeater control offers limited level of data editing or selecting capabilities. For such editing and updates ASP .Net offers DataList and DataGrid controls.

60. What method do you use to explicitly kill a user s session?
session.abandon-to kill all
session.remove-to spec item

61. Explain What is an abstract class?
An abstract class is one in which methods are defined but an object of this class cannot be instanstiated.this type of a class can only be derived but cannot be instantiated.

62. Can you give an example of when it would be appropriate to use a web service as opposed to a non-serviced .NET component?
If you are developing an intranet app and you want to display the current stock price of your company, its best to consume a webservice the provide that service. IOW, when you want to get 'outside' data throuh a corporate firewall
If, say, you want to display latest news from HR deartment in your portal, better to have a .NET DLL that connect to corporate HR Database and get the info.

63. Trace and Debug belongs to which namespaces?
System.Diagnostics

64. Lets say I have an existing application written using Visual Studio 6 (VB 6, InterDev 6) and this application utilizes Windows 2000 COM+ transaction services. How would you approach migrating this application to .NET?
COM components are accessed from the .NET runtime via a Runtime Callable Wrapper (RCW). This wrapper turns the COM interfaces exposed by the COM component into .NET-compatible interfaces

65. Explain DIff. between Friend and Protected Friend?
Friend access provides access to member with in the namespaces .The protected friend gives specifies access to the member with in the namespace and the derving classes.

66. How do u declare static variable and how it is declared and what is its lifetime?
By using keyword static before the variable name. Static variable retains the same data throughout the execution of a program.

67. How does u get record no from 5 to 15 from a dataset of 100 records?
// ds-> daata set
//dr as datarow
for i=5 to 15
{
dr=ds.table.row(i)
}
You can also archive using this syntax. sqlconnection con=new sqlconnection(""); Sqldataadapter da=new Sqldataadapter("T-SQlQUARy",con); dataset ds=new dataset(); da.Fill(ds,5,15,"tablename");

68. Which namespace is used to get assembly details?
System.Assembly is the namespace which u need to include in u r program to get the assemply details.To get the assemply details of the current running one is thru reflection so u need another namespace calledSystem.Reflection "Happy Programming"

69. What is CLR? Diff between CLR & CTS?
CLR is the Common Language Runtime for the dotnet frame work.
CTS is the Common Type Sytem for all languages.It consists of the types(Class,Enums,Structs,Interfaces etc for any language)
CTS is one of the component of CLR.
CLR is the Runtime Engine which provide services to execute the application.CTS is part of CLR

70. What is DLL hell?
Previously, before .NET, this used to be a major issue. "DLL Hell" refers to the set of problems caused when multiple applications attempt to share a common component like a dynamic link library (DLL) or a Component Object Model (COM) class. In the most typical case, one application will install a new version of the shared component that is not backward compatible with the version already on the machine. Although the application that has just been installed works well, existing applications that depended on a previous version of the shared component might no longer work. In some cases, the cause of the problem is even more subtle. In many cases there is a significant delay before a user discovers that an application has stopped working. As a result, it is often difficult to remember when a change was made to the machine that could have affected the application. A user may remember installing something a week ago, but there is no obvious correlation between that installation and the behavior they are now seeing. The reason for these issues is that version information about the different components of an application aren't recorded or enforced by the system. Also, changes made to the system on behalf of one application will typically affect all applications on the machine.

71. What is diff. between abstract class and an interface?
What is shadowing?
Diff between Overriding and overloading?
An abstract class and Interface both have method only but not have body of method.The difference between Abstract class and An Interface is that if u call Ablstract class then u have to call all method of that particular Abstract class but if u call an Interface then it is not necessary that u call all method of that particular interface.Method OverLoading:-Return type, Parameter type, parameter and body of method number may be different.Method Overriding:- Return type, Parameter type, Parameter Number all must be same . Only body of method can change.

72. How to create a DB connection at one place/page so that we can use that connection for all pages/forms/windows.what r the steps ned to be performed.
if question not clear,let me know.
<?xml version="1.0" encoding="utf-8" ?>
<!-- Web.Config Configuration File -->
<configuration>
<appSettings>
<add key="ConnectionString"
value="server=localhost;database=Northwind;uid=sa;password=secret;" />
</appSettings>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>

Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration

Public Class ConnString : Inherits Page

Protected dataGrid As DataGrid

Protected Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs)
Dim sqlConn As SqlConnection
Dim sqlCmd As SqlCommand
Dim strConnection As String

Try
'Get connection string from Web.Config
strConnection = ConfigurationSettings.AppSettings("ConnectionString")
sqlConn = New SqlConnection(strConnection)
sqlCmd = New SqlCommand("SELECT * FROM Customers WHERE " _
& "(CompanyName LIKE 'A%') OR (CompanyName LIKE 'B%')", sqlConn)
sqlConn.Open()
dataGrid.DataSource = sqlCmd.ExecuteReader()
dataGrid.DataBind()
Catch ex As Exception
Response.Write(ex.ToString & "<br>")
Finally
sqlConn.Close()
End Try
End Sub
End Class

73. What is IPostBack? How to use it?
Gets a value indicating whether the page is being loaded in response to a client postback, or if it is being loaded and accessed for the first time.
Property Value
true if the page is being loaded in response to a client postback; otherwise, false.
void Page_Load() {
if (!IsPostBack) {
// Validate initially to force asterisks
// to appear before the first roundtrip.
Validate();
}
}

74. What is server infrastructure & Server components?
Component product of Windows Server System is effective on its own, as individual components and as part of an integrated system. To provide a framework for Windows Server System product improvement, Starting with the infrastructure server product releases for 2005, with a vision of delivering a common set of services across all Windows Server System products.
All Windows Server System products will provide infrastructure built on the Volume Shadow Copy Service to support fast backup and recovery of data. Each Windows Server System product team will develop a Volume Shadow Copy Service writer. Volume Shadow Copy Service is a framework for facilitating communication among applications, storage subsystems, and storage management applications (including backup applications) to define, persist, and exploit point-in-time copies of storage data.
This infrastructure will provide backup/restore to product solution providers to reduce their cost of product development
and enable IT administrators to provide their organizations with fast backup and recovery of data at reduced costs.

75. Explain What is event bubbling?
Event Bubbling is nothing but events raised by child controls is handled by the parent control. Example: Suppose consider datagrid as parent control in which there are several child controls.There can be a column of link buttons right.Each link button has click event.Instead of writing event routine for each link button write one routine for parent which will handlde the click events of the child link button events.Parent can know which child actaully triggered the event.That thru arguments passed to event routine. " Happy programming"

76. Which dll handles the request of .aspx page?
When the Internet Information Service process (inetinfo.exe) receives an HTTP request, it uses the filename extension of the requested resource to determine which Internet Server Application Programming Interface (ISAPI) program to run to process the request. When the request is for an ASP.NET page (.aspx file), IIS passes the request to the ISAPI DLL capable of handling the request for ASP.NET pages, which is aspnet_isapi.dll.

77. How to reduce the width of textbox in EditCommandColumn of DataGrid?
convert textbox column into a template then it lets you change its width

78. If we remove web.config or machine.config from the application then, Is this application will works?
If we remove the web.config file from the application it will work.
unless it doesnt have the things like connectionstring etc.

79. List of Words of PreProcessor in .NET?
#if
#else
#elif
#endif
#define
#undef
#warning
#error
#line
#region
#endregion
Main use of directives

80. Please brief not about XSD,XSLT & XML?
XSD stands for XML Schema Definition.It define the structure of the XML file and the elements and attributes it contains.The datatype of the elements.So that when u populate XML data into dataset, the dataset can treat elements differently based on their type.If XSD is not present dataset treats all elements as string type. XSLT stands for XML style sheet lang tranformation.It is lang used for transforming XML data in one format to another format.Example XML data into HTML format. XSLT uses XPath to identify the elements in XML doc and transform those to desired format

81. What is PreProcessor in .NET and type, where it use?
The pre-processing directives provide the ability to conditionally skip sections of source files, to report error and warning conditions, and to delineate distinct regions of source code. The term "pre-processing directives" is used only for consistency with the C and C++ programming languages. In C#, there is no separate pre-processing step; pre-processing directives are processed as part of the lexical analysis phase.
A preprocessor directive must be the only instruction on a line. Preprocessing directives are lines in your program that start with `#'. Whitespace is allowed before and after the `#'. The `#' is followed by an identifier that is the directive name. For example, `#define' is the directive
Types are:
#if, #else, #elif, #endif, #define, #undef, #warning, #error, #line, #region, #endregion

They are used for:
Conditional compilation
Line control
Error and Warning reporting

For example u can refere the MS site ...
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csspec/html/vclrfcsharpspec_2_5_4.asp

82. What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?
Server.Transfer is used when redirecting the webpage with in the same applicationwhereasResponse.Redirect is applicabletowards the redirection of webpage between 2 applications
Response.Redirect will instruct browser to call a particular webpage.This will increase one request and one response between the client and server.

83. ColumnMapping belongs to which namespaces?
ColumnMapping belongs to which namespaces
system.data.common

84. Name some ASP Objects?
1. Session Object
2. Application Object
3. Server Object
4. Request Object
5. Response Object
6. Object Context
7. Error Object

85. What types of data validation events are commonly seen in the client-side form validation?
Required Field Validator
Requried Filed Validator,Compare filed validator

86. In A Page I have gridview with Options of select and delete using hyperlink when i am selecting any one of then it has to open another page how can it?
You can have template column for select and delete instead of the databound column. In which you can mention the destination page where you need to navigate.
Using RowDataBound event, you can add attribute to the select and delete hyperlink like:
e.Row.Cells(CellPosition).Controls(0).Attributes.Add("OnClick","return fnJavascriptFunction()")
e.Row.Cells(CellPosition).Controls(0).Attributes.Add("OnClick","return fnJavascriptFunction('"& If any argument &"')").

87. Web service support
a) Data set
b) dataReader
c) both of above
d) none of above
a) Data Set
Web service support Data Set and not support data reader

0 comments:

Post a Comment