Q1. Explain the differences between Server-side and Client-side code?
Ans. Server side code will execute at server (where the website is hosted) end, & all the business logic will execute at server end where as client side code will execute at client side (usually written in javascript, vbscript, jscript) at browser end.
Ans. Server side code will execute at server (where the website is hosted) end, & all the business logic will execute at server end where as client side code will execute at client side (usually written in javascript, vbscript, jscript) at browser end.
Q2. What type of code (server or client) is found in a Code-Behind class?
Ans. Server side code.
Ans. Server side code.
Q3. How to make sure that value is entered in an asp:Textbox control?
Ans. Use a RequiredFieldValidator control.
Ans. Use a RequiredFieldValidator control.
Q4. Which property of a validation control is used to associate it with a server control on that page?
Ans. ControlToValidate property.
Ans. ControlToValidate property.
Q5. How would you implement inheritance using VB.NET & C#?
Ans. C# Derived Class : Baseclass
VB.NEt : Derived Class Inherits Baseclass
Ans. C# Derived Class : Baseclass
VB.NEt : Derived Class Inherits Baseclass
Q6. Which method is invoked on the DataAdapter control to load the generated dataset with data?
Ans. Fill() method.
Ans. Fill() method.
Q7. What method is used to explicitly kill a user’s session?
Ans. Session.Abandon()
Ans. Session.Abandon()
Q8. What property within the asp:gridview control is changed to bind columns manually?
Ans. Autogenerated columns is set to false
Ans. Autogenerated columns is set to false
Q9. Which method is used to redirect the user to another page without performing a round trip to the client?
Ans. Server.Transfer method.
Ans. Server.Transfer method.
Q10. How do we use different versions of private assemblies in same application without re-build?
Ans.Inside the Assemblyinfo.cs or Assemblyinfo.vb file, we need to specify assembly version.
assembly: AssemblyVersion
Ans.Inside the Assemblyinfo.cs or Assemblyinfo.vb file, we need to specify assembly version.
assembly: AssemblyVersion
Q11. Is it possible to debug java-script in .NET IDE? If yes, how?
Ans. Yes, simply write “debugger” statement at the point where the breakpoint needs to be set within the javascript code and also enable javascript debugging in the browser property settings.
Ans. Yes, simply write “debugger” statement at the point where the breakpoint needs to be set within the javascript code and also enable javascript debugging in the browser property settings.
Q12. How many ways can we maintain the state of a page?
Ans. 1. Client Side – Query string, hidden variables, viewstate, cookies
2. Server side – application , cache, context, session, database
Ans. 1. Client Side – Query string, hidden variables, viewstate, cookies
2. Server side – application , cache, context, session, database
Q13. What is the use of a multicast delegate?
Ans. A multicast delegate may be used to call more than one method.
Ans. A multicast delegate may be used to call more than one method.
Q14. What is the use of a private constructor?
Ans. A private constructor may be used to prevent the creation of an instance for a class.
Ans. A private constructor may be used to prevent the creation of an instance for a class.
Q15. What is the use of Singleton pattern?
Ans. A Singleton pattern .is used to make sure that only one instance of a class exists.
Ans. A Singleton pattern .is used to make sure that only one instance of a class exists.
Q16. When do we use a DOM parser and when do we use a SAX parser?
Ans. The DOM Approach is useful for small documents in which the program needs to process a large portion of the document whereas the SAX approach is useful for large documents in which the program only needs to process a small portion of the document.
Ans. The DOM Approach is useful for small documents in which the program needs to process a large portion of the document whereas the SAX approach is useful for large documents in which the program only needs to process a small portion of the document.
Q17. Will the finally block be executed if an exception has not occurred?
Ans.Yes it will execute.
Ans.Yes it will execute.
Q18. What is a Dataset?
Ans. A dataset is an in memory database kindof object that can hold database information in a disconnected environment.
Ans. A dataset is an in memory database kindof object that can hold database information in a disconnected environment.
Q19. Is XML a case-sensitive markup language?
Ans. Yes.
Ans. Yes.
Q20. What is an .ashx file?
Ans. It is a web handler file that produces output to be consumed by an xml consumer client (rather than a browser).
Ans. It is a web handler file that produces output to be consumed by an xml consumer client (rather than a browser).
Q21. What is encapsulation?
Ans. Encapsulation is the OOPs concept of binding the attributes and behaviors in a class, hiding the implementation of the class and exposing the functionality.
Ans. Encapsulation is the OOPs concept of binding the attributes and behaviors in a class, hiding the implementation of the class and exposing the functionality.
Q22. What is Overloading?
Ans. When we add a new method with the same name in a same/derived class but with different number/types of parameters, the concept is called overluoad and this ultimately implements Polymorphism.
Ans. When we add a new method with the same name in a same/derived class but with different number/types of parameters, the concept is called overluoad and this ultimately implements Polymorphism.
Q23. What is Overriding?
Ans. When we need to provide different implementation in a child class than the one provided by base class, we define the same method with same signatures in the child class and this is called overriding.
Ans. When we need to provide different implementation in a child class than the one provided by base class, we define the same method with same signatures in the child class and this is called overriding.
Q24. What is a Delegate?
Ans. A delegate is a strongly typed function pointer object that encapsulates a reference to a method, and so the function that needs to be invoked may be called at runtime.
Ans. A delegate is a strongly typed function pointer object that encapsulates a reference to a method, and so the function that needs to be invoked may be called at runtime.
Q25. Is String a Reference Type or Value Type in .NET?
Ans. String is a Reference Type object.
Ans. String is a Reference Type object.
Q26. What is a Satellite Assembly?
Ans. Satellite assemblies contain resource files corresponding to a locale (Culture + Language) and these assemblies are used in deploying an application globally for different languages.
Ans. Satellite assemblies contain resource files corresponding to a locale (Culture + Language) and these assemblies are used in deploying an application globally for different languages.
Q27. What are the different types of assemblies and what is their use?
Ans. Private, Public(also called shared) and Satellite Assemblies.
Ans. Private, Public(also called shared) and Satellite Assemblies.
Q28. Are MSIL and CIL the same thing?
Ans. Yes, CIL is the new name for MSIL.
Ans. Yes, CIL is the new name for MSIL.
Q29. What is the base class of all web forms?
Ans. System.Web.UI.Page
Ans. System.Web.UI.Page
Q30. How to add a client side event to a server control?
Ans. Example… BtnSubmit.Attributes.Add(“onclick”,”javascript:fnSomeFunctionInJavascript()”);
Ans. Example… BtnSubmit.Attributes.Add(“onclick”,”javascript:fnSomeFunctionInJavascript()”);
Q31. How to register a client side script from code-behind?
Ans. Use the Page.RegisterClientScriptBlock method in the server side code to register the script that may be built using a StringBuilder.
Ans. Use the Page.RegisterClientScriptBlock method in the server side code to register the script that may be built using a StringBuilder.
Q32. Can a single .NET DLL contain multiple classes?
Ans. Yes, a single .NET DLL may contain any number of classes within it.
Ans. Yes, a single .NET DLL may contain any number of classes within it.
Q33. What is DLL Hell?
Ans. DLL Hell is the name given to the problem of old unmanaged DLL’s due to which there was a possibility of version conflict among the DLLs.
Ans. DLL Hell is the name given to the problem of old unmanaged DLL’s due to which there was a possibility of version conflict among the DLLs.
Q34. can we put a break statement in a finally block?
Ans. The finally block cannot have the break, continue, return and goto statements.
Ans. The finally block cannot have the break, continue, return and goto statements.
Q35. What is a CompositeControl in .NET?
Ans. CompositeControl is an abstract class in .NET that is inherited by those web controls that contain child controls within them.
Ans. CompositeControl is an abstract class in .NET that is inherited by those web controls that contain child controls within them.
Q36. Which control in asp.net is used to display data from an xml file and then displayed using XSLT?
Ans. Use the asp:Xml control and set its DocumentSource property for associating an xml file, and set its TransformSource property to set the xml control’s xsl file for the XSLT transformation.
Ans. Use the asp:Xml control and set its DocumentSource property for associating an xml file, and set its TransformSource property to set the xml control’s xsl file for the XSLT transformation.
Q37. Can we run ASP.NET 1.1 application and ASP.NET 2.0 application on the same computer?
Ans. Yes, though changes in the IIS in the properties for the site have to be made during deployment of each.
Ans. Yes, though changes in the IIS in the properties for the site have to be made during deployment of each.
Q38. What are the new features in .NET 2.0?
Ans. Plenty of new controls, Generics, anonymous methods, partial classes, iterators, property visibility (separate visibility for get and set) and static classes.
Ans. Plenty of new controls, Generics, anonymous methods, partial classes, iterators, property visibility (separate visibility for get and set) and static classes.
Q39. Can we pop a MessageBox in a web application?
Ans. Yes, though this is done clientside using an alert, prompt or confirm or by opening a new web page that looks like a messagebox.
Ans. Yes, though this is done clientside using an alert, prompt or confirm or by opening a new web page that looks like a messagebox.
Q40. What is managed data?
Ans. The data for which the memory management is taken care by .Net runtime’s garbage collector, and this includes tasks for allocation de-allocation.
Ans. The data for which the memory management is taken care by .Net runtime’s garbage collector, and this includes tasks for allocation de-allocation.
Q41. How to instruct the garbage collector to collect unreferenced data?
Ans. We may call the garbage collector to collect unreferenced data by executing the System.GC.Collect() method.
Ans. We may call the garbage collector to collect unreferenced data by executing the System.GC.Collect() method.
Q42. How can we set the Focus on a control in ASP.NET?
Ans. txtBox123.Focus(); OR Page.SetFocus(NameOfControl);
Ans. txtBox123.Focus(); OR Page.SetFocus(NameOfControl);
Q43. What are Partial Classes in Asp.Net 2.0?
Ans. In .NET 2.0, a class definition may be split into multiple physical files but partial classes do not make any difference to the compiler as during compile time, the compiler groups all the partial classes and treats them as a single class.
Ans. In .NET 2.0, a class definition may be split into multiple physical files but partial classes do not make any difference to the compiler as during compile time, the compiler groups all the partial classes and treats them as a single class.
Q44. How to set the default button on a Web Form?
Ans. <asp:form id=”form1″ runat=”server” defaultbutton=”btnGo”/>
Ans. <asp:form id=”form1″ runat=”server” defaultbutton=”btnGo”/>
Q45.Can we force the garbage collector to run?
Ans. Yes, using the System.GC.Collect(), the garbage collector is forced to run in case required to do so.
Ans. Yes, using the System.GC.Collect(), the garbage collector is forced to run in case required to do so.
Q46. What is Boxing and Unboxing?
Ans. Boxing is the process where any value type can be implicitly converted to a reference type object while Unboxing is the opposite of boxing process where the reference type is converted to a value type.
Ans. Boxing is the process where any value type can be implicitly converted to a reference type object while Unboxing is the opposite of boxing process where the reference type is converted to a value type.
Q47. What is Code Access security? What is CAS in .NET?
Ans. CAS is the feature of the .NET security model that determines whether an application or a piece of code is permitted to run and decide the resources it can use while running.
Ans. CAS is the feature of the .NET security model that determines whether an application or a piece of code is permitted to run and decide the resources it can use while running.
Q48. What is Multi-tasking?
Ans. It is a feature of operating systems through which multiple programs may run on the operating system at the same time, just like a scenario where a Notepad, a Calculator and the Control Panel are open at the same time.
Ans. It is a feature of operating systems through which multiple programs may run on the operating system at the same time, just like a scenario where a Notepad, a Calculator and the Control Panel are open at the same time.
Q49. What is Multi-threading?
Ans. When an application performs different tasks at the same time, the application is said to exhibit multithreading as several threads of a process are running.2
Ans. When an application performs different tasks at the same time, the application is said to exhibit multithreading as several threads of a process are running.2
Q50. What is a Thread?
Ans. A thread is an activity started by a process and its the basic unit to which an operating system allocates processor resources.
Ans. A thread is an activity started by a process and its the basic unit to which an operating system allocates processor resources.
Q51. What does AddressOf in VB.NET operator do?
Ans. The AddressOf operator is used in VB.NET to create a delegate object to a method in order to point to it.
Ans. The AddressOf operator is used in VB.NET to create a delegate object to a method in order to point to it.
Q52. How to refer to the current thread of a method in .NET?
Ans. In order to refer to the current thread in .NET, the Thread.CurrentThread method can be used. It is a public static property.
Ans. In order to refer to the current thread in .NET, the Thread.CurrentThread method can be used. It is a public static property.
Q53. How to pause the execution of a thread in .NET?
Ans. The thread execution can be paused by invoking the Thread.Sleep(IntegerValue) method where IntegerValue is an integer that determines the milliseconds time frame for which the thread in context has to sleep.
Ans. The thread execution can be paused by invoking the Thread.Sleep(IntegerValue) method where IntegerValue is an integer that determines the milliseconds time frame for which the thread in context has to sleep.
Q54. How can we force a thread to sleep for an infinite period?
Ans. Call the Thread.Interupt() method.
Ans. Call the Thread.Interupt() method.
Q55. What is Suspend and Resume in .NET Threading?
Ans. Just like a song may be paused and played using a music player, a thread may be paused using Thread.Suspend method and may be started again using the Thread.Resume method. Note that sleep method immediately forces the thread to sleep whereas the suspend method waits for the thread to be in a persistable position before pausing its activity.
Ans. Just like a song may be paused and played using a music player, a thread may be paused using Thread.Suspend method and may be started again using the Thread.Resume method. Note that sleep method immediately forces the thread to sleep whereas the suspend method waits for the thread to be in a persistable position before pausing its activity.
Q56. How can we prevent a deadlock in .Net threading?
Ans. Using methods like Monitoring, Interlocked classes, Wait handles, Event raising from between threads, using the ThreadState property.
Ans. Using methods like Monitoring, Interlocked classes, Wait handles, Event raising from between threads, using the ThreadState property.
Q57. What is Ajax?
Ans. Asyncronous Javascript and XML – Ajax is a combination of client side technologies that sets up asynchronous communication between the user interface and the web server so that partial page rendering occur instead of complete page postbacks.
Ans. Asyncronous Javascript and XML – Ajax is a combination of client side technologies that sets up asynchronous communication between the user interface and the web server so that partial page rendering occur instead of complete page postbacks.
Q58. What is XmlHttpRequest in Ajax?
Ans. It is an object in Javascript that allows the browser to communicate to a web server asynchronously without making a postback.
Ans. It is an object in Javascript that allows the browser to communicate to a web server asynchronously without making a postback.
Q59. What are the different modes of storing an ASP.NET session?
Ans. InProc (the session state is stored in the memory space of the Aspnet_wp.exe process but the session information is lost when IIS reboots), StateServer (the Session state is serialized and stored in a separate process call Viewstate is an object in .NET that automatically persists control setting values across the multiple requests for the same page and it is internally maintained as a hidden field on the web page though its hashed for security reasons.
Ans. InProc (the session state is stored in the memory space of the Aspnet_wp.exe process but the session information is lost when IIS reboots), StateServer (the Session state is serialized and stored in a separate process call Viewstate is an object in .NET that automatically persists control setting values across the multiple requests for the same page and it is internally maintained as a hidden field on the web page though its hashed for security reasons.
Q60. What is a delegate in .NET?
Ans. A delegate in .NET is a class that can have a reference to a method, and this class has a signature that can refer only those methods that have a signature which complies with the class.
Ans. A delegate in .NET is a class that can have a reference to a method, and this class has a signature that can refer only those methods that have a signature which complies with the class.
Q61. Is a delegate a type-safe functions pointer?
Ans. Yes
Ans. Yes
Q62. What is the return type of an event in .NET?
Ans. There is No return type of an event in .NET.
Ans. There is No return type of an event in .NET.
Q63. Is it possible to specify an access specifier to an event in .NET?
Ans. Yes, though they are public by default.
Ans. Yes, though they are public by default.
Q64. Is it possible to create a shared event in .NET?
Ans. Yes, but shared events may only be raised by shared methods.
Ans. Yes, but shared events may only be raised by shared methods.
Q65. How to prevent overriding of a class in .NET?
Ans. Use the keyword NotOverridable in VB.NET and sealed in C#.
Ans. Use the keyword NotOverridable in VB.NET and sealed in C#.
Q66. How to prevent inheritance of a class in .NET?
Ans. Use the keyword NotInheritable in VB.NET and sealed in C#.
Ans. Use the keyword NotInheritable in VB.NET and sealed in C#.
Q67. What is the purpose of the MustInherit keyword in VB.NET?
Ans. MustInherit keyword in VB.NET is used to create an abstract class.
Ans. MustInherit keyword in VB.NET is used to create an abstract class.
Q68. What is the access modifier of a member function of in an Interface created in .NET?
Ans. It is always public, we cant use any other modifier other than the public modifier for the member functions of an Interface.
Ans. It is always public, we cant use any other modifier other than the public modifier for the member functions of an Interface.
Q69. What does the virtual keyword in C# mean?
Ans. The virtual keyword signifies that the method and property may be overridden.
Ans. The virtual keyword signifies that the method and property may be overridden.
Q70. How to create a new unique ID for a control?
Ans. ControlName.ID = “ControlName” + Guid.NewGuid().ToString(); //Make use of the Guid class
Ans. ControlName.ID = “ControlName” + Guid.NewGuid().ToString(); //Make use of the Guid class
Q71A. What is a HashTable in .NET?
Ans. A Hashtable is an object that implements the IDictionary interface, and can be used to store key value pairs. The key may be used as the index to access the values for that index.
Ans. A Hashtable is an object that implements the IDictionary interface, and can be used to store key value pairs. The key may be used as the index to access the values for that index.
Q71B. What is an ArrayList in .NET?
Ans. Arraylist object is used to store a list of values in the form of a list, such that the size of the arraylist can be increased and decreased dynamically, and moreover, it may hold items of different types. Items in an arraylist may be accessed using an index.
Ans. Arraylist object is used to store a list of values in the form of a list, such that the size of the arraylist can be increased and decreased dynamically, and moreover, it may hold items of different types. Items in an arraylist may be accessed using an index.
Q72. What is the value of the first item in an Enum? 0 or 1?
Ans. 0
Ans. 0
Q73. Can we achieve operator overloading in VB.NET?
Ans. Yes, it is supported in the .NET 2.0 version, the “operator” keyword is used.
Ans. Yes, it is supported in the .NET 2.0 version, the “operator” keyword is used.
Q74. What is the use of Finalize method in .NET?
Ans. .NET Garbage collector performs all the clean up activity of the managed objects, and so the finalize method is usually used to free up the unmanaged objects like File objects, Windows API objects, Database connection objects, COM objects etc.
Ans. .NET Garbage collector performs all the clean up activity of the managed objects, and so the finalize method is usually used to free up the unmanaged objects like File objects, Windows API objects, Database connection objects, COM objects etc.
Q75. How do you save all the data in a dataset in .NET?
Ans. Use the AcceptChanges method which commits all the changes made to the dataset since last time Acceptchanges was performed.
Ans. Use the AcceptChanges method which commits all the changes made to the dataset since last time Acceptchanges was performed.
Q76. Is there a way to suppress the finalize process inside the garbage collector forcibly in .NET?
Ans. Use the GC.SuppressFinalize() method.
Ans. Use the GC.SuppressFinalize() method.
Q77. What is the use of the dispose() method in .NET?
Ans. The Dispose method in .NET belongs to IDisposable interface and it is best used to release unmanaged objects like File objects, Windows API objects, Database connection objects, COM objects etc from the memory. Its performance is better than the finalize() method.
Ans. The Dispose method in .NET belongs to IDisposable interface and it is best used to release unmanaged objects like File objects, Windows API objects, Database connection objects, COM objects etc from the memory. Its performance is better than the finalize() method.
Q78. Is it possible to have have different access modifiers on the get and set methods of a property in .NET?
Ans. No we can not have different modifiers of a common property, which means that if the access modifier of a property’s get method is protected, and it must be protected for the set method as well.
Ans. No we can not have different modifiers of a common property, which means that if the access modifier of a property’s get method is protected, and it must be protected for the set method as well.
Q79. In .NET, is it possible for two catch blocks to be executed in one go?
Ans. This is NOT possible because once the correct catch block is executed then the code flow goes to the finally block.
Ans. This is NOT possible because once the correct catch block is executed then the code flow goes to the finally block.
Q80. Is there any difference between System.String and System.StringBuilder classes?
Ans. System.String is immutable by nature whereas System.StringBuilder can have a mutable string in which plenty of processes may be performed.
Ans. System.String is immutable by nature whereas System.StringBuilder can have a mutable string in which plenty of processes may be performed.
Q81. What technique is used to figure out that the page request is a postback?
Ans. The IsPostBack property of the page object may be used to check whether the page request is a postback or not. IsPostBack property is of the type Boolean.
Ans. The IsPostBack property of the page object may be used to check whether the page request is a postback or not. IsPostBack property is of the type Boolean.
Q82. Which event of the ASP.NET page life cycle completely loads all the controls on the web page?
Ans. The Page_load event of the ASP.NET page life cycle assures that all controls are completely loaded. Even though the controls are also accessible in Page_Init event but here, the viewstate is incomplete.
Ans. The Page_load event of the ASP.NET page life cycle assures that all controls are completely loaded. Even though the controls are also accessible in Page_Init event but here, the viewstate is incomplete.
Q83. How is ViewState information persisted across postbacks in an ASP.NET webpage?
Ans. Using HTML Hidden Fields, ASP.NET creates a hidden field with an ID=”__VIEWSTATE” and the value of the page’s viewstate is encoded (hashed) for security.
Ans. Using HTML Hidden Fields, ASP.NET creates a hidden field with an ID=”__VIEWSTATE” and the value of the page’s viewstate is encoded (hashed) for security.
Q84. What is the ValidationSummary control in ASP.NET used for?
Ans. The ValidationSummary control in ASP.NET displays summary of all the current validation errors.
Ans. The ValidationSummary control in ASP.NET displays summary of all the current validation errors.
Q85. What is AutoPostBack feature in ASP.NET?
Ans. In case it is required for a server side control to postback when any of its event is triggered, then the AutoPostBack property of this control is set to true.
Ans. In case it is required for a server side control to postback when any of its event is triggered, then the AutoPostBack property of this control is set to true.
Q86. What is the difference between Web.config and Machine.Config in .NET?
Ans. Web.config file is used to make the settings to a web application, whereas Machine.config file is used to make settings to all ASP.NET applications on a server(the server machine).
Ans. Web.config file is used to make the settings to a web application, whereas Machine.config file is used to make settings to all ASP.NET applications on a server(the server machine).
Q87. What is the difference between a session object and an application object?
Ans. A session object can persist information between HTTP requests for a particular user, whereas an application object can be used globally for all the users.
Ans. A session object can persist information between HTTP requests for a particular user, whereas an application object can be used globally for all the users.
Q88. Which control has a faster performance, Repeater or Datalist?
Ans. Repeater.
Ans. Repeater.
Q89. Which control has a faster performance, Datagrid or Datalist?
Ans. Datalist.
Ans. Datalist.
Q90. How to we add customized columns in a Gridview in ASP.NET?
Ans. Make use of the TemplateField column.
Ans. Make use of the TemplateField column.
Q91. Is it possible to stop the clientside validation of an entire page?
Ans. Set Page.Validate = false;
Ans. Set Page.Validate = false;
Q92. Is it possible to disable client side script in validators?
Ans. Yes. simply EnableClientScript = false.
Ans. Yes. simply EnableClientScript = false.
Q93. How do we enable tracing in .NET applications?
Ans. <%@ Page Trace=”true” %>
Ans. <%@ Page Trace=”true” %>
Q94. How to kill a user session in ASP.NET?
Ans. Use the Session.abandon() method.
Ans. Use the Session.abandon() method.
Q95. Is it possible to perform forms authentication with cookies disabled on a browser?
Ans. Yes, it is possible.
Ans. Yes, it is possible.
Q96. What are the steps to use a checkbox in a gridview?
Ans. <ItemTemplate>
<asp:CheckBox id=”CheckBox1″ runat=”server” AutoPostBack=”True”
OnCheckedChanged=”Check_Clicked”></asp:CheckBox>
</ItemTemplate>
Ans. <ItemTemplate>
<asp:CheckBox id=”CheckBox1″ runat=”server” AutoPostBack=”True”
OnCheckedChanged=”Check_Clicked”></asp:CheckBox>
</ItemTemplate>
Q97. What are design patterns in .NET?
Ans. A Design pattern is a repeatitive solution to a repeatitive problem in the design of a software architecture.
Ans. A Design pattern is a repeatitive solution to a repeatitive problem in the design of a software architecture.
Q98. What is difference between dataset and datareader in ADO.NET?
Ans. A DataReader provides a forward-only and read-only access to data, while the DataSet object can carry more than one table and at the same time hold the relationships between the tables. Also note that a DataReader is used in a connected architecture whereas a Dataset is used in a disconnected architecture.
Ans. A DataReader provides a forward-only and read-only access to data, while the DataSet object can carry more than one table and at the same time hold the relationships between the tables. Also note that a DataReader is used in a connected architecture whereas a Dataset is used in a disconnected architecture.
Q99. Can connection strings be stored in web.config?
Ans. Yes, in fact this is the best place to store the connection string information.
Ans. Yes, in fact this is the best place to store the connection string information.
Q100. Whats the difference between web.config and app.config?
Ans. Web.config is used for web based asp.net applications whereas app.config is used for windows based applications.
Which namespace is used for WCF ?
The namespace System.Servicemodel is used for WCF.
Ans. Web.config is used for web based asp.net applications whereas app.config is used for windows based applications.
Which namespace is used for WCF ?
The namespace System.Servicemodel is used for WCF.
What is WSDL?
WSDL stands for Web Services Description Language.The Web Services Description Language is an XML-based language used for describing network services.WSDL provides machine readable language that can be used for calling a service,passing parameters to the service and what data structures it returns.WSDL is combination of SOAP and XML schema.A client program connecting to a Web service can read the WSDL file to determine what operations are available on the server. Any special datatypes used are embedded in the WSDL file in the form of XML Schema. The client can then use SOAP to actually call one of the operations listed in the WSDL file using XML or HTTP.
WSDL stands for Web Services Description Language.The Web Services Description Language is an XML-based language used for describing network services.WSDL provides machine readable language that can be used for calling a service,passing parameters to the service and what data structures it returns.WSDL is combination of SOAP and XML schema.A client program connecting to a Web service can read the WSDL file to determine what operations are available on the server. Any special datatypes used are embedded in the WSDL file in the form of XML Schema. The client can then use SOAP to actually call one of the operations listed in the WSDL file using XML or HTTP.
What is session and application object ?
Session object stores information between HTTP request for a particular user while application object are global across users.
Session object stores information between HTTP request for a particular user while application object are global across users.
What is the function of GLOBAL.ASAX file ?
It allows to execute ASP.NET application level events and settings application -level variables.
It allows to execute ASP.NET application level events and settings application -level variables.
How to disable client side script in validators ?
Client side script validators can be disabled by setting EnableClientScript to false.
Client side script validators can be disabled by setting EnableClientScript to false.
How to sign out from the forms authentication ?
You can sign out from the forms authentication using the method Forms.Authentication.Signout()
You can sign out from the forms authentication using the method Forms.Authentication.Signout()
Which namespace is required to implement debug and trace ?
System.Diagnostic namespace is required to implement debug and trace
System.Diagnostic namespace is required to implement debug and trace
Which is the best place to store the connection string ?
Config files are the best places to store the connection string.In web application use web.config to store the connection string and in windows application use App.config to store the connection string.
Config files are the best places to store the connection string.In web application use web.config to store the connection string and in windows application use App.config to store the connection string.
How many validation controls are there in ASP.NET ?
There are five validation controls in ASP.NET i.e.RequiredFieldValidator,RegularExpression,ValidationSummary,CustomValidator and CompareValidator.
There are five validation controls in ASP.NET i.e.RequiredFieldValidator,RegularExpression,ValidationSummary,CustomValidator and CompareValidator.
What is the threading model used for ASP.NET ?
ASP.NET uses MTA threading model.
ASP.NET uses MTA threading model.
How to customize columns in data grid ?
In data grid,columns can be customized using template column.
In data grid,columns can be customized using template column.
How to format data inside data grid ?
Inside data grid,data can be formatted using the DataFormatString property.
Inside data grid,data can be formatted using the DataFormatString property.
How to show entire validation error in message box at the client side ?
Entire validation error can be shown in message box using validation summary.Set the property ShowMessageBox to true.
Entire validation error can be shown in message box using validation summary.Set the property ShowMessageBox to true.
What is the extension of user control file ?
The extension of user control file is ascx.
The extension of user control file is ascx.
Which event fires when we click on button inside gridview ?
RowCommand event fires when we click on button inside gridview.
RowCommand event fires when we click on button inside gridview.
What is event bubbling ?
Server controls like datagrid,datalist and repeater can have other child controls inside them.For example,datagrid can have combo box inside it.These child controls do not raise there events by themselves,rather they pass the event to the container parent (which can be datagrid,datalist or repeater),which passes it to the page as ItemCommand event.As the child control sends the event to parent it is termed as event bubbling.
Server controls like datagrid,datalist and repeater can have other child controls inside them.For example,datagrid can have combo box inside it.These child controls do not raise there events by themselves,rather they pass the event to the container parent (which can be datagrid,datalist or repeater),which passes it to the page as ItemCommand event.As the child control sends the event to parent it is termed as event bubbling.
What is the difference between Server.Transfer and Response.Redirect ?
Response.Redirect send message to the browser saying it to move to some different page ,while Server.Transfer does not send any message to the browser but rather redirects the user directly from the server itself.So in Server.Transfer there is no round trip while Response.Redirect has a round trip and hence puts a load on the server.
Using Server.Transfer you can not redirect to different from the server itself.For example,if your server is http://www.yahoo.com you can not use Server.Transfer to move to http://www.rediff.com ,but you can move tohttp://www.yahoo.com/tranvels i.e. within the website.Cross server redirection is only possible using Response.Redirect.
With Server.Transfer you can preserve information.It has parameter called as preserveForm.Therefore, the existing query string etc. will be able in the calling page.
If you are navigating within the website then user Server.Transfer else use Response.Redirect.
Response.Redirect send message to the browser saying it to move to some different page ,while Server.Transfer does not send any message to the browser but rather redirects the user directly from the server itself.So in Server.Transfer there is no round trip while Response.Redirect has a round trip and hence puts a load on the server.
Using Server.Transfer you can not redirect to different from the server itself.For example,if your server is http://www.yahoo.com you can not use Server.Transfer to move to http://www.rediff.com ,but you can move tohttp://www.yahoo.com/tranvels i.e. within the website.Cross server redirection is only possible using Response.Redirect.
With Server.Transfer you can preserve information.It has parameter called as preserveForm.Therefore, the existing query string etc. will be able in the calling page.
If you are navigating within the website then user Server.Transfer else use Response.Redirect.
What is the difference between Authentication and Authorization ?
Authentication is verifying the identity of the user and authorization is the process where we check this identity has access rights to the system.Authorization is the process of allowing an authenticated user access to resource.Authentication always proceed to Authorization,event if your application lets anonymous users connect and use the application,it still authenticates them as anonymous.
Authentication is verifying the identity of the user and authorization is the process where we check this identity has access rights to the system.Authorization is the process of allowing an authenticated user access to resource.Authentication always proceed to Authorization,event if your application lets anonymous users connect and use the application,it still authenticates them as anonymous.
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 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 can specify the account in web.config.
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 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 can specify the account in web.config.
Which control in ASP.NET does not have any visible interface ?
In ASP.NET,repeater control does not have any visible interface.
In ASP.NET,repeater control does not have any visible interface.
What is the difference between server.transfer and server.execute method ?
Server.transfer executes at the server side and the client is not aware about the change.So the URL does not change when server.transfer executes.
Server.Execute executes the specified page and then returns back to original page.This can be used in situtation where you want to go to a specific page, execute that page and then come back to the original page.
Server.transfer executes at the server side and the client is not aware about the change.So the URL does not change when server.transfer executes.
Server.Execute executes the specified page and then returns back to original page.This can be used in situtation where you want to go to a specific page, execute that page and then come back to the original page.
What will happen if you change the web.config file at run time ?
If you change the web.config at the runtime,then the application will start automatically.
If you change the web.config at the runtime,then the application will start automatically.
What is the difference between Response.Output.Write() and Response.Write() ?
Both the methods are used to write the output.But Response.Output.Write() is used to write formatted output.
Both the methods are used to write the output.But Response.Output.Write() is used to write formatted output.
Where is client side script located ?
Client side script is located at server side.A copy of this code is send to client side when any request is received.
Client side script is located at server side.A copy of this code is send to client side when any request is received.
How do we assign page specific attributes ?
Page specific attributes are assigned using @Page directive.
Page specific attributes are assigned using @Page directive.
How do we ensure viewstate is not tampered ?
Using the @Page directive and setting EnableViewState property to True.
Using the @Page directive and setting EnableViewState property to True.
What is the use of @Register directives ?
@Register directive informs the compiler of any custom server control added to the page.
@Register directive informs the compiler of any custom server control added to the page.
What is the use of Smart Navigation property ?
It’s a feature provided by ASP.NET to prevent flickering and redrawing when the page is posted back.
What is Autopostback ?
If we want the control to automatically post back in case any event,we will need to check this attribute as true.Example on a combo box change we need to send the event immediately to the server side then set the AutoPostBack attribute to true.
How can you enable automatic paging in data grid ?
Automatic paging in data grid can be done as follows -
It’s a feature provided by ASP.NET to prevent flickering and redrawing when the page is posted back.
What is Autopostback ?
If we want the control to automatically post back in case any event,we will need to check this attribute as true.Example on a combo box change we need to send the event immediately to the server side then set the AutoPostBack attribute to true.
How can you enable automatic paging in data grid ?
Automatic paging in data grid can be done as follows -
1. Set the Allow Paging to true.
2. In PageIndexChanged event set the current page index clicked.
Explain in brief how the ASP.NET authentication process works ?
ASP.NET does not run by itself,it runs inside the process of IIS.Therefore,there are two authentication layers,which exists in ASP.NET system.First authentication happens at the IIS level and then at the ASP.NET level depending on the Web.config file.The whole process is as follows -
Explain in brief how the ASP.NET authentication process works ?
ASP.NET does not run by itself,it runs inside the process of IIS.Therefore,there are two authentication layers,which exists in ASP.NET system.First authentication happens at the IIS level and then at the ASP.NET level depending on the Web.config file.The whole process is as follows -
1. IIS first checks to make sure the incoming request comes from an IP address that is allowed to access the domain.If not it denies the request.
2. 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 within IIS.
3.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.
4. 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.
What are the different sections of ASPX page ?
Following are the different sections of ASPX page -
What are the different sections of ASPX page ?
Following are the different sections of ASPX page -
1. Page directive – This section is used to set up the environment and specifies how the page should be processed.You can also associate the code file,development language,transaction etc.
2. Code – This section contains code to handle events that execute on the server based on the ASP.NET page processing model.
3. Page Layout – The page layout is written in HTML that includes the HTML body,markup and style information.The HTML body might contain HTML tags,Visual Studio controls,user controls,code and simple text.
What is caching in ASP.NET ?
ASP.NET caching stores frequently accessed data or whole webpages in the memory,where they can be retrieved faster than they could be from a file or database.This helps to improve the performance of the web application.There are two different types of caching in ASP.NET -
ASP.NET caching stores frequently accessed data or whole webpages in the memory,where they can be retrieved faster than they could be from a file or database.This helps to improve the performance of the web application.There are two different types of caching in ASP.NET -
1. Application caching – This represents the collection of data that can be store an object in memory and automatically remove the object based on the memory limitations,time limits or other dependencies.
2. Page output caching – This is ASP.NET’s ability to store the rendered page,portion of a page in the memory to reduce the time required to render the page in future requests.
Why is Global.asax used in ASP.NET ?
Global.asax is used for managing the session and application events.In Global.asax,you can find five sub-routines i.e. Application_Start,Application_End,Application_Error,Session_Start and Session_End.These events can be used for creating log of the site.For eg,when the user opens the site Session_Start event fires.In the same way,other events are fired.
By default how does ASP.NET stores sessionid’s ?
By default,ASP.NET stores the sessionid’s in the cookies.
What is Response Object in ASP.NET ?
Response object represents the information going out from the server to the browser.So the response object is also called as output object.Response object represents the valid HTTP response that is received from the server.The properrties of the response objects are read-only.The different properties of the Response objects are -
Why is Global.asax used in ASP.NET ?
Global.asax is used for managing the session and application events.In Global.asax,you can find five sub-routines i.e. Application_Start,Application_End,Application_Error,Session_Start and Session_End.These events can be used for creating log of the site.For eg,when the user opens the site Session_Start event fires.In the same way,other events are fired.
By default how does ASP.NET stores sessionid’s ?
By default,ASP.NET stores the sessionid’s in the cookies.
What is Response Object in ASP.NET ?
Response object represents the information going out from the server to the browser.So the response object is also called as output object.Response object represents the valid HTTP response that is received from the server.The properrties of the response objects are read-only.The different properties of the Response objects are -
1. Body – Gets the body of the HTTP response. Only the portion of the body stored in the response buffer is returned.
2. Path – Gets the path that was requested.
3. Port – Gets the server port used for the request.
4. Server – Server name is recived that sends the respon
What is Request Object in ASP.NET ?
Request object represents the information going towards the server from the browser.So the request object is also called as input object.Request object represents an HTTP request before it has been sent to the server.The different properties of the Request objects are -
Request object represents the information going towards the server from the browser.So the request object is also called as input object.Request object represents an HTTP request before it has been sent to the server.The different properties of the Request objects are -
1. Body – Gets or sets the HTTP request body
2. Path – Gets or sets the path that was requested.
3. Headers – Gets the HTTP Headers collection object
4. HTTPVersion – Gets/Sets the HTTP version
What is the difference between grid layout and flow layout ?
Grid layout provides absolute positioning for controls placed on the page.Developers that gave their roots in rich client development environments like visual basic will find it easier to develop their pages using absolute positioning,because they can place items exactly where they want them.On the other hand, flow layout positions items down the page like traditional HTML.Experienced web developers favor this approach because it results pages that are compatible with the wider range of browsers.
What is the difference between grid layout and flow layout ?
Grid layout provides absolute positioning for controls placed on the page.Developers that gave their roots in rich client development environments like visual basic will find it easier to develop their pages using absolute positioning,because they can place items exactly where they want them.On the other hand, flow layout positions items down the page like traditional HTML.Experienced web developers favor this approach because it results pages that are compatible with the wider range of browsers.
If you look in to the HTML code created by absolute positioning you can notice lot of DIV tags.While in flow layout, you can see more of using HTML table to position elements,which is compatible with the wide range of browsers.
What is the difference between trace and debug in ASP.NET ?
Debug and trace enables you to monitor the application for errors and exception without VS.NET IDE.In Debug mode,compiler inserts some debugging code inside the executable.As the debugging code is part of the executable they run on the same thread where the code runs and they do not give the exact efficiency of the code(as they run on the same thread). So for every full executable DLL you will see a debug file also as shown in Debug mode.
What is the difference between trace and debug in ASP.NET ?
Debug and trace enables you to monitor the application for errors and exception without VS.NET IDE.In Debug mode,compiler inserts some debugging code inside the executable.As the debugging code is part of the executable they run on the same thread where the code runs and they do not give the exact efficiency of the code(as they run on the same thread). So for every full executable DLL you will see a debug file also as shown in Debug mode.
Trace works in both debug as well release mode.The main advantage of using trace over debug is to do performance analysis which can not be done by debug.Trace runs on a different thread thus it does not impact the main code thread.
There is also a fundamental difference in thinking when we want to use trace and when we want to use debug.Tracing is a process about getting information regarding programs execution.While debugging is about finding errors in the code.
How can tracing be enabled in ASP.NET page ?
To enable tracing on an ASP.NET page,put trace attribute to true on the page attribute.In the code behind,we can use the trace object to put tracing i.e.
How can tracing be enabled in ASP.NET page ?
To enable tracing on an ASP.NET page,put trace attribute to true on the page attribute.In the code behind,we can use the trace object to put tracing i.e.
Trace.Write(“Tracing has been started”)
If you make the trace as false you will only see the actual display i.e. Tracing has been started.So you can enable and disable tracing with out actually compiling and uploading new dll’s on production environment.
Which namespace is needed to implement debug and trace ?
System.Diagnostic namespace is needed to implement debug and trace in an ASP.NET page.
What is XHTML?
XHTML stands for Extensible Hypertext Markup Language.XHTML is cleaner version of HTML and it is recommended by W3C standard.Web pages developed in ASP.NET 2.0 are XHTML compliant.
Can a application be developed using different programming languages ?
Yes,application can be developed using different programming languages.You can create some pages in c# and some pages in vb.net.
Is data reader supported by webservice ?
No,data reader is not supported by the webservice.But webservice supports dataset.
What is the use of machine key in ASP.NET ?
Following are the uses of machine key in ASP.NET -
Which namespace is needed to implement debug and trace ?
System.Diagnostic namespace is needed to implement debug and trace in an ASP.NET page.
What is XHTML?
XHTML stands for Extensible Hypertext Markup Language.XHTML is cleaner version of HTML and it is recommended by W3C standard.Web pages developed in ASP.NET 2.0 are XHTML compliant.
Can a application be developed using different programming languages ?
Yes,application can be developed using different programming languages.You can create some pages in c# and some pages in vb.net.
Is data reader supported by webservice ?
No,data reader is not supported by the webservice.But webservice supports dataset.
What is the use of machine key in ASP.NET ?
Following are the uses of machine key in ASP.NET -
1. Encrypt forms authentication tickets.
2. Encryption of viewstate.
What are ajax extensions ?
Following are the ajax extensions -
Following are the ajax extensions -
1. Update Panel
2. Update Progress
3. Script Manager
What is ajax control toolkit ?
Ajax control toolkit is set of common resusable controls such as modelpopupextender,hovemenurcontrol etc.This is useful to extend our functionality easily.You can download ajax control toolkit fromhttp://www.asp.net/ajax
What is meant by raw ajax ?
Raw ajax means implementing ajax features with the help of xmlhttprequest object.We need to take care of xmlhttprequest compatibility with different browsers.
What is the use of ajax ?
Ajax is mainly used to partially update part of the page asynchronously,so that complete page is not posted back to server and complete round trip is avoided.For implementing ajax manual progress bar is used since the progress bar of the browser does not shows loading when ajax response or request is send or received.
What is the default file upload size for ASP.NET ?
Default file upload size for ASP.NET is 4 MB.If you want to extend this limit then you can configure the maxrequestlength attribute of the httpruntime tag in the web.config file.For eg ,httpRuntime maxRequestLength=”102400″
What is ajax control toolkit ?
Ajax control toolkit is set of common resusable controls such as modelpopupextender,hovemenurcontrol etc.This is useful to extend our functionality easily.You can download ajax control toolkit fromhttp://www.asp.net/ajax
What is meant by raw ajax ?
Raw ajax means implementing ajax features with the help of xmlhttprequest object.We need to take care of xmlhttprequest compatibility with different browsers.
What is the use of ajax ?
Ajax is mainly used to partially update part of the page asynchronously,so that complete page is not posted back to server and complete round trip is avoided.For implementing ajax manual progress bar is used since the progress bar of the browser does not shows loading when ajax response or request is send or received.
What is the default file upload size for ASP.NET ?
Default file upload size for ASP.NET is 4 MB.If you want to extend this limit then you can configure the maxrequestlength attribute of the httpruntime tag in the web.config file.For eg ,httpRuntime maxRequestLength=”102400″
What is viewstate in ASP.NET ?
1. Viewstate is the facility by which ASP.NET maintains the controls state accross postback at the client side.We can use the EnableViewState property of the control to configure viewstate.
1. Viewstate is the facility by which ASP.NET maintains the controls state accross postback at the client side.We can use the EnableViewState property of the control to configure viewstate.
2. By default the EnableViewState property is true.
3. Viewstate is stored in hidden html control i.e. __VIEWSTATE.In __VIEWSTATE,the information of controls is stored in the encrypted format.
4. You can use viewsource to view the content of the __VIEWSTATE.
5. Viewstates ae page specific.
6. We can not access viewstate from one page to another.
7. For enhancing the performance of an ASP.NET page,the content of the __VIEWSTATE should be less.Viewstate can be disabled by setting EnableViewState of the control to false.
Why are the web applications developed in ASP.NET platform independent ?
Browsers understand only html.This factor makes any web technology platform independent.For web applications that are developed using .NET,the application server should have windows operating system,.NET framework and IIS.Once these basic necessities are fulfilled,the web application developed in .NET can execute on Linux also.
What is ASP.NET membership ?
ASP.NET membership is a set of standard pre-defined constructs to implement functionality of role creation,user creation,role to user mapping and many other details.The advantage of using ASP.NET membership is we do not need to design separate database tables,write separate methods for user and role management.
How to configure ASP.NET membership ?
To configure ASP.NET membership, open command prompt of visual studio i.e. Start -> Programs ->Microsoft Visual Studio 2008 -> Visual Studio Tools -> Visual Studio 2008 Command Prompt.Type the command aspnet_regsql.After executing this command you will be prompted by a wizard.Select the option,Configure SQL Server for application services.In this wizard we need to specify SQL database and authentication.Now open the table selection from the database.You can view some new tables which are automatically created such as aspnet_users,aspnet_membership etc.This can save the efforts to design user and role management database tables from the scratch.
Why are the web applications developed in ASP.NET platform independent ?
Browsers understand only html.This factor makes any web technology platform independent.For web applications that are developed using .NET,the application server should have windows operating system,.NET framework and IIS.Once these basic necessities are fulfilled,the web application developed in .NET can execute on Linux also.
What is ASP.NET membership ?
ASP.NET membership is a set of standard pre-defined constructs to implement functionality of role creation,user creation,role to user mapping and many other details.The advantage of using ASP.NET membership is we do not need to design separate database tables,write separate methods for user and role management.
How to configure ASP.NET membership ?
To configure ASP.NET membership, open command prompt of visual studio i.e. Start -> Programs ->Microsoft Visual Studio 2008 -> Visual Studio Tools -> Visual Studio 2008 Command Prompt.Type the command aspnet_regsql.After executing this command you will be prompted by a wizard.Select the option,Configure SQL Server for application services.In this wizard we need to specify SQL database and authentication.Now open the table selection from the database.You can view some new tables which are automatically created such as aspnet_users,aspnet_membership etc.This can save the efforts to design user and role management database tables from the scratch.
How to add confirmation prompt while deleting a record from the gridview ?
Confirmation prompt can be added onclientclick return confirm(‘Do you want to delete this record ?’);
What is the difference between hyperlink and link button ?
Following are the difference between hyperlink and link button -
Confirmation prompt can be added onclientclick return confirm(‘Do you want to delete this record ?’);
What is the difference between hyperlink and link button ?
Following are the difference between hyperlink and link button -
1. Link button has server side click event handler while hyperlink does not have any server side click event.
2. Instead,hyperlink has navigateURL property.
Which control in ASP.NET is used to display hierarchical data ?
In ASP.NET,treeview control is used to display data in hierarchy.In treeview,datatable can not binded directly.Instead,we need to add data in nodes.
How many types of directives are available in ASP.NET ?
There are 11 directives available in ASP.NET.These are as follows -
Which control in ASP.NET is used to display hierarchical data ?
In ASP.NET,treeview control is used to display data in hierarchy.In treeview,datatable can not binded directly.Instead,we need to add data in nodes.
How many types of directives are available in ASP.NET ?
There are 11 directives available in ASP.NET.These are as follows -
1. @assembly – This directive is used for linking the assembly with the current page or user control directory.
2. @Control – This directive is used to define control specific attributes that are used in user controls i.e. ascx page.
3. @Implements- This directive indicates that the page or user control implements .NET Framework interface.
4. @Import – This directive is used for importing namespace in page or user control.The Import directive cannot have more than one namespace attribute.To import multiple namespaces use multiple @Import directives.
5. @Master – This directive is same as @Page directive except that it should be used in master pages.
6. @MasterType – This directive is used for providing a way to create a strongly typed reference to the ASP.NET master page when the master page is accessed from the Master property.
7. @OutputCache – This directive is used for controlling the output caching policies of an Asp.Net page or a user control contained in a page.
8. @Page – This directive defines page specific attributes that can be used in asp.net page.
9. @PreviousPageType – This directive is used for providing a way to get strong typing against the previous page, as accessed through the PreviousPage property.
10 @Reference -This directive is used for indicating that another user control or page source file should be dynamically compiled and linked against the page in which this directive is declared.
11 @Register-This directive is used for associating aliases with namespaces and class names for concise notation in custom server control.
Which dll is used to convert xml to sql in IIS ?
SQLISAPI.dll is used to convert xml to sql in IIS.
Which dll is used to convert xml to sql in IIS ?
SQLISAPI.dll is used to convert xml to sql in IIS.
In which session state mode does Session_End fires ?
Session_End fires in InProc session state mode.
Which state management technique depend on buffering ?
QueryString depend on buffering.
Which validation control does not has control to validate property ?
ValidationSummary control does not has control to validate property.
Which are the intrinsic objects in ASP.NET ?
Intrensic objects are built-in objects of ASP.NET that run on a Web server.Following are the intrinsic objects in ASP.NET -
Session_End fires in InProc session state mode.
Which state management technique depend on buffering ?
QueryString depend on buffering.
Which validation control does not has control to validate property ?
ValidationSummary control does not has control to validate property.
Which are the intrinsic objects in ASP.NET ?
Intrensic objects are built-in objects of ASP.NET that run on a Web server.Following are the intrinsic objects in ASP.NET -
1. Application – Application object provides a reference to an object of the HttpApplicationState class.Application object is used for accessing the information of the entire web application.
2. Request – Request object provides a reference to an object of the HttpRequest class.Request object is used by ASP.NET application for receiving the information send by the client during a Web request.
3. Response – Response object provides a reference to an object of the HttpResponse class.Response object is used by ASP.NET application for sending the information to the client.
4. Server – Server object provides a reference to an object of the HttpServerUtility class.Server object is used for communicating with web server.It provides methods that ca be used to access the methods and properties of the Web server.
5. Session – Session object provides a reference to an object of the HttpSessionState class.Session object is used for accessing the session and storing information pertaining to the client.Session starts when client connects to the web site and session ends when the client disconnects.Also,the session terminates if the client is inactive for specific period. The default timeout period is 20 minutes.
What is the difference between DateTime.Now() and DateTime.Today() ?
Both the functions DateTime.Now() and DateTime.Today() returns the system date.But DateTime.Now() contains time along with the date and DateTime.Today() contains only date.
How to call the client side code after executing server side code ?
To call the client side code after executing server side code,the method ClientScript.RegisterStartupScript can be used.For eg,
Both the functions DateTime.Now() and DateTime.Today() returns the system date.But DateTime.Now() contains time along with the date and DateTime.Today() contains only date.
How to call the client side code after executing server side code ?
To call the client side code after executing server side code,the method ClientScript.RegisterStartupScript can be used.For eg,
ClientScript.RegisterStartupScript(this.getType(),”Script”,”alert(‘Record Saved Successfully’);”,true);
What is LINQ ?
LINQ (Language Integrated Query) -LINQ defines a set of method names (called standard query operators, or standard sequence operators), along with translation rules from so-called query expressions to expressions using these method names, lambda expressions and anonymous types. These can, for example, be used to project and filter data into arrays, enumerable classes, XML (LINQ to XML), relational databases, and third party data sources.The following are different types of LINQ -
What is LINQ ?
LINQ (Language Integrated Query) -LINQ defines a set of method names (called standard query operators, or standard sequence operators), along with translation rules from so-called query expressions to expressions using these method names, lambda expressions and anonymous types. These can, for example, be used to project and filter data into arrays, enumerable classes, XML (LINQ to XML), relational databases, and third party data sources.The following are different types of LINQ -
1.Linq To Object – It is mainly used to filter ,sort in memory objects such as datatable,array etc.For eg,
var test=from dr in dt AsEnumerable();
where dr["Empid"]==1;
select dr;
Here var is anonymous type.
Above linq expression will search record from the datatable dt whose empid is 1.Linq to object is an alternate way to datatable methods like filter,sort etc.
2.Linq To SQL – It is used to manipulate data in database.
3. Linq To XML – It is used to filter data from XML in an effective manner.
How to change Regional language setting date format using .net ?
Date format can be changed using the following code -
How to change Regional language setting date format using .net ?
Date format can be changed using the following code -
Microsoft.Win32.Registry.SetValue(“HKEY_CURRENT_USER\Control Panel\International”, “sShortDate”, “M/d/yyyy”)
Here I have considered the date format as “M/d/yyyy”.You can change it as per your requirement.After executing this code,the changes can be seen Regional and Language Options i.e. Control Panel -> Regional and Language Options.
What are the various ways of authentication techniques in ASP.NET
Selecting an authentication provider is as simple as making an entry in the web.config file for the application. You can use one of these entries to select the corresponding built in authentication provider-
What are the various ways of authentication techniques in ASP.NET
Selecting an authentication provider is as simple as making an entry in the web.config file for the application. You can use one of these entries to select the corresponding built in authentication provider-
1. authentication mode=”windows”
2. authentication mode=”passport”
3. authentication mode=”forms”
4. Custom authentication where you might install an ISAPI filter in IIS that compares incoming requests to list of source IP addresses, and considers requests to be authenticated if they come from an acceptable address. In that case, you would set the authentication mode to none to prevent any of the .net authentication providers from being triggered.
Windows authentication and IIS
If you select windows authentication for your ASP.NET application, you also have to configure authentication within IIS. This is because IIS provides Windows authentication. IIS gives you a choice for four different authentication methods
Anonymous, basic, digest and windows integrated
If you select anonymous authentication, IIS does not perform any authentication, any one is allowed to access the ASP.NET application.
If you select basic authentication, users must provide a windows username and password to connect. How ever, this information is sent over the network in clear text, which makes basic authentication very much insecure over the internet.
If you select digest authentication, users must still provide a windows user name and password to connect. However, the password is hashed before it is sent across the network. Digest authentication requires that all users be running Internet Explorer 5 or later and that windows accounts to stored in active directory.
If you select windows integrated authentication, passwords never cross the network. Users must still have a username and password, but the application uses the Kerberos or challenge/response protocols authenticate the user. Windows-integrated authentication requires that all users be running internet explorer 3.01 or later Kerberos is a network authentication protocol. It is designed to provide strong authentication for client/server applications by using secret-key cryptography. Kerberos is a solution to network security problems. It provides the tools of authentication and strong cryptography over the network to help to secure information in systems across entire enterprise
Passport authentication
Passport authentication lets you to use Microsoft’s passport service to authenticate users of your application. If your users have signed up with passport, and you configure the authentication mode of the application to the passport authentication, all authentication duties are off-loaded to the passport servers.
Passport uses an encrypted cookie mechanism to indicate authenticated users. If users have already signed into passport when they visit your site, they will be considered authenticated by ASP.NET. Otherwise, they will be redirected to the passport servers to log in. When they are successfully log in, they will be redirected back to your site
To use passport authentication you have to download the Passport Software Development Kit (SDK) and install it on your server. The SDK can be found at
It includes full details of implementing passport authentication in your own applications.
Forms authentication
Forms authentication provides you with a way to handle authentication using your own custom logic with in an ASP.NET application. The following applies if you choose forms authentication.
1. When a user requests a page for the application, ASP.NET checks for the presence of a special session cookie. If the cookie is present, ASP.NET assumes the user is authenticate
How does authorization work in ASP.NET?
ASP.NET impersonation is controlled by entries in the applications web.config file. The default setting is “no impersonation”. You can explicitly specify that ASP.NET should not use impersonation by including the following code in the file
ASP.NET impersonation is controlled by entries in the applications web.config file. The default setting is “no impersonation”. You can explicitly specify that ASP.NET should not use impersonation by including the following code in the file
identity impersonate=”false”
It means that ASP.NET will not perform any authentication and runs with its own privileges. By default, ASP.NET runs as an unprivileged account named ASPNET. You can change this by making a setting in the process Model section of the machine.config file. When you make this setting, it automatically applies to every site on the server. To user a high-privileged system account instead of a low-privileged set the username attribute of the process Model element to SYSTEM. Using this setting is a definite security risk, as it elevates the privileges of the ASP.NET process to a point where it can do bad things to the operating system.
When you disable impersonation, all the request will run in the context of the account running ASP.NET: either the ASPNET account or the system account. This is true when you are using anonymous access or authenticating users in some fashion. After the user has been authenticated, ASP.NET uses its own identity to request access to resources.
The second possible setting is to turn on impersonation.
identity impersonate =”true”
In this case, ASP.NET takes on the identity IIS passes to it. If you are allowing anonymous access in IIS, this means ASP.NET will impersonate the IUSR_ComputerName account that IIS itself uses. If you are not allowing anonymous access, ASP.NET will take on the credentials of the authenticated user and make requests for resources as if it were that user. Thus by turning impersonation on and using a non-anonymous method of authentication in IIS, you can let users log on and use their identities within your ASP.NET application.
Finally, you can specify a particular identity to use for all authenticated requests
identity impersonate=”true” username=”DOMAIN\username” password=”password”
With this setting, all the requests are made as the specified user (Assuming the password it correct in the configuration file). Therefore, for example you could designate a user for a single application, and use that user’s identity every time someone authenticates to the application. The drawback to this technique is that you must embed the user’s password in the web.config file in plain text. Although ASP.NET will not allow anyone to download this file, this is still a security risk if anyone can get the file by other means.
What is difference between Data grid, Datalist, and repeater?
A Data grid, Datalist and Repeater are all ASP.NET data Web controls.
What is difference between Data grid, Datalist, and repeater?
A Data grid, Datalist and Repeater are all ASP.NET data Web controls.
They have many things in common like Data Source Property, Data Bind Method ItemDataBound, and Item Created.
When you assign the Data Source Property of a Data grid to a Dataset then each Data Row present in the Data Row Collection of Data Table is assigned to a corresponding DataGridItem and this is same for the rest of the two controls. However, The HTML code generated for a Data grid has an HTML TABLE ROW element created for the particular Data Row and it is a Table form representation with Columns and Rows.
For a Datalist it is an Array of Rows and based on the Template Selected and the Repeat Column Property value we can specify how many Data Source records should appear per HTML table row. In short, in data grid, we have one record per row, but in data list, we can have five or six rows per row.
For a Repeater Control, the Data records to be displayed depend upon the Templates specified and the only HTML generated is the due to the Templates.
In addition to these, Data grid has a in-built support for Sort, Filter and paging the Data, which is not possible when using a Data List and for a Repeater Control we would require to write an explicit code to do paging.
How to decide on the design consideration to take a Data grid,data list, or repeater?
Many make a blind choice of choosing data grid directly, but that is not the right way.
How to decide on the design consideration to take a Data grid,data list, or repeater?
Many make a blind choice of choosing data grid directly, but that is not the right way.
Data grid provides ability to allow the end-user to sort, page, and edit its data. However, it comes at a cost of speed. Second, the display format is simple that is in row and columns. Real life scenarios can be more demanding that
With its templates, the Data List provides more control over the look and feel of the displayed data than the Data Grid. It offers better performance than data grid
Repeater control allows for complete and total control. With the Repeater, the only HTML emitted are the values of the data binding statements in the templates along with the HTML markup specified in the templates—no “extra” HTML is emitted, as with the Data Grid and Data List. By requiring the developer to specify the complete generated HTML markup, the Repeater often requires the longest development time. However, repeater does not provide editing features like data grid so everything has to be coded by programmer. However, the Repeater does boast the best performance of the three data Web controls. Repeater is fastest followed by Datalist and finally data grid.
Difference between ASP and ASP.NET?
ASP.NET new feature supports are as follows:-
Difference between ASP and ASP.NET?
ASP.NET new feature supports are as follows:-
Better Language Support
• New ADO.NET Concepts have been implemented.
• ASP.NET supports full language (C#, VB.NET, C++) and not simple scripting like VBSCRIPT…
Better controls than ASP
• ASP.NET covers large set’s of HTML controls..
• Better Display grid like Data grid, Repeater and datalist.Many of the display grid havpaging support.
Controls have events support
• All ASP.NET controls support events.
• Load, Click, and Change events handled by code makes coding much simpler and much better organized.
Compiled Code
The first request for an ASP.NET page on the server will compile the ASP.NET code and keep a cached copy in memory. The result of this is greatly increased performance.
Better Authentication Support
ASP.NET supports forms-based user authentication, including cookie management and automatic redirecting of unauthorized logins. (You can still do your custom login page and custom user checking).
User Accounts and Roles
ASP.NET allows for user accounts and roles, to give each user (with a given role) access to different server code and executables.
High Scalability
• Much has been done with ASP.NET to provide greater scalability.
• Server to server communication has been greatly enhanced, making it possible to scale an application over several servers. One example of this is the ability to run XML parsers, XSL transformations, and even resource hungry session objects on other servers.
Easy Configuration
• Configuration of ASP.NET is done with plain text files.
• Configuration files can be uploaded or changed while the application is running. No need to restart the server. No more metabase or registry puzzle.
Easy Deployment
No more server restart to deploy or replace compiled code. ASP.NET simply redirects all new requests to the new code.
What are major events in GLOBAL.ASAX file?
The Global. Sax file, which is derived from the Http Application class, maintains a pool of Http Application objects, and assigns them to applications as needed. The Global. Sax file contains the following events:
The Global. Sax file, which is derived from the Http Application class, maintains a pool of Http Application objects, and assigns them to applications as needed. The Global. Sax file contains the following events:
Application_Init: Fired when an application initializes or is first called. It is invoked for all Http Application object instances.
Application Disposed: Fired just before an application is destroyed. This is the ideal location for cleaning up previously used resources.
Application Error: Fired when an unhandled exception is encountered within the application.
Application Start: Fired when the first instance of the Http Application class is created. It allows you to create objects that are accessible by all Http Application instances.
Application End: Fired when the last instance of an Http Application class is destroyed. It is fired only once during an application’s lifetime.
Application_BeginRequest: Fired when an application request is received. It is the first event fired for a request, which is often a page request (URL) that a user enters.
Application_EndRequest: The last event fired for an application request.
Application_PreRequestHandlerExecute: Fired before the ASP.NET page framework begins executing an event handler like a page or Web service.
Application_PostRequestHandlerExecute: Fired when the ASP.NET page framework has finished executing an event handler.
Applcation_PreSendRequestHeaders: Fired before the ASP.NET page framework sends HTTP headers to a requesting client (browser).
Application_PreSendContent: Fired before the ASP.NET page framework send content to a requesting client (browser). Application_AcquireRequestState: Fired when the ASP.NET page framework gets the current state (Session state) related to the current request.
Application_ReleaseRequestState: Fired when the ASP.NET page framework completes execution of all event handlers. This results in all state modules to save their current state data.
Application_ResolveRequestCache: Fired when the ASP.NET page framework completes an authorization request. It allows caching modules to serve the request from the cache, thus bypassing handler execution.
Application_UpdateRequestCache: Fired when the ASP.NET page framework completes handler execution to allow caching modules to store responses to be used to handle subsequent requests.
Application_AuthenticateRequest: Fired when the security module has established the current user’s identity as valid. At this point, the user’s credentials have been validated.
Application_AuthorizeRequest: Fired when the security module has verified that a user can access resources.
Session Start: Fired when a new user visits the application Web site.
Session End: Fired when a user’s session times out, ends, or they leave the application Web site.
What is the order events triggering in GLOBAL.ASAX file ?
They are triggered in the following order:
What is the order events triggering in GLOBAL.ASAX file ?
They are triggered in the following order:
Application_BeginRequest
Application_AuthenticateRequest
Application_AuthorizeRequest
Application_ResolveRequestCache
Application_AcquireRequestState
Application_PreRequestHandlerExecute
Application_PreSendRequestHeaders
Application_PreSendRequestContent
Code is executed
Application_PostRequestHandlerExecute
Application_ReleaseRequestState
Application_UpdateRequestCache
Application_EndRequest.
If client side validation is enabled in your Web page, does that mean server side code is not run.
When client side validation is enabled server emit’s JavaScript code for the custom validators. However, note that does not mean that server side checks on custom validators do not execute. It does this redundant check two times, as some of the validators do not support client side scripting.
Which JavaScript file is referenced for validating the validators at the client side?
WebUIValidation.js JavaScript file installed at “aspnet_client” root IIS directory is used to validate the validation controls at the client side
Which is the common property of all validation controls ?
ControlToValidate is the common property of all validation controls.
When client side validation is enabled server emit’s JavaScript code for the custom validators. However, note that does not mean that server side checks on custom validators do not execute. It does this redundant check two times, as some of the validators do not support client side scripting.
Which JavaScript file is referenced for validating the validators at the client side?
WebUIValidation.js JavaScript file installed at “aspnet_client” root IIS directory is used to validate the validation controls at the client side
Which is the common property of all validation controls ?
ControlToValidate is the common property of all validation controls.
What data type is returned by the IsPostback property ?
Boolean data type is returned by the IsPostback property.
How to create FileSystemObject in ASP.NET ?
FileSystemObject can be created using the method Server.CreateObject(“Scripting.FileSystemObject”).
Give the name of state management technique that rely on buffering ?
Querystrings is the state management technique that rely on buffering.
In ASP.NET,what is used for validating the complex string patterns ?
In ASP.NET,regular expression is used for validating the complex string patterns.
Boolean data type is returned by the IsPostback property.
How to create FileSystemObject in ASP.NET ?
FileSystemObject can be created using the method Server.CreateObject(“Scripting.FileSystemObject”).
Give the name of state management technique that rely on buffering ?
Querystrings is the state management technique that rely on buffering.
In ASP.NET,what is used for validating the complex string patterns ?
In ASP.NET,regular expression is used for validating the complex string patterns.
How can we prevent a browser from caching web page ?
In ASP.NET,browser can be prevented from caching a web page using the method Response.Cache.SetNoStore().
Give the name of datasource control that does not implement caching ?
In ASP.NET,LinqDataSource does not implement caching.
LINQ is included in which .NET Framework ?
LINQ is included in .NET Framework 3.5.
How to evaluate the page execution time,request time and response time ?
Bugzilla is used to evaluate the page execution time,request time and response time.
Do html controls perform rendering ?
Html controls does not perform rendering since all the browsers understand the html tags.
What does XBAP stands for ?
XBAP stands for XAML Browser Application .It is a new Windows technology used for creating Rich Internet Applications.The extension of the executable file is .xabp and it can be executed in internet browser.
How to restrict a class from being inhertited by another class ?
The keywod sealed can be used for restricting a class from being inhertited by another class.
Which type of authentication is not used by IIS ?
Forms type of authentication is not used by IIS.
Is session a method to maintain client side state ?
No,session is not a method to maintain client side state since session value is stored in server memory.
In the connection string,what do we specify at Initial Catalog ?
In the connection string, Initial Catalog is used for defining the database name.The example of connection string is as,
In ASP.NET,browser can be prevented from caching a web page using the method Response.Cache.SetNoStore().
Give the name of datasource control that does not implement caching ?
In ASP.NET,LinqDataSource does not implement caching.
LINQ is included in which .NET Framework ?
LINQ is included in .NET Framework 3.5.
How to evaluate the page execution time,request time and response time ?
Bugzilla is used to evaluate the page execution time,request time and response time.
Do html controls perform rendering ?
Html controls does not perform rendering since all the browsers understand the html tags.
What does XBAP stands for ?
XBAP stands for XAML Browser Application .It is a new Windows technology used for creating Rich Internet Applications.The extension of the executable file is .xabp and it can be executed in internet browser.
How to restrict a class from being inhertited by another class ?
The keywod sealed can be used for restricting a class from being inhertited by another class.
Which type of authentication is not used by IIS ?
Forms type of authentication is not used by IIS.
Is session a method to maintain client side state ?
No,session is not a method to maintain client side state since session value is stored in server memory.
In the connection string,what do we specify at Initial Catalog ?
In the connection string, Initial Catalog is used for defining the database name.The example of connection string is as,
User ID=sa;Pwd=sa;Initial Catalog=DB;server=192.168.0.42
Which control displays a single record at a time ?
FormView control display’s a single record at a time.
Is it possible to add multiple skins on a single page ?
Yes,it is possible to add multiple skins on a single page.
Does form authentication work if cookies are not enabled in browser ?
Yes,form authentication work if cookies are not enabled in browser.
What is the default port number the protocol https is used ?
The default port number of https protocol is 443.
When was ASP.NET launched ?
The first version of ASP.NET was launched in January 2002 with version 1.0 of the .NET Framework.
Is timer control available in ASP.NET ?
There is no build in timer control in ASP.NET.But timer control is provided in AJAX.For using this AJAX timer control you need to incorporate AJAX in your ASP.NET web application.
What do you mean by round trip in ASP.NET ?
In ASP.NET,when a button is clicked,the information is send to server.This information is processed at the server end and the result is returned to the browser.This sequence of sending information,processing information and getting the result is known an round trip.
Web pages are stateless.What does this means ?
In the client server architecture,the web pages are created from scratch every time round trip occurs.When any information is send to server,it processes it and creates the result.But it does not preserve any information.Everything is developed from scratch and discarded once the result is posted to the client.So the web pages are said to be stateless.
DataGridView control is available in windows application and gridview control is available in web application.Both of these controls support datasource property.Is the databind method available in both the controls i.e. datagridview and gridview.
No,databind method is not available in both the controls.Databind method is available in gridview but in datagridview this method is not available.
What are the characteristics of a website ?
The following are the characteristics of a website -
FormView control display’s a single record at a time.
Is it possible to add multiple skins on a single page ?
Yes,it is possible to add multiple skins on a single page.
Does form authentication work if cookies are not enabled in browser ?
Yes,form authentication work if cookies are not enabled in browser.
What is the default port number the protocol https is used ?
The default port number of https protocol is 443.
When was ASP.NET launched ?
The first version of ASP.NET was launched in January 2002 with version 1.0 of the .NET Framework.
Is timer control available in ASP.NET ?
There is no build in timer control in ASP.NET.But timer control is provided in AJAX.For using this AJAX timer control you need to incorporate AJAX in your ASP.NET web application.
What do you mean by round trip in ASP.NET ?
In ASP.NET,when a button is clicked,the information is send to server.This information is processed at the server end and the result is returned to the browser.This sequence of sending information,processing information and getting the result is known an round trip.
Web pages are stateless.What does this means ?
In the client server architecture,the web pages are created from scratch every time round trip occurs.When any information is send to server,it processes it and creates the result.But it does not preserve any information.Everything is developed from scratch and discarded once the result is posted to the client.So the web pages are said to be stateless.
DataGridView control is available in windows application and gridview control is available in web application.Both of these controls support datasource property.Is the databind method available in both the controls i.e. datagridview and gridview.
No,databind method is not available in both the controls.Databind method is available in gridview but in datagridview this method is not available.
What are the characteristics of a website ?
The following are the characteristics of a website -
1. Website is nothing but collection of web pages to server a specific purpose.
2. To access a website one should have browser and internet connection.
3. Website are by nature platform independent since the browser only understands HTML.
4. Websites are very seamless to deploy the web pages at the central location.
5. To host a website one should use application server.
6. There are number of application servers such as IIS,apache tomcat etc.
What is the basic sequence of events in ASP.NET ?
Suppose the user clicks on server side button and button is configured for the onclientclick(Client side event) and onclick(server side event) event.Then the onclientclick event will fire first followed by the onclick event.
What is the use of connection string in .NET ?
Connection string is used for authenticating the database for accessing the information from the database.Connection string contains server name,database name,user id,password and database provider.
What is the difference between ASP.NET server control and html control ?
ASP.NET server controls are advanced controls having its own properties and methods.These controls are event driven.When a specific event is triggered,the attached procedure executes.This procedure executes on the server and the end result is returned to the client.
Suppose the user clicks on server side button and button is configured for the onclientclick(Client side event) and onclick(server side event) event.Then the onclientclick event will fire first followed by the onclick event.
What is the use of connection string in .NET ?
Connection string is used for authenticating the database for accessing the information from the database.Connection string contains server name,database name,user id,password and database provider.
What is the difference between ASP.NET server control and html control ?
ASP.NET server controls are advanced controls having its own properties and methods.These controls are event driven.When a specific event is triggered,the attached procedure executes.This procedure executes on the server and the end result is returned to the client.
HTML controls are simple controls.These controls are also event driven but the procedure or function attached to the event executes at the client side.The execution speed of html control is faster than server control since it executes at client side and the round trip is avoided.
For eg,consider two button controls.One is server control and other is html control.Both these controls have onclick event.Just assume that both the controls display a message “Hello world” when they are clicked.When the server control in clicked,the procedure will be called and executed on the server.The message will be returned.When the html button is clicked,the javascript function will the called and the message will be displayed.For the server control postback will occur.But for html control,postback will not occur.
When the requirement is very simple then html control can be used.When the requirement is complex such as interacting with the database server,then server control should be used.In short,just analyse your requirement.When the processing can be done at the client side,then use html control.When the processing can be done on the server,then use server control.
For eg,you want to find the addition of two numbers.These two numbers are placed in two textboxes.In this case,add a html button and call a javascript that gets the values from these two textboxes and adds it.Now assume that you want to find the salary of employee which is saved in database.In this case,add a server button and onclick event write a procedure that executes a query and gets the salary of employee.
What is the difference between session and viewstate ?
Following are the differences between session and viewstate-
What is the difference between session and viewstate ?
Following are the differences between session and viewstate-
1.Both session and viewstate are used for saving data.But session saves the data as per user session.The data persist as long as session is alive.Once the session is destroyed or expires,the data from the session object is destroyed.Viewstate saves data pagewise.The data persists as long as page is alive.Once the page is unloaded,the data from viewstate is destroyed.
2.The data of the session object is saved on the web server while the data of viewstate is stored at the client side.
3.Session variables are stored in a SessionStateItemCollection object that is accessed using HttpContext.Session property. ViewState variables are stored in hidden textbox.Right click on the page and select viewsource.You will find a text box as,
input type=”hidden” name=”__VIEWSTATE” id=”__VIEWSTATE” value =”/wEPDwUKLTE3NT”
4.Session object has different modes such as InProc,StateServer,SQLServer,Custom and Off.There are no modes in Viewstate.
How is web request handeled in ASP.NET ?
Following are the steps of handeling a web request in ASP.NET -
How is web request handeled in ASP.NET ?
Following are the steps of handeling a web request in ASP.NET -
1. Suppose you enter the following url in the browser.
2. This url is splitted into three parts as -
Protocol – http
Server Name – http://www.example.com
File Name – index.aspx
3. Browser first communicates with the computer called as ‘Domain Name Server’.The communication between browser and the ‘Domain Name Server’ is established with the help of internet.Domain Name Server finds the IP address of the server http://www.example.com.
4. Then the browser communicates with the web server at that IP address.
5. Server creates a request for the specified url and forwards the request to the web server to which it has established a connection.
6. The web server examines the page requested.If it is asp.net page,then some processing should be done by the asp.net service.So the request is then forwarded to asp.net process.The asp.net service processes the asp.net page and generates the html output.
7. This html output is send back to the browser by the web server.
8. The html code is rendered in the browser to show the web page.
What is the difference between ByVal and ByRef i.e. passing value as parameter and passing reference as parameter ?
When you use ByVal i.e. pass value as parameter,you create another variable which holds the value of original variable.This another variable consumes same memory as original variable and then it is used in the called procedure or function.
What is the difference between ByVal and ByRef i.e. passing value as parameter and passing reference as parameter ?
When you use ByVal i.e. pass value as parameter,you create another variable which holds the value of original variable.This another variable consumes same memory as original variable and then it is used in the called procedure or function.
When you use ByRef i.e. pass reference as parameter,the address of the variable is passed.While executing the procedure or function,the value from that particular address is fetched.You don’t create another variable.So additional memory is not consumed.This approach is very useful when the value of passed variable remains constant until the called procedure or function terminates.
From code optimization point of view,you should use ByRef instead of ByVal. ByRef consumes low memory since replica of the variable is not created.Address of any variable is numeric and numeric data type consumes less memory.
What is the base class of web forms ?
Page is the base class of web forms.This page class is inherited from System.Web.UI namespace.
What is session object in ASP.NET ?
When you use any application on your computer,the computer knows what you are doing.It tracks each and every activity while the application is executing.
What is the base class of web forms ?
Page is the base class of web forms.This page class is inherited from System.Web.UI namespace.
What is session object in ASP.NET ?
When you use any application on your computer,the computer knows what you are doing.It tracks each and every activity while the application is executing.
This type of tracking system is not available on the internet since HTTP address does not maintain state.The web server does not know your identity and what you are doing.ASP.NET has resolved this problem by creating a unique cookie for each user.The cookie is send to user’s computer and it contains all the essential information for tracking the user and his activities.This interface is called the Session object.
The information stored in the session object is session specific.When the user connects to the site new session is created and information is saved in cookie.Next time when he reconnects to the site new session is created.The information saved in session can be accessed by all the web pages but this information is lost once the session expires.So you can save information in the session object where the interaction or transaction last for short interval of time i.e. transaction time should be less than session time.If you are interacting with the site for more than hour than it is not advisable to store information in session object.
What is use of InStr function ?
InStr function is used for finding the position of the character or string.For eg, consider the following example,
What is use of InStr function ?
InStr function is used for finding the position of the character or string.For eg, consider the following example,
InStr(“Test”, “t”)
In the above example,the input string is Test and we want to find the position of the character t.Since the position of the character t is 4 then output of the above example is 4.Now consider another example.
InStr(“Test”, “es”)
In the above example,the output will be 2.
What is the difference between Response.Cookies and Request.Cookies ?
Response.Cookies are the cookies that are send from server to browser.
What is the difference between Response.Cookies and Request.Cookies ?
Response.Cookies are the cookies that are send from server to browser.
Request.Cookies are the cookies that are send from browser to server.
More Question
More Question
1. What is ASP.Net?
It is a framework developed by
Microsoft on which we can
develop new generation web sites
using web forms(aspx), MVC,
HTML, Javascript, CSS etc. Its
successor of Microsoft Active
Server Pages(ASP). Currently
there is ASP.NET 4.0, which is
used to develop web sites. There
are various page extensions
provided by Microsoft that are
being used for web site
development. Eg: aspx, asmx,
ascx, ashx, cs, vb, html, xml etc.
2. What’s the use of Response.Output.Write()?
We can write formatted output using Response.Output.Write().
3. In which event of page cycle is the ViewState available?
After the Init() and before the Page_Load().
4. What is the difference between Server.Transfer and Response.Redirect?
In Server.Transfer page processing transfers from one page to the other page
without making a round-trip back to the client’s browser. This provides a faster
response with a little less overhead on the server. The clients url history list or
current url Server does not update in case of Server.Transfer.
Response.Redirect is used to redirect the user’s browser to another page or site. It
performs trip back to the client where the client’s browser is redirected to the new
page. The user’s browser history list is updated to reflect the new address.
5. From which base class all Web Forms are inherited?
Page class.
6. What are the different validators in ASP.NET?
1. Required field Validator
2. Range Validator
3. Compare Validator
4. Custom Validator
5. Regular expression Validator
6. Summary Validator
7. Which validator control you use if you need to make sure the values in two
different controls matched?
Compare Validator control.
8. What is ViewState?
ViewState is used to retain the state of server-side objects between page post
backs.
9. Where the viewstate is stored after the page postback?
ViewState is stored in a hidden field on the page at client side. ViewState is
transported to the client and back to the server, and is not stored on the server or
any other external source.
10. How long the items in ViewState exists?
They exist for the life of the current page.
11. What are the different Session state management options available in
ASP.NET?
1. In-Process
2. Out-of-Process.
In-Process stores the session in memory on the web server.
Out-of-Process Session state management stores data in an external server. The
external server may be either a SQL Server or a State Server. All objects stored in
session are required to be serializable for Out-of-Process state management.
12. How you can add an event handler?
Using the Attributes property of server side control.
e.g.
btnSubmit.Attributes.Add(“onMouseOver”,”JavascriptCode();”)
13. What is caching?
Caching is a technique used to increase performance by keeping frequently
accessed data or files in memory. The request for a cached file/data will be
accessed from cache instead of actual location of that file.
14. What are the different types of caching?
ASP.NET has 3 kinds of caching :
1. Output Caching,
2. Fragment Caching,
3. Data Caching.
15. Which type if caching will be used if we want to cache the portion of a
page instead of whole page?
Fragment Caching: It caches the portion of the page generated by the request. For
that, we can create user controls with the below code:
<%@ OutputCache Duration=”120″ VaryByParam=”CategoryID;SelectedID”%>
16. List the events in page life cycle.
1) Page_PreInit
2) Page_Init
3) Page_InitComplete
4) Page_PreLoad
5) Page_Load
6) Page_LoadComplete
7) Page_PreRender
8)Render
17. Can we have a web application running without web.Config file?
Yes
18. Is it possible to create web application with both webforms and mvc?
Yes. We have to include below mvc assembly references in the web forms
application to create hybrid application.
System.Web.Mvc
System.Web.Razor
System.ComponentModel.DataAnnotations
19. Can we add code files of different languages in App_Code folder?
No. The code files must be in same language to be kept in App_code folder.
20. What is Protected Configuration?
It is a feature used to secure connection string information.
21. Write code to send e-mail from an ASP.NET application?
MailMessage mailMess = new MailMessage ();
mailMess.From = “abc@gmail.com”;
mailMess.To = “xyz@gmail.com”;
mailMess.Subject = “Test email”;
mailMess.Body = “Hi This is a test mail.”;
SmtpMail.SmtpServer = “localhost”;
SmtpMail.Send (mailMess);
MailMessage and SmtpMail are classes defined System.Web.Mail namespace.
22. How can we prevent browser from caching an ASPX page?
We can SetNoStore on HttpCachePolicy object exposed by the Response object’s
Cache property:
Response.Cache.SetNoStore ();
Response.Write (DateTime.Now.ToLongTimeString ());
23. What is the good practice to implement validations in aspx page?
Client-side validation is the best way to validate data of a web page. It reduces the
network traffic and saves server resources.
24. What are the event handlers that we can have in Global.asax file?
Application Events: Application_Start , Application_End,
Application_AcquireRequestState, Application_AuthenticateRequest,
Application_AuthorizeRequest, Application_BeginRequest, Application_Disposed,
Application_EndRequest, Application_Error,
Application_PostRequestHandlerExecute, Application_PreRequestHandlerExecute,
Application_PreSendRequestContent, Application_PreSendRequestHeaders,
Application_ReleaseRequestState, Application_ResolveRequestCache,
Application_UpdateRequestCache
Session Events: Session_Start,Session_End
25. Which protocol is used to call a Web service?
HTTP Protocol
26. Can we have multiple web config files for an asp.net application?
Yes.
27. What is the difference between web config and machine config?
Web config file is specific to a web application where as machine config is specific
to a machine or server. There can be multiple web config files into an application
where as we can have only one machine config file on a server.
28. Explain role based security ?
Role Based Security used to implement security based on roles assigned to user
groups in the organization.
Then we can allow or deny users based on their role in the organization. Windows
defines several built-in groups, including Administrators, Users, and Guests.
<AUTHORIZATION>< authorization >
< allow roles=”Domain_Name\Administrators” / > < !– Allow Administrators in domain. — >
< deny users=”*” / > < !– Deny anyone else. — >
< /authorization >
29. What is Cross Page Posting?
When we click submit button on a web page, the page post the data to the same
page. The technique in which we post the data to different pages is called Cross
Page posting. This can be achieved by setting POSTBACKURL property of the
button that causes the postback. Findcontrol method of PreviousPage can be used
to get the posted values on the page to which the page has been posted.
30. How can we apply Themes to an asp.net application?
We can specify the theme in web.config file. Below is the code example to apply
theme:
<configuration>
<system.web>
<pages theme=”Windows7″ />
</system.web>
</configuration>
31: What is RedirectPermanent in ASP.Net?
RedirectPermanent Performs a permanent redirection from the requested URL to
the specified URL. Once the redirection is done, it also returns 301 Moved
Permanently responses.
32: What is MVC?
MVC is a framework used to create web applications. The web application base
builds on Model-View-Controller pattern which separates the application logic from
UI, and the input and events from the user will be controlled by the Controller.
33. Explain the working of passport authentication.
First of all it checks passport authentication cookie. If the cookie is not available then
the application redirects the user to Passport Sign on page. Passport service
authenticates the user details on sign on page and if valid then stores the
authenticated cookie on client machine and then redirect the user to requested page
34. What are the advantages of Passport authentication?
All the websites can be accessed using single login credentials. So no need to
remember login credentials for each web site.
Users can maintain his/ her information in a single location.
35. What are the asp.net Security Controls?
<asp:Login>: Provides a standard login capability that allows the users to
enter their credentials
<asp:LoginName>: Allows you to display the name of the logged-in user
<asp:LoginStatus>: Displays whether the user is authenticated or not
<asp:LoginView>: Provides various login views depending on the selected
template
<asp:PasswordRecovery>: email the users their lost password
36: How do you register JavaScript for webcontrols ?
We can register javascript for controls using <CONTROL -
name>Attribtues.Add(scriptname,scripttext) method.
37. In which event are the controls fully loaded?
Page load event.
38: what is boxing and unboxing?
Boxing is assigning a value type to reference type variable.
Unboxing is reverse of boxing ie. Assigning reference type variable to value type
variable.
39. Differentiate strong typing and weak typing
In strong typing, the data types of variable are checked at compile time. On the other
hand, in case of weak typing the variable data types are checked at runtime. In case
of strong typing, there is no chance of compilation error. Scripts use weak typing
and hence issues arises at runtime.
40. How we can force all the validation controls to run?
The Page.Validate() method is used to force all the validation controls to run and to
perform validation.
41. List all templates of the Repeater control.
ItemTemplate
AlternatingltemTemplate
SeparatorTemplate
HeaderTemplate
FooterTemplate
42. List the major built-in objects in ASP.NET?
Application
Request
Response
Server
Session
Context
Trace
43. What is the appSettings Section in the web.config file?
The appSettings block in web config file sets the user-defined values for the whole
application.
For example, in the following code snippet, the specified ConnectionString section is
used throughout the project for database connection:
<em><configuration>
<appSettings>
<add key=”ConnectionString” value=”server=local; pwd=password; database=default” />
</appSettings></em>
44. Which data type does the RangeValidator control support?
The data types supported by the RangeValidator control are Integer, Double, String,
Currency, and Date.
45. What is the difference between an HtmlInputCheckBox control and an
HtmlInputRadioButton control?
In HtmlInputCheckBoxcontrol, multiple item selection is possible whereas
in HtmlInputRadioButton controls, we can select only single item from the group of
items.
46. Which namespaces are necessary to create a localized application?
System.Globalization
System.Resources
47. What are the different types of cookies in ASP.NET?
Session Cookie – Resides on the client machine for a single session until the user
does not log out.
Persistent Cookie – Resides on a user’s machine for a period specified for its
expiry, such as 10 days, one month, and never.
48. What is the file extension of web service?
Web services have file extension .asmx..
49. What are the components of ADO.NET?
The components of ADO.Net are Dataset, Data Reader, Data Adaptor, Command,
connection.
50. What is the difference between ExecuteScalar and ExecuteNonQuery?
ExecuteScalar returns output value where as ExecuteNonQuery does not return any
value. ExecuteScalar used for fetching a single value and ExecuteNonQuery used to
execute Insert and Update statements.
50 More Question for OOPS
It is a framework developed by
Microsoft on which we can
develop new generation web sites
using web forms(aspx), MVC,
HTML, Javascript, CSS etc. Its
successor of Microsoft Active
Server Pages(ASP). Currently
there is ASP.NET 4.0, which is
used to develop web sites. There
are various page extensions
provided by Microsoft that are
being used for web site
development. Eg: aspx, asmx,
ascx, ashx, cs, vb, html, xml etc.
2. What’s the use of Response.Output.Write()?
We can write formatted output using Response.Output.Write().
3. In which event of page cycle is the ViewState available?
After the Init() and before the Page_Load().
4. What is the difference between Server.Transfer and Response.Redirect?
In Server.Transfer page processing transfers from one page to the other page
without making a round-trip back to the client’s browser. This provides a faster
response with a little less overhead on the server. The clients url history list or
current url Server does not update in case of Server.Transfer.
Response.Redirect is used to redirect the user’s browser to another page or site. It
performs trip back to the client where the client’s browser is redirected to the new
page. The user’s browser history list is updated to reflect the new address.
5. From which base class all Web Forms are inherited?
Page class.
6. What are the different validators in ASP.NET?
1. Required field Validator
2. Range Validator
3. Compare Validator
4. Custom Validator
5. Regular expression Validator
6. Summary Validator
7. Which validator control you use if you need to make sure the values in two
different controls matched?
Compare Validator control.
8. What is ViewState?
ViewState is used to retain the state of server-side objects between page post
backs.
9. Where the viewstate is stored after the page postback?
ViewState is stored in a hidden field on the page at client side. ViewState is
transported to the client and back to the server, and is not stored on the server or
any other external source.
10. How long the items in ViewState exists?
They exist for the life of the current page.
11. What are the different Session state management options available in
ASP.NET?
1. In-Process
2. Out-of-Process.
In-Process stores the session in memory on the web server.
Out-of-Process Session state management stores data in an external server. The
external server may be either a SQL Server or a State Server. All objects stored in
session are required to be serializable for Out-of-Process state management.
12. How you can add an event handler?
Using the Attributes property of server side control.
e.g.
btnSubmit.Attributes.Add(“onMouseOver”,”JavascriptCode();”)
13. What is caching?
Caching is a technique used to increase performance by keeping frequently
accessed data or files in memory. The request for a cached file/data will be
accessed from cache instead of actual location of that file.
14. What are the different types of caching?
ASP.NET has 3 kinds of caching :
1. Output Caching,
2. Fragment Caching,
3. Data Caching.
15. Which type if caching will be used if we want to cache the portion of a
page instead of whole page?
Fragment Caching: It caches the portion of the page generated by the request. For
that, we can create user controls with the below code:
<%@ OutputCache Duration=”120″ VaryByParam=”CategoryID;SelectedID”%>
16. List the events in page life cycle.
1) Page_PreInit
2) Page_Init
3) Page_InitComplete
4) Page_PreLoad
5) Page_Load
6) Page_LoadComplete
7) Page_PreRender
8)Render
17. Can we have a web application running without web.Config file?
Yes
18. Is it possible to create web application with both webforms and mvc?
Yes. We have to include below mvc assembly references in the web forms
application to create hybrid application.
System.Web.Mvc
System.Web.Razor
System.ComponentModel.DataAnnotations
19. Can we add code files of different languages in App_Code folder?
No. The code files must be in same language to be kept in App_code folder.
20. What is Protected Configuration?
It is a feature used to secure connection string information.
21. Write code to send e-mail from an ASP.NET application?
MailMessage mailMess = new MailMessage ();
mailMess.From = “abc@gmail.com”;
mailMess.To = “xyz@gmail.com”;
mailMess.Subject = “Test email”;
mailMess.Body = “Hi This is a test mail.”;
SmtpMail.SmtpServer = “localhost”;
SmtpMail.Send (mailMess);
MailMessage and SmtpMail are classes defined System.Web.Mail namespace.
22. How can we prevent browser from caching an ASPX page?
We can SetNoStore on HttpCachePolicy object exposed by the Response object’s
Cache property:
Response.Cache.SetNoStore ();
Response.Write (DateTime.Now.ToLongTimeString ());
23. What is the good practice to implement validations in aspx page?
Client-side validation is the best way to validate data of a web page. It reduces the
network traffic and saves server resources.
24. What are the event handlers that we can have in Global.asax file?
Application Events: Application_Start , Application_End,
Application_AcquireRequestState, Application_AuthenticateRequest,
Application_AuthorizeRequest, Application_BeginRequest, Application_Disposed,
Application_EndRequest, Application_Error,
Application_PostRequestHandlerExecute, Application_PreRequestHandlerExecute,
Application_PreSendRequestContent, Application_PreSendRequestHeaders,
Application_ReleaseRequestState, Application_ResolveRequestCache,
Application_UpdateRequestCache
Session Events: Session_Start,Session_End
25. Which protocol is used to call a Web service?
HTTP Protocol
26. Can we have multiple web config files for an asp.net application?
Yes.
27. What is the difference between web config and machine config?
Web config file is specific to a web application where as machine config is specific
to a machine or server. There can be multiple web config files into an application
where as we can have only one machine config file on a server.
28. Explain role based security ?
Role Based Security used to implement security based on roles assigned to user
groups in the organization.
Then we can allow or deny users based on their role in the organization. Windows
defines several built-in groups, including Administrators, Users, and Guests.
<AUTHORIZATION>< authorization >
< allow roles=”Domain_Name\Administrators” / > < !– Allow Administrators in domain. — >
< deny users=”*” / > < !– Deny anyone else. — >
< /authorization >
29. What is Cross Page Posting?
When we click submit button on a web page, the page post the data to the same
page. The technique in which we post the data to different pages is called Cross
Page posting. This can be achieved by setting POSTBACKURL property of the
button that causes the postback. Findcontrol method of PreviousPage can be used
to get the posted values on the page to which the page has been posted.
30. How can we apply Themes to an asp.net application?
We can specify the theme in web.config file. Below is the code example to apply
theme:
<configuration>
<system.web>
<pages theme=”Windows7″ />
</system.web>
</configuration>
31: What is RedirectPermanent in ASP.Net?
RedirectPermanent Performs a permanent redirection from the requested URL to
the specified URL. Once the redirection is done, it also returns 301 Moved
Permanently responses.
32: What is MVC?
MVC is a framework used to create web applications. The web application base
builds on Model-View-Controller pattern which separates the application logic from
UI, and the input and events from the user will be controlled by the Controller.
33. Explain the working of passport authentication.
First of all it checks passport authentication cookie. If the cookie is not available then
the application redirects the user to Passport Sign on page. Passport service
authenticates the user details on sign on page and if valid then stores the
authenticated cookie on client machine and then redirect the user to requested page
34. What are the advantages of Passport authentication?
All the websites can be accessed using single login credentials. So no need to
remember login credentials for each web site.
Users can maintain his/ her information in a single location.
35. What are the asp.net Security Controls?
<asp:Login>: Provides a standard login capability that allows the users to
enter their credentials
<asp:LoginName>: Allows you to display the name of the logged-in user
<asp:LoginStatus>: Displays whether the user is authenticated or not
<asp:LoginView>: Provides various login views depending on the selected
template
<asp:PasswordRecovery>: email the users their lost password
36: How do you register JavaScript for webcontrols ?
We can register javascript for controls using <CONTROL -
name>Attribtues.Add(scriptname,scripttext) method.
37. In which event are the controls fully loaded?
Page load event.
38: what is boxing and unboxing?
Boxing is assigning a value type to reference type variable.
Unboxing is reverse of boxing ie. Assigning reference type variable to value type
variable.
39. Differentiate strong typing and weak typing
In strong typing, the data types of variable are checked at compile time. On the other
hand, in case of weak typing the variable data types are checked at runtime. In case
of strong typing, there is no chance of compilation error. Scripts use weak typing
and hence issues arises at runtime.
40. How we can force all the validation controls to run?
The Page.Validate() method is used to force all the validation controls to run and to
perform validation.
41. List all templates of the Repeater control.
ItemTemplate
AlternatingltemTemplate
SeparatorTemplate
HeaderTemplate
FooterTemplate
42. List the major built-in objects in ASP.NET?
Application
Request
Response
Server
Session
Context
Trace
43. What is the appSettings Section in the web.config file?
The appSettings block in web config file sets the user-defined values for the whole
application.
For example, in the following code snippet, the specified ConnectionString section is
used throughout the project for database connection:
<em><configuration>
<appSettings>
<add key=”ConnectionString” value=”server=local; pwd=password; database=default” />
</appSettings></em>
44. Which data type does the RangeValidator control support?
The data types supported by the RangeValidator control are Integer, Double, String,
Currency, and Date.
45. What is the difference between an HtmlInputCheckBox control and an
HtmlInputRadioButton control?
In HtmlInputCheckBoxcontrol, multiple item selection is possible whereas
in HtmlInputRadioButton controls, we can select only single item from the group of
items.
46. Which namespaces are necessary to create a localized application?
System.Globalization
System.Resources
47. What are the different types of cookies in ASP.NET?
Session Cookie – Resides on the client machine for a single session until the user
does not log out.
Persistent Cookie – Resides on a user’s machine for a period specified for its
expiry, such as 10 days, one month, and never.
48. What is the file extension of web service?
Web services have file extension .asmx..
49. What are the components of ADO.NET?
The components of ADO.Net are Dataset, Data Reader, Data Adaptor, Command,
connection.
50. What is the difference between ExecuteScalar and ExecuteNonQuery?
ExecuteScalar returns output value where as ExecuteNonQuery does not return any
value. ExecuteScalar used for fetching a single value and ExecuteNonQuery used to
execute Insert and Update statements.
50 More Question for OOPS
1. What is OOPS?
OOPS is abbreviated as Object Oriented Programming system in which programs are considered as a collection of objects. Each object is nothing but an instance of a class.
2. Write basic concepts of OOPS?
Following are the concepts of OOPS and are as follows:.
Abstraction.
Encapsulation.
Inheritance.
Polymorphism.
3. What is a class?
Class is a collection of the object, and it has common structure and behavior.
4. What is an object?
Object is termed as an instance of a class, and it has its own state, behavior and identity.
5. What is Encapsulation?
Encapsulation is an attribute of an object, and it contains all data which is hidden. That hidden data can be restricted to the members of that class.
Levels are Public, Protected, Private, Internal and Protected Internal.
6. What is Polymorphism?
Polymorphism is nothing but assigning behavior or value in a subclass to something that was already declared in the main class. Simply, polymorphism takes more than one form.
7. What is Inheritance?
Inheritance is a concept where one class shares the structure and behavior defined in another class. If inheritance applied on one class is called Single Inheritance, and if it depends on multiple classes, then it is called multiple Inheritance.
8. What are manipulators?
Manipulators are the functions which can be used in conjunction with the insertion (<<) and extraction (>>) operators on an object. Examples are endl and setw.
9. Define a constructor?
Constructor is a method used to initialize the state of an object, and it gets invoked at the time of object creation. Rules for constructor are:.
Constructor Name should be same as class name.
Constructor must have no return type.
10. Define Destructor?
Destructor is a method which is automatically called when the object is made of scope or destroyed. Destructor name is also same as class name but with the tilde symbol before the name.
11. What is Inline function?
Inline function is a technique used by the compilers and instructs to insert complete body of the function wherever that function is used in the program source code.
12. What is a virtual function?
Virtual function is a member function of class and its functionality can be overridden in its derived class. This function can be implemented by using a keyword called virtual, and it can be given during function declaration.
Virtual function can be achieved in C++, and it can be achieved in C Language by using function pointers or pointers to function.
13. What is friend function?
Friend function is a friend of a class that is allowed to access to Public, private or protected data in that same class. If the function is defined outside the class cannot access such information.
Friend can be declared anywhere in the class declaration, and it cannot be affected by access control keywords like private, public or protected.
14. What is function overloading?
Function overloading is defined as a normal function, but it has the ability to perform different tasks. It allows creation of several methods with the same name which differ from each other by type of input and output of the function.
Example
void add(int& a, int& b);
void add(double& a, double& b);
void add(struct bob& a, struct bob& b);
15. What is operator overloading?
Operator overloading is a function where different operators are applied and depends on the arguments. Operator,-,* can be used to pass through the function , and it has their own precedence to execute.
Example:
class complex {
double real, imag;
public:
complex(double r, double i) :
real(r), imag(i) {}
complex operator+(complex a, complex b);
complex operator*(complex a, complex b);
complex& operator=(complex a, complex b);
}
a=1.2, b=6
16. What is an abstract class?
An abstract class is a class which cannot be instantiated. Creation of an object is not possible with abstract class , but it can be inherited. An abstract class can contain only Abstract method.
17. What is a ternary operator?
Ternary operator is set to be an operator which takes three arguments. Arguments and results are of different data types , and it is depends on the function. Ternary operator is also called as conditional operator.
18. What is the use of finalize method?
Finalize method helps to perform cleanup operations on the resources which are not currently used. Finalize method is protected , and it is accessible only through this class or by a derived class.
19. What are different types of arguments?
A parameter is a variable used during the declaration of the function or subroutine and arguments are passed to the function , and it should match with the parameter defined. There are two types of Arguments.
Call by Value – Value passed will get modified only inside the function , and it returns the same value whatever it is passed it into the function.
Call by Reference – Value passed will get modified in both inside and outside the functions and it returns the same or different value.
20. What is super keyword?
Super keyword is used to invoke overridden method which overrides one of its superclass methods. This keyword allows to access overridden methods and also to access hidden members of the superclass.
It also forwards a call from a constructor to a constructor in the superclass.
21. What is method overriding?
Method overriding is a feature that allows sub class to provide implementation of a method that is already defined in the main class. This will overrides the implementation in the superclass by providing the same method name, same parameter and same return type.
22. What is an interface?
An interface is a collection of abstract method. If the class implements an inheritance, and then thereby inherits all the abstract methods of an interface.
23. What is exception handling?
Exception is an event that occurs during the execution of a program. Exceptions can be of any type – Run time exception, Error exceptions. Those exceptions are handled properly through exception handling mechanism like try, catch and throw keywords.
24. What are tokens?
Token is recognized by a compiler and it cannot be broken down into component elements. Keywords, identifiers, constants, string literals and operators are examples of tokens.
Even punctuation characters are also considered as tokens – Brackets, Commas, Braces and Parentheses.
25. Difference between overloading and overriding?
Overloading is static binding whereas Overriding is dynamic binding. Overloading is nothing but the same method with different arguments , and it may or may not return the same value in the same class itself.
Overriding is the same method names with same arguments and return types associates with the class and its child class.
26. Difference between class and an object?
An object is an instance of a class. Objects hold any information , but classes don’t have any information. Definition of properties and functions can be done at class and can be used by the object.
Class can have sub-classes, and an object doesn’t have sub-objects.
27. What is an abstraction?
Abstraction is a good feature of OOPS , and it shows only the necessary details to the client of an object. Means, it shows only necessary details for an object, not the inner details of an object. Example – When you want to switch On television, it not necessary to show all the functions of TV. Whatever is required to switch on TV will be showed by using abstract class.
28. What are access modifiers?
Access modifiers determine the scope of the method or variables that can be accessed from other various objects or classes. There are 5 types of access modifiers , and they are as follows:.
Private.
Protected.
Public.
Friend.
Protected Friend.
29. What is sealed modifiers?
Sealed modifiers are the access modifiers where it cannot be inherited by the methods. Sealed modifiers can also be applied to properties, events and methods. This modifier cannot be applied to static members.
OOPS is abbreviated as Object Oriented Programming system in which programs are considered as a collection of objects. Each object is nothing but an instance of a class.
2. Write basic concepts of OOPS?
Following are the concepts of OOPS and are as follows:.
Abstraction.
Encapsulation.
Inheritance.
Polymorphism.
3. What is a class?
Class is a collection of the object, and it has common structure and behavior.
4. What is an object?
Object is termed as an instance of a class, and it has its own state, behavior and identity.
5. What is Encapsulation?
Encapsulation is an attribute of an object, and it contains all data which is hidden. That hidden data can be restricted to the members of that class.
Levels are Public, Protected, Private, Internal and Protected Internal.
6. What is Polymorphism?
Polymorphism is nothing but assigning behavior or value in a subclass to something that was already declared in the main class. Simply, polymorphism takes more than one form.
7. What is Inheritance?
Inheritance is a concept where one class shares the structure and behavior defined in another class. If inheritance applied on one class is called Single Inheritance, and if it depends on multiple classes, then it is called multiple Inheritance.
8. What are manipulators?
Manipulators are the functions which can be used in conjunction with the insertion (<<) and extraction (>>) operators on an object. Examples are endl and setw.
9. Define a constructor?
Constructor is a method used to initialize the state of an object, and it gets invoked at the time of object creation. Rules for constructor are:.
Constructor Name should be same as class name.
Constructor must have no return type.
10. Define Destructor?
Destructor is a method which is automatically called when the object is made of scope or destroyed. Destructor name is also same as class name but with the tilde symbol before the name.
11. What is Inline function?
Inline function is a technique used by the compilers and instructs to insert complete body of the function wherever that function is used in the program source code.
12. What is a virtual function?
Virtual function is a member function of class and its functionality can be overridden in its derived class. This function can be implemented by using a keyword called virtual, and it can be given during function declaration.
Virtual function can be achieved in C++, and it can be achieved in C Language by using function pointers or pointers to function.
13. What is friend function?
Friend function is a friend of a class that is allowed to access to Public, private or protected data in that same class. If the function is defined outside the class cannot access such information.
Friend can be declared anywhere in the class declaration, and it cannot be affected by access control keywords like private, public or protected.
14. What is function overloading?
Function overloading is defined as a normal function, but it has the ability to perform different tasks. It allows creation of several methods with the same name which differ from each other by type of input and output of the function.
Example
void add(int& a, int& b);
void add(double& a, double& b);
void add(struct bob& a, struct bob& b);
15. What is operator overloading?
Operator overloading is a function where different operators are applied and depends on the arguments. Operator,-,* can be used to pass through the function , and it has their own precedence to execute.
Example:
class complex {
double real, imag;
public:
complex(double r, double i) :
real(r), imag(i) {}
complex operator+(complex a, complex b);
complex operator*(complex a, complex b);
complex& operator=(complex a, complex b);
}
a=1.2, b=6
16. What is an abstract class?
An abstract class is a class which cannot be instantiated. Creation of an object is not possible with abstract class , but it can be inherited. An abstract class can contain only Abstract method.
17. What is a ternary operator?
Ternary operator is set to be an operator which takes three arguments. Arguments and results are of different data types , and it is depends on the function. Ternary operator is also called as conditional operator.
18. What is the use of finalize method?
Finalize method helps to perform cleanup operations on the resources which are not currently used. Finalize method is protected , and it is accessible only through this class or by a derived class.
19. What are different types of arguments?
A parameter is a variable used during the declaration of the function or subroutine and arguments are passed to the function , and it should match with the parameter defined. There are two types of Arguments.
Call by Value – Value passed will get modified only inside the function , and it returns the same value whatever it is passed it into the function.
Call by Reference – Value passed will get modified in both inside and outside the functions and it returns the same or different value.
20. What is super keyword?
Super keyword is used to invoke overridden method which overrides one of its superclass methods. This keyword allows to access overridden methods and also to access hidden members of the superclass.
It also forwards a call from a constructor to a constructor in the superclass.
21. What is method overriding?
Method overriding is a feature that allows sub class to provide implementation of a method that is already defined in the main class. This will overrides the implementation in the superclass by providing the same method name, same parameter and same return type.
22. What is an interface?
An interface is a collection of abstract method. If the class implements an inheritance, and then thereby inherits all the abstract methods of an interface.
23. What is exception handling?
Exception is an event that occurs during the execution of a program. Exceptions can be of any type – Run time exception, Error exceptions. Those exceptions are handled properly through exception handling mechanism like try, catch and throw keywords.
24. What are tokens?
Token is recognized by a compiler and it cannot be broken down into component elements. Keywords, identifiers, constants, string literals and operators are examples of tokens.
Even punctuation characters are also considered as tokens – Brackets, Commas, Braces and Parentheses.
25. Difference between overloading and overriding?
Overloading is static binding whereas Overriding is dynamic binding. Overloading is nothing but the same method with different arguments , and it may or may not return the same value in the same class itself.
Overriding is the same method names with same arguments and return types associates with the class and its child class.
26. Difference between class and an object?
An object is an instance of a class. Objects hold any information , but classes don’t have any information. Definition of properties and functions can be done at class and can be used by the object.
Class can have sub-classes, and an object doesn’t have sub-objects.
27. What is an abstraction?
Abstraction is a good feature of OOPS , and it shows only the necessary details to the client of an object. Means, it shows only necessary details for an object, not the inner details of an object. Example – When you want to switch On television, it not necessary to show all the functions of TV. Whatever is required to switch on TV will be showed by using abstract class.
28. What are access modifiers?
Access modifiers determine the scope of the method or variables that can be accessed from other various objects or classes. There are 5 types of access modifiers , and they are as follows:.
Private.
Protected.
Public.
Friend.
Protected Friend.
29. What is sealed modifiers?
Sealed modifiers are the access modifiers where it cannot be inherited by the methods. Sealed modifiers can also be applied to properties, events and methods. This modifier cannot be applied to static members.
30. How can we call the base method without creating an instance?
Yes, it is possible to call the base method without creating an instance. And that method should be,.
Static method.
Doing inheritance from that class.-Use Base Keyword from derived class.
31. What is the difference between new and override?
The new modifier instructs the compiler to use the new implementation instead of the base class function. Whereas, Override modifier helps to override the base class function.
32. What are the various types of constructors?
There are three various types of constructors , and they are as follows:.
- Default Constructor – With no parameters.
- Parametric Constructor – With Parameters. Create a new instance of a class and also passing arguments simultaneously.
- Copy Constructor – Which creates a new object as a copy of an existing object.
33. What is early and late binding?
Early binding refers to assignment of values to variables during design time whereas late binding refers to assignment of values to variables during run time.
34. What is ‘this’ pointer?
THIS pointer refers to the current object of a class. THIS keyword is used as a pointer which differentiates between the current object with the global object. Basically, it refers to the current object.
35. What is the difference between structure and a class?
Structure default access type is public , but class access type is private. A structure is used for grouping data whereas class can be used for grouping data and methods. Structures are exclusively used for data and it doesn’t require strict validation , but classes are used to encapsulates and inherit data which requires strict validation.
36. What is the default access modifier in a class?
The default access modifier of a class is Private by default.
37. What is pure virtual function?
A pure virtual function is a function which can be overridden in the derived class but cannot be defined. A virtual function can be declared as Pure by using the operator =0.
Example -.
Virtual void function1() // Virtual, Not pure
Virtual void function2() = 0 //Pure virtual
38. What are all the operators that cannot be overloaded?
Following are the operators that cannot be overloaded -.
Scope Resolution (:: )
Member Selection (.)
Member selection through a pointer to function (.*)
Yes, it is possible to call the base method without creating an instance. And that method should be,.
Static method.
Doing inheritance from that class.-Use Base Keyword from derived class.
31. What is the difference between new and override?
The new modifier instructs the compiler to use the new implementation instead of the base class function. Whereas, Override modifier helps to override the base class function.
32. What are the various types of constructors?
There are three various types of constructors , and they are as follows:.
- Default Constructor – With no parameters.
- Parametric Constructor – With Parameters. Create a new instance of a class and also passing arguments simultaneously.
- Copy Constructor – Which creates a new object as a copy of an existing object.
33. What is early and late binding?
Early binding refers to assignment of values to variables during design time whereas late binding refers to assignment of values to variables during run time.
34. What is ‘this’ pointer?
THIS pointer refers to the current object of a class. THIS keyword is used as a pointer which differentiates between the current object with the global object. Basically, it refers to the current object.
35. What is the difference between structure and a class?
Structure default access type is public , but class access type is private. A structure is used for grouping data whereas class can be used for grouping data and methods. Structures are exclusively used for data and it doesn’t require strict validation , but classes are used to encapsulates and inherit data which requires strict validation.
36. What is the default access modifier in a class?
The default access modifier of a class is Private by default.
37. What is pure virtual function?
A pure virtual function is a function which can be overridden in the derived class but cannot be defined. A virtual function can be declared as Pure by using the operator =0.
Example -.
Virtual void function1() // Virtual, Not pure
Virtual void function2() = 0 //Pure virtual
38. What are all the operators that cannot be overloaded?
Following are the operators that cannot be overloaded -.
Scope Resolution (:: )
Member Selection (.)
Member selection through a pointer to function (.*)
39. What is dynamic or run time polymorphism?
Dynamic or Run time polymorphism is also known as method overriding in which call to an overridden function is resolved during run time, not at the compile time. It means having two or more methods with the same name, same signature but with different implementation.
40. Do we require parameter for constructors?
No, we do not require parameter for constructors.
41. What is a copy constructor?
This is a special constructor for creating a new object as a copy of an existing object. There will be always only on copy constructor that can be either defined by the user or the system.
42. What does the keyword virtual represented in the method definition?
It means, we can override the method.
43. Whether static method can use non static members?
False.
44. What are base class, sub class and super class?
Base class is the most generalized class , and it is set to be a root class.
Sub class is a class that inherits from one or more base classes.
Super class is another type of class from which another class inherits.
45. What is static and dynamic binding?
Binding is nothing but the association of a name with the class. Static binding is a binding in which name can be associated with the class during compilation time , and it is also called as early Binding.
Dynamic binding is a binding in which name can be associated with the class during execution time , and it is also called as Late Binding.
46. How many instances can be created for an abstract class?
Zero instances will be created for an abstract class.
47. Which keyword can be used for overloading?
Operator keyword is used for overloading.
48. What is the default access specifier in a class definition?
Private access specifier is used in a class definition.
49. Which OOPS concept is used as reuse mechanism?
Inheritance is the OOPS concept that can be used as reuse mechanism.
50. Which OOPS concept exposes only necessary information to the calling functions?
Data Hiding / Abstraction
50 More question for sql server
1. What is DBMS?
A Database Management System (DBMS) is a program that controls creation, maintenance and use of a database. DBMS can be termed as File Manager that manages data in a database rather than saving it in file systems.
2. What is RDBMS?
RDBMS stands for Relational Database Management System. RDBMS store the data into the collection of tables, which is related by common fields between the columns of the table. It also provides relational operators to manipulate the data stored into the tables.
Example: SQL Server.
3. What is SQL?
SQL stands for Structured Query Language , and it is used to communicate with the Database. This is a standard language used to perform tasks such as retrieval, updation, insertion and deletion of data from a database.
Standard SQL Commands are Select.
4. What is a Database?
Database is nothing but an organized form of data for easy access, storing, retrieval and managing of data. This is also known as structured form of data which can be accessed in many ways.
Example: School Management Database, Bank Management Database.
5. What are tables and Fields?
A table is a set of data that are organized in a model with Columns and Rows. Columns can be categorized as vertical, and Rows are horizontal. A table has specified number of column called fields but can have any number of rows which is called record.
Example:.
Table: Employee.
Field: Emp ID, Emp Name, Date of Birth.
Data: 201456, David, 11/15/1960.
6. What is a primary key?
A primary key is a combination of fields which uniquely specify a row. This is a special kind of unique key, and it has implicit NOT NULL constraint. It means, Primary key values cannot be NULL.
7. What is a unique key?
A Unique key constraint uniquely identified each record in the database. This provides uniqueness for the column or set of columns.
A Primary key constraint has automatic unique constraint defined on it. But not, in the case of Unique Key.
There can be many unique constraint defined per table, but only one Primary key constraint defined per table.
8. What is a foreign key?
A foreign key is one table which can be related to the primary key of another table. Relationship needs to be created between two tables by referencing foreign key with the primary key of another table.
9. What is a join?
This is a keyword used to query data from more tables based on the relationship between the fields of the tables. Keys play a major role when JOINs are used.
10. What are the types of join and explain each?
There are various types of join which can be used to retrieve data and it depends on the relationship between tables.
Inner join.
Inner join return rows when there is at least one match of rows between the tables.
Right Join.
Right join return rows which are common between the tables and all rows of Right hand side table. Simply, it returns all the rows from the right hand side table even though there are no matches in the left hand side table.
Left Join.
Left join return rows which are common between the tables and all rows of Left hand side table. Simply, it returns all the rows from Left hand side table even though there are no matches in the Right hand side table.
Full Join.
Full join return rows when there are matching rows in any one of the tables. This means, it returns all the rows from the left hand side table and all the rows from the right hand side table.
11. What is normalization?
Normalization is the process of minimizing redundancy and dependency by organizing fields and table of a database. The main aim of Normalization is to add, delete or modify field that can be made in a single table.
12. What is Denormalization.
DeNormalization is a technique used to access the data from higher to lower normal forms of database. It is also process of introducing redundancy into a table by incorporating data from the related tables.
13. What are all the different normalizations?
The normal forms can be divided into 5 forms, and they are explained below -.
First Normal Form (1NF):.
This should remove all the duplicate columns from the table. Creation of tables for the related data and identification of unique columns.
Second Normal Form (2NF):.
Meeting all requirements of the first normal form. Placing the subsets of data in separate tables and Creation of relationships between the tables using primary keys.
Third Normal Form (3NF):.
This should meet all requirements of 2NF. Removing the columns which are not dependent on primary key constraints.
Fourth Normal Form (3NF):.
Meeting all the requirements of third normal form and it should not have multi- valued dependencies.
14. What is a View?
A view is a virtual table which consists of a subset of data contained in a table. Views are not virtually present, and it takes less space to store. View can have data of one or more tables combined, and it is depending on the relationship.
15. What is an Index?
An index is performance tuning method of allowing faster retrieval of records from the table. An index creates an entry for each value and it will be faster to retrieve data.
16. What are all the different types of indexes?
There are three types of indexes -.
Unique Index.
This indexing does not allow the field to have duplicate values if the column is unique indexed. Unique index can be applied automatically when primary key is defined.
Clustered Index.
This type of index reorders the physical order of the table and search based on the key values. Each table can have only one clustered index.
NonClustered Index.
NonClustered Index does not alter the physical order of the table and maintains logical order of data. Each table can have 999 nonclustered indexes.
17. What is a Cursor?
A database Cursor is a control which enables traversal over the rows or records in the table. This can be viewed as a pointer to one row in a set of rows. Cursor is very much useful for traversing such as retrieval, addition and removal of database records.
18. What is a relationship and what are they?
Database Relationship is defined as the connection between the tables in a database. There are various data basing relationships, and they are as follows:.
One to One Relationship.
One to Many Relationship.
Many to One Relationship.
Self-Referencing Relationship.
19. What is a query?
A DB query is a code written in order to get the information back from the database. Query can be designed in such a way that it matched with our expectation of the result set. Simply, a question to the Database.
20. What is subquery?
A subquery is a query within another query. The outer query is called as main query, and inner query is called subquery. SubQuery is always executed first, and the result of subquery is passed on to the main query.
21. What are the types of subquery?
There are two types of subquery – Correlated and Non-Correlated.
A correlated subquery cannot be considered as independent query, but it can refer the column in a table listed in the FROM the list of the main query.
A Non-Correlated sub query can be considered as independent query and the output of subquery are substituted in the main query.
22. What is a stored procedure?
Stored Procedure is a function consists of many SQL statement to access the database system. Several SQL statements are consolidated into a stored procedure and execute them whenever and wherever required.
23. What is a trigger?
A DB trigger is a code or programs that automatically execute with response to some event on a table or view in a database. Mainly, trigger helps to maintain the integrity of the database.
Example: When a new student is added to the student database, new records should be created in the related tables like Exam, Score and Attendance tables.
24. What is the difference between DELETE and TRUNCATE commands?
DELETE command is used to remove rows from the table, and WHERE clause can be used for conditional set of parameters. Commit and Rollback can be performed after delete statement.
TRUNCATE removes all rows from the table. Truncate operation cannot be rolled back.
25. What are local and global variables and their differences?
Local variables are the variables which can be used or exist inside the function. They are not known to the other functions and those variables cannot be referred or used. Variables can be created whenever that function is called.
Global variables are the variables which can be used or exist throughout the program. Same variable declared in global cannot be used in functions. Global variables cannot be created whenever that function is called.
26. What is a constraint?
Constraint can be used to specify the limit on the data type of table. Constraint can be specified while creating or altering the table statement. Sample of constraint are.
NOT NULL.
CHECK.
DEFAULT.
UNIQUE.
PRIMARY KEY.
FOREIGN KEY.
27. What is data Integrity?
Data Integrity defines the accuracy and consistency of data stored in a database. It can also define integrity constraints to enforce business rules on the data when it is entered into the application or database.
28. What is Auto Increment?
Auto increment keyword allows the user to create a unique number to be generated when a new record is inserted into the table. AUTO INCREMENT keyword can be used in Oracle and IDENTITY keyword can be used in SQL SERVER.
Mostly this keyword can be used whenever PRIMARY KEY is used.
29. What is the difference between Cluster and Non-Cluster Index?
Clustered index is used for easy retrieval of data from the database by altering the way that the records are stored. Database sorts out rows by the column which is set to be clustered index.
A nonclustered index does not alter the way it was stored but creates a complete separate object within the table. It point back to the original table rows after searching.
30. What is Datawarehouse?
Datawarehouse is a central repository of data from multiple sources of information. Those data are consolidated, transformed and made available for the mining and online processing. Warehouse data have a subset of data called Data Marts.
31. What is Self-Join?
Self-join is set to be query used to compare to itself. This is used to compare values in a column with other values in the same column in the same table. ALIAS ES can be used for the same table comparison.
32. What is Cross-Join?
Cross join defines as Cartesian product where number of rows in the first table multiplied by number of rows in the second table. If suppose, WHERE clause is used in cross join then the query will work like an INNER JOIN.
33. What is user defined functions?
User defined functions are the functions written to use that logic whenever required. It is not necessary to write the same logic several times. Instead, function can be called or executed whenever needed.
34. What are all types of user defined functions?
Three types of user defined functions are.
Scalar Functions.
Inline Table valued functions.
Multi statement valued functions.
Scalar returns unit, variant defined the return clause. Other two types return table as a return.
35. What is collation?
Collation is defined as set of rules that determine how character data can be sorted and compared. This can be used to compare A and, other language characters and also depends on the width of the characters.
ASCII value can be used to compare these character data.
Dynamic or Run time polymorphism is also known as method overriding in which call to an overridden function is resolved during run time, not at the compile time. It means having two or more methods with the same name, same signature but with different implementation.
40. Do we require parameter for constructors?
No, we do not require parameter for constructors.
41. What is a copy constructor?
This is a special constructor for creating a new object as a copy of an existing object. There will be always only on copy constructor that can be either defined by the user or the system.
42. What does the keyword virtual represented in the method definition?
It means, we can override the method.
43. Whether static method can use non static members?
False.
44. What are base class, sub class and super class?
Base class is the most generalized class , and it is set to be a root class.
Sub class is a class that inherits from one or more base classes.
Super class is another type of class from which another class inherits.
45. What is static and dynamic binding?
Binding is nothing but the association of a name with the class. Static binding is a binding in which name can be associated with the class during compilation time , and it is also called as early Binding.
Dynamic binding is a binding in which name can be associated with the class during execution time , and it is also called as Late Binding.
46. How many instances can be created for an abstract class?
Zero instances will be created for an abstract class.
47. Which keyword can be used for overloading?
Operator keyword is used for overloading.
48. What is the default access specifier in a class definition?
Private access specifier is used in a class definition.
49. Which OOPS concept is used as reuse mechanism?
Inheritance is the OOPS concept that can be used as reuse mechanism.
50. Which OOPS concept exposes only necessary information to the calling functions?
Data Hiding / Abstraction
50 More question for sql server
1. What is DBMS?
A Database Management System (DBMS) is a program that controls creation, maintenance and use of a database. DBMS can be termed as File Manager that manages data in a database rather than saving it in file systems.
2. What is RDBMS?
RDBMS stands for Relational Database Management System. RDBMS store the data into the collection of tables, which is related by common fields between the columns of the table. It also provides relational operators to manipulate the data stored into the tables.
Example: SQL Server.
3. What is SQL?
SQL stands for Structured Query Language , and it is used to communicate with the Database. This is a standard language used to perform tasks such as retrieval, updation, insertion and deletion of data from a database.
Standard SQL Commands are Select.
4. What is a Database?
Database is nothing but an organized form of data for easy access, storing, retrieval and managing of data. This is also known as structured form of data which can be accessed in many ways.
Example: School Management Database, Bank Management Database.
5. What are tables and Fields?
A table is a set of data that are organized in a model with Columns and Rows. Columns can be categorized as vertical, and Rows are horizontal. A table has specified number of column called fields but can have any number of rows which is called record.
Example:.
Table: Employee.
Field: Emp ID, Emp Name, Date of Birth.
Data: 201456, David, 11/15/1960.
6. What is a primary key?
A primary key is a combination of fields which uniquely specify a row. This is a special kind of unique key, and it has implicit NOT NULL constraint. It means, Primary key values cannot be NULL.
7. What is a unique key?
A Unique key constraint uniquely identified each record in the database. This provides uniqueness for the column or set of columns.
A Primary key constraint has automatic unique constraint defined on it. But not, in the case of Unique Key.
There can be many unique constraint defined per table, but only one Primary key constraint defined per table.
8. What is a foreign key?
A foreign key is one table which can be related to the primary key of another table. Relationship needs to be created between two tables by referencing foreign key with the primary key of another table.
9. What is a join?
This is a keyword used to query data from more tables based on the relationship between the fields of the tables. Keys play a major role when JOINs are used.
10. What are the types of join and explain each?
There are various types of join which can be used to retrieve data and it depends on the relationship between tables.
Inner join.
Inner join return rows when there is at least one match of rows between the tables.
Right Join.
Right join return rows which are common between the tables and all rows of Right hand side table. Simply, it returns all the rows from the right hand side table even though there are no matches in the left hand side table.
Left Join.
Left join return rows which are common between the tables and all rows of Left hand side table. Simply, it returns all the rows from Left hand side table even though there are no matches in the Right hand side table.
Full Join.
Full join return rows when there are matching rows in any one of the tables. This means, it returns all the rows from the left hand side table and all the rows from the right hand side table.
11. What is normalization?
Normalization is the process of minimizing redundancy and dependency by organizing fields and table of a database. The main aim of Normalization is to add, delete or modify field that can be made in a single table.
12. What is Denormalization.
DeNormalization is a technique used to access the data from higher to lower normal forms of database. It is also process of introducing redundancy into a table by incorporating data from the related tables.
13. What are all the different normalizations?
The normal forms can be divided into 5 forms, and they are explained below -.
First Normal Form (1NF):.
This should remove all the duplicate columns from the table. Creation of tables for the related data and identification of unique columns.
Second Normal Form (2NF):.
Meeting all requirements of the first normal form. Placing the subsets of data in separate tables and Creation of relationships between the tables using primary keys.
Third Normal Form (3NF):.
This should meet all requirements of 2NF. Removing the columns which are not dependent on primary key constraints.
Fourth Normal Form (3NF):.
Meeting all the requirements of third normal form and it should not have multi- valued dependencies.
14. What is a View?
A view is a virtual table which consists of a subset of data contained in a table. Views are not virtually present, and it takes less space to store. View can have data of one or more tables combined, and it is depending on the relationship.
15. What is an Index?
An index is performance tuning method of allowing faster retrieval of records from the table. An index creates an entry for each value and it will be faster to retrieve data.
16. What are all the different types of indexes?
There are three types of indexes -.
Unique Index.
This indexing does not allow the field to have duplicate values if the column is unique indexed. Unique index can be applied automatically when primary key is defined.
Clustered Index.
This type of index reorders the physical order of the table and search based on the key values. Each table can have only one clustered index.
NonClustered Index.
NonClustered Index does not alter the physical order of the table and maintains logical order of data. Each table can have 999 nonclustered indexes.
17. What is a Cursor?
A database Cursor is a control which enables traversal over the rows or records in the table. This can be viewed as a pointer to one row in a set of rows. Cursor is very much useful for traversing such as retrieval, addition and removal of database records.
18. What is a relationship and what are they?
Database Relationship is defined as the connection between the tables in a database. There are various data basing relationships, and they are as follows:.
One to One Relationship.
One to Many Relationship.
Many to One Relationship.
Self-Referencing Relationship.
19. What is a query?
A DB query is a code written in order to get the information back from the database. Query can be designed in such a way that it matched with our expectation of the result set. Simply, a question to the Database.
20. What is subquery?
A subquery is a query within another query. The outer query is called as main query, and inner query is called subquery. SubQuery is always executed first, and the result of subquery is passed on to the main query.
21. What are the types of subquery?
There are two types of subquery – Correlated and Non-Correlated.
A correlated subquery cannot be considered as independent query, but it can refer the column in a table listed in the FROM the list of the main query.
A Non-Correlated sub query can be considered as independent query and the output of subquery are substituted in the main query.
22. What is a stored procedure?
Stored Procedure is a function consists of many SQL statement to access the database system. Several SQL statements are consolidated into a stored procedure and execute them whenever and wherever required.
23. What is a trigger?
A DB trigger is a code or programs that automatically execute with response to some event on a table or view in a database. Mainly, trigger helps to maintain the integrity of the database.
Example: When a new student is added to the student database, new records should be created in the related tables like Exam, Score and Attendance tables.
24. What is the difference between DELETE and TRUNCATE commands?
DELETE command is used to remove rows from the table, and WHERE clause can be used for conditional set of parameters. Commit and Rollback can be performed after delete statement.
TRUNCATE removes all rows from the table. Truncate operation cannot be rolled back.
25. What are local and global variables and their differences?
Local variables are the variables which can be used or exist inside the function. They are not known to the other functions and those variables cannot be referred or used. Variables can be created whenever that function is called.
Global variables are the variables which can be used or exist throughout the program. Same variable declared in global cannot be used in functions. Global variables cannot be created whenever that function is called.
26. What is a constraint?
Constraint can be used to specify the limit on the data type of table. Constraint can be specified while creating or altering the table statement. Sample of constraint are.
NOT NULL.
CHECK.
DEFAULT.
UNIQUE.
PRIMARY KEY.
FOREIGN KEY.
27. What is data Integrity?
Data Integrity defines the accuracy and consistency of data stored in a database. It can also define integrity constraints to enforce business rules on the data when it is entered into the application or database.
28. What is Auto Increment?
Auto increment keyword allows the user to create a unique number to be generated when a new record is inserted into the table. AUTO INCREMENT keyword can be used in Oracle and IDENTITY keyword can be used in SQL SERVER.
Mostly this keyword can be used whenever PRIMARY KEY is used.
29. What is the difference between Cluster and Non-Cluster Index?
Clustered index is used for easy retrieval of data from the database by altering the way that the records are stored. Database sorts out rows by the column which is set to be clustered index.
A nonclustered index does not alter the way it was stored but creates a complete separate object within the table. It point back to the original table rows after searching.
30. What is Datawarehouse?
Datawarehouse is a central repository of data from multiple sources of information. Those data are consolidated, transformed and made available for the mining and online processing. Warehouse data have a subset of data called Data Marts.
31. What is Self-Join?
Self-join is set to be query used to compare to itself. This is used to compare values in a column with other values in the same column in the same table. ALIAS ES can be used for the same table comparison.
32. What is Cross-Join?
Cross join defines as Cartesian product where number of rows in the first table multiplied by number of rows in the second table. If suppose, WHERE clause is used in cross join then the query will work like an INNER JOIN.
33. What is user defined functions?
User defined functions are the functions written to use that logic whenever required. It is not necessary to write the same logic several times. Instead, function can be called or executed whenever needed.
34. What are all types of user defined functions?
Three types of user defined functions are.
Scalar Functions.
Inline Table valued functions.
Multi statement valued functions.
Scalar returns unit, variant defined the return clause. Other two types return table as a return.
35. What is collation?
Collation is defined as set of rules that determine how character data can be sorted and compared. This can be used to compare A and, other language characters and also depends on the width of the characters.
ASCII value can be used to compare these character data.
36. What are all different types of collation sensitivity?
Following are different types of collation sensitivity -.
Case Sensitivity – A and a and B and b.
Accent Sensitivity.
Kana Sensitivity – Japanese Kana characters.
Width Sensitivity – Single byte character and double byte character.
37. Advantages and Disadvantages of Stored Procedure?
Stored procedure can be used as a modular programming – means create once, store and call for several times whenever required. This supports faster execution instead of executing multiple queries. This reduces network traffic and provides better security to the data.
Disadvantage is that it can be executed only in the Database and utilizes more memory in the database server.
38. What is Online Transaction Processing (OLTP)?
Online Transaction Processing or OLTP manages transaction based applications which can be used for data entry and easy retrieval processing of data. This processing makes like easier on simplicity and efficiency. It is faster, more accurate results and expenses with respect to OTLP.
Example – Bank Transactions on a daily basis.
39. What is CLAUSE?
SQL clause is defined to limit the result set by providing condition to the query. This usually filters some rows from the whole set of records.
Example – Query that has WHERE condition
Query that has HAVING condition.
40. What is recursive stored procedure?
A stored procedure which calls by itself until it reaches some boundary condition. This recursive function or procedure helps programmers to use the same set of code any number of times.
41. What is Union, minus and Interact commands?
UNION operator is used to combine the results of two tables, and it eliminates duplicate rows from the tables.
MINUS operator is used to return rows from the first query but not from the second query. Matching records of first and second query and other rows from the first query will be displayed as a result set.
INTERSECT operator is used to return rows returned by both the queries.
42. What is an ALIAS command?
ALIAS name can be given to a table or column. This alias name can be referred in WHERE clause to identify the table or column.
Example-.
Select st.StudentID, Ex.Result from student st, Exam as Ex where st.studentID = Ex. StudentID
Here, st refers to alias name for student table and Ex refers to alias name for exam table.
43. What is the difference between TRUNCATE and DROP statements?
TRUNCATE removes all the rows from the table, and it cannot be rolled back. DROP command removes a table from the database and operation cannot be rolled back.
44. What are aggregate and scalar functions?
Aggregate functions are used to evaluate mathematical calculation and return single values. This can be calculated from the columns in a table. Scalar functions return a single value based on the input value.
Example -.
Aggregate – max(), count – Calculated with respect to numeric.
Scalar – UCASE(), NOW() – Calculated with respect to strings.
45. How can you create an empty table from an existing table?
Example will be -.
Select * into studentcopy from student where 1=2.
Here, we are copying student table to another table with the same structure with no rows copied.
46. How to fetch common records from two tables?
Common records result set can be achieved by -.
Select studentID from student.
Following are different types of collation sensitivity -.
Case Sensitivity – A and a and B and b.
Accent Sensitivity.
Kana Sensitivity – Japanese Kana characters.
Width Sensitivity – Single byte character and double byte character.
37. Advantages and Disadvantages of Stored Procedure?
Stored procedure can be used as a modular programming – means create once, store and call for several times whenever required. This supports faster execution instead of executing multiple queries. This reduces network traffic and provides better security to the data.
Disadvantage is that it can be executed only in the Database and utilizes more memory in the database server.
38. What is Online Transaction Processing (OLTP)?
Online Transaction Processing or OLTP manages transaction based applications which can be used for data entry and easy retrieval processing of data. This processing makes like easier on simplicity and efficiency. It is faster, more accurate results and expenses with respect to OTLP.
Example – Bank Transactions on a daily basis.
39. What is CLAUSE?
SQL clause is defined to limit the result set by providing condition to the query. This usually filters some rows from the whole set of records.
Example – Query that has WHERE condition
Query that has HAVING condition.
40. What is recursive stored procedure?
A stored procedure which calls by itself until it reaches some boundary condition. This recursive function or procedure helps programmers to use the same set of code any number of times.
41. What is Union, minus and Interact commands?
UNION operator is used to combine the results of two tables, and it eliminates duplicate rows from the tables.
MINUS operator is used to return rows from the first query but not from the second query. Matching records of first and second query and other rows from the first query will be displayed as a result set.
INTERSECT operator is used to return rows returned by both the queries.
42. What is an ALIAS command?
ALIAS name can be given to a table or column. This alias name can be referred in WHERE clause to identify the table or column.
Example-.
Select st.StudentID, Ex.Result from student st, Exam as Ex where st.studentID = Ex. StudentID
Here, st refers to alias name for student table and Ex refers to alias name for exam table.
43. What is the difference between TRUNCATE and DROP statements?
TRUNCATE removes all the rows from the table, and it cannot be rolled back. DROP command removes a table from the database and operation cannot be rolled back.
44. What are aggregate and scalar functions?
Aggregate functions are used to evaluate mathematical calculation and return single values. This can be calculated from the columns in a table. Scalar functions return a single value based on the input value.
Example -.
Aggregate – max(), count – Calculated with respect to numeric.
Scalar – UCASE(), NOW() – Calculated with respect to strings.
45. How can you create an empty table from an existing table?
Example will be -.
Select * into studentcopy from student where 1=2.
Here, we are copying student table to another table with the same structure with no rows copied.
46. How to fetch common records from two tables?
Common records result set can be achieved by -.
Select studentID from student.
<strong>INTERSECT </strong>
Select StudentID from Exam.
47. How to fetch alternate records from a table?
Records can be fetched for both Odd and Even row numbers -.
To display even numbers-.
Select studentId from (Select rowno, studentId from student) where mod(rowno,2)=0.
To display odd numbers-.
Select studentId from (Select rowno, studentId from student) where mod(rowno,2)=1.
48. How to select unique records from a table?
Select unique records from a table by using DISTINCT keyword.
47. How to fetch alternate records from a table?
Records can be fetched for both Odd and Even row numbers -.
To display even numbers-.
Select studentId from (Select rowno, studentId from student) where mod(rowno,2)=0.
To display odd numbers-.
Select studentId from (Select rowno, studentId from student) where mod(rowno,2)=1.
48. How to select unique records from a table?
Select unique records from a table by using DISTINCT keyword.
Select DISTINCT StudentID, StudentName from Student.
49. What is the command used to fetch first 5 characters of the string?
There are many ways to fetch first 5 characters of the string -.
Select SUBSTRING(StudentName,1,5) as studentname from student.
There are many ways to fetch first 5 characters of the string -.
Select SUBSTRING(StudentName,1,5) as studentname from student.
Select RIGHT(Studentname,5) as studentname from student.
50. Which operator is used in query for pattern matching?
LIKE operator is used for pattern matching, and it can be used as -.
% – Matches zero or more characters.
_(Underscore) – Matching exactly one character.
Example -.
Select * from Student where studentname like ‘a%’
50. Which operator is used in query for pattern matching?
LIKE operator is used for pattern matching, and it can be used as -.
% – Matches zero or more characters.
_(Underscore) – Matching exactly one character.
Example -.
Select * from Student where studentname like ‘a%’
Select * from Student where studentname like ‘ami_’
50 more Question for web service
1) Define Web Service?
A web service is a kind of software that is accessible on the Internet. It makes use of the XML messaging system and offers an easy to understand, interface for the end users.
2) What is new in this field for past few years?
The initiation of XML in this field is the advancement that provides web service a single language to communicate in between the RPCs, web services and their directories.
3) Give me an example of real web service?
One example of web services is IBM Web Services browser. You can get it from IBM Alphaworks site. This browser shows various demos related to web services. Basically web services can be used with the help of SOAP, WSDL, and UDDI . All these, provide a plug-and-play interface for using web services such as stock-quote service, a traffic-report service, weather service etc.
4) How you define web service protocol stack?
It is basically set of various protocols that can be used to explore and execute web services. The entire stack has four layers i.e. Service Transport, XML Messaging, Service Description and Service Discovery.
5) Can you define each of these layers of protocol stack?
The Service Transport layer transfer messages between different applications, such as HTTP, SMTP, FTP, and Blocks Extensible Exchange Protocol (BEEP). The XML Messaging layer encodes messages in XML format so that messages can be understood at each end, such as XML-RPC and SOAP. The Service Description layer describes the user interface to a web service, such as WSDL. The Service Discovery layer centralizes services to a common registry and offer simple publish functionality, such as UDDI.
6) Define XML – RPC?
It is a protocol that makes use of XML messages to do Remote Procedure Calls.
7) Define SOAP?
SOAP is an XML based protocol to transfer between computers.
8) Define WSDL?
It means Web Services Description Language. It is basically the service description layer in the web service protocol stock. The Service Description layer describes the user interface to a web service.
9) What kind of security is needed for web services?
1) Define Web Service?
A web service is a kind of software that is accessible on the Internet. It makes use of the XML messaging system and offers an easy to understand, interface for the end users.
2) What is new in this field for past few years?
The initiation of XML in this field is the advancement that provides web service a single language to communicate in between the RPCs, web services and their directories.
3) Give me an example of real web service?
One example of web services is IBM Web Services browser. You can get it from IBM Alphaworks site. This browser shows various demos related to web services. Basically web services can be used with the help of SOAP, WSDL, and UDDI . All these, provide a plug-and-play interface for using web services such as stock-quote service, a traffic-report service, weather service etc.
4) How you define web service protocol stack?
It is basically set of various protocols that can be used to explore and execute web services. The entire stack has four layers i.e. Service Transport, XML Messaging, Service Description and Service Discovery.
5) Can you define each of these layers of protocol stack?
The Service Transport layer transfer messages between different applications, such as HTTP, SMTP, FTP, and Blocks Extensible Exchange Protocol (BEEP). The XML Messaging layer encodes messages in XML format so that messages can be understood at each end, such as XML-RPC and SOAP. The Service Description layer describes the user interface to a web service, such as WSDL. The Service Discovery layer centralizes services to a common registry and offer simple publish functionality, such as UDDI.
6) Define XML – RPC?
It is a protocol that makes use of XML messages to do Remote Procedure Calls.
7) Define SOAP?
SOAP is an XML based protocol to transfer between computers.
8) Define WSDL?
It means Web Services Description Language. It is basically the service description layer in the web service protocol stock. The Service Description layer describes the user interface to a web service.
9) What kind of security is needed for web services?
Web Services
The security level for web services should be more than that of what we say Secure Socket Layer (SSL). This level of security can be only achieved from Entrust Secure Transaction Platform. Web services need this level of security to ensure reliable transactions and secure confidential information .
10) Do you have any idea about foundation security services?
As implies from its name, these services are the foundation or basics of integration, authentication, authorization, digital signatures and encryption processes.
11) Define Entrust Identification Service?
Entrust Identification Service comes from the Entrust Security Transaction Platform. This platform allows companies to control the identities that are trusted to perform transactions for Web services transactions.
12) What UDDI means?
UDDI stands for Universal, Description, Discovery, and Integration. It is the discovery layer in the web services protocol stack.
13) Define Entrust Entitlements Service?
This service verifies entities that attempt to access a web service. For Example, the authentication service, the Entitlements Service ensures security in business operations.
14) Define Entrust Privacy Service?
As its name implies, it deals with security and confidentiality. This service encrypts data to ensure that only concerned parties can access the data.
15) What do you mean by PKI?
It means Public-Key Infrastructure.
16) What tools are used to test a web service?
I have used SoapUI for SOAP WS and Firefox poster plugin for RESTFul Services.
17) Differentiate between a SOA and a Web service?
SOA is a design and architecture to implement other services. SOA can be easily implemented using various protocols such as HTTP, HTTPS, JMS, SMTP, RMI, IIOP, RPC etc. While Web service, itself is an implemented technology. In fact one can implement SOA using the web service.
18) Discuss various approaches to develop SOAP based web service?
We can develop SOAP based web service with two different types of approaches such as contract-first and contract-last. In the first approach, the contract is defined first and then the classes are derived from the contract while in the later one, the classes are defined first and then the contract is derived from these classes.
19) If you have to choose one approach, then what will be your choice?
In my point of view, the first approach that is the contract-first approach is more feasible as compared to the second one but still it depends on other factors too.
20) Is there any special application required to access web service?
No, you don’t need to install any special application to access web service. You can access web service from any application that supports XML based object request and response.
21) Can you name few free and commercial implementations for web services?
The implementations I know are Apache SOAP, JAX-WS Reference Implementation, JAX-RS Reference Implementation, Metro, Apache CXF, MS.NET and Java 6.
22) Name browser that allows access to web service?
JavaScript XmlHttpRequest object is required to access web service via browsers. The browsers that support this object are Internet Explorer, Safari and Mozilla-based browsers like FireFox.
23) What is REST?
REST stands for Representational State Transfer. REST itself is not a standard, while it uses various standards such as HTTP, URL, XML/HTML/GIF/JPEG (Resource Representations) and text/xml, text/html, image/gif, image/jpeg, etc (MIME Types).
24) How one can provide API to users?
To provide an API to the users, one can easily do this with an “open table”. All you need to do is to write open table which is basically an XML schema that point to a web service.
25) Name the various communication channels in web service?
Web service is integrated with three protocols such as HTTP/POST, HTTP/GET, and SOAP. It provides three different communication channels to clients. Client can choose any communication method as per requirements.
26) How can you document web service?
Web services are contemplated as self-documenting because they provide entire information regarding the available methods and parameters used for XML based standard, known as WSDL. One can also provide more information to explain web services via their own WebService and WebMethod attributes.
27) What are the situations, when we need ASP.NET web services?
ASP.NET web services are used when one need to implement three tier architecture in a web service. It allows handy ways to use middle tier components through internet. The main advantage of .NET Web services is that they are capable enough to communicate across firewalls because they use SOAP as transport protocol.
28) What are distributed technologies?
The increasing ratio of distributed applications has raised demand for distributed technologies. It allows segmenting of application units and transferring them to different computers on different networks.
29) Differentiate between web services, CORBA and DCOM?
Web services transfer/receive messages to/from application respectively, via HTTP protocol. It uses XML to encode data.
CORBA and DCOM transfer/receive messages to/from application respectively, via non-standard protocols such as IIOP and RPC.
30) Can you tell few benefits of web services?
The biggest advantage of web service is that is supported by wide variety of platforms. Moreover, in near future, web services may spread its boundary and enhance new methods that will provide ease to clients. The enhancement will not affect the clients, even if they offer old methods and parameters.
31) Can you name some standards used in web services?
The standards used in web services are WSDL (used to create interface definition), SOAP (used to structure data), HTTP (communication channels), DISCO (used to create discovery documents) and UDDI (used to create business registries).
32) Explain in brief, what DISCO is?
DISCO means discovery. It groups the list of interrelated web services. The organization that provides web services, issues a DISCO file on its server and that file contains the links of all the provided web services. This standard is good when client knows the company already. Also it can be used within a local network as well.
33) Explain in brief, what UDDI is?
UDDI (Universal Description, Discovery, and Integration) provides consolidated directory for web services on the internet. Clients use UDDI to find web services as per their business needs. It basically hosts the web services from various companies. In order to share web services, you need to publish it in UDDI.
34) Explain the .NET web services supported data types?
.Net web services uses XML-based standards to transfer/receive information. Thus, .NET web services can only works with data types known by XML schema standard. Like FileSteam, Eventlog etc. are not recognized by the XML schema standards and hence, not supported in web services.
35) How a .NET web service is tested?
ASP.NET uses a test page routinely, when one calls for the URL of .asmx file in any browser. This page shows complete information regarding web services.
36) How a .NET web service is consumed?
Since we know that web services are constructed on XML standards. Therefore, clients need to have complete understanding of XML-based messages to interchange messages. Clients can communicate with web services through .NET framework that offers proxy mechanisms. These proxy mechanisms have detailed information regarding data sharing within web services that can be easily used by the clients.
37) Can you name the two Microsoft solutions for distributed applications?
The two Microsoft solutions for distributed applications are .NET Web Services and .NET Remoting.
38) Differentiate between .NET Web Services and .NET Remoting?
As far as protocol is concerned, .NET Web Service uses HTTP, while, .NET Remoting uses any protocol i.e. TCP/HTTP/SMTP. When it comes to performance, .NET Remoting is comparatively, faster than.NET Web Service. Also, as .NET Web Services are hosted via IIS, therefore, it is far more reliable than the .NET Remoting.
39) Name the components to be published while deploying a Web Service?
The components that need to be published during a web service deployment are Web Application Directory, Webservice.asmx File, Webservice.Disco File, Web.Config File and Bin Directory.
40) What are the steps performed by the client to access a web service?
First of all a web reference to the web service is created by the client in his application. Then a proxy class is generated. After that an object of the proxy class is created and at last, the web service is accessed via that proxy object.
41) How web services are implemented in .NET?
To implement web services in .NET, HTTP handlers are used that interrupt requests to .asmx files.
42) Explain few disadvantages of Response Caching?
Response Caching is useless or incompetent when method accepts extensive amount of values because caching means to store lot of information. Also, if the method depends on external source of information, and that are not provided within the parameters then such methods are bypassed.
43) What is the alternate solution to Response Caching?
One can use Data Caching (System.Web.Caching.Cach) instead of Response Caching.
44) Brief few drawbacks of using GET and POST methods to communicate with the web service?
These methods are less secure and inhibit users to pass structures and objects as arguments. Also, it doesn’t allow users to pass ByRef arguments.
45) How can one access a class as a web service?
To access a class as a web service, one should inherit the class from the System.Web.Services.WebService class and qualify the class with the WebService attribute.
46) How can one access the web service class method via internet?
To access web service class method via internet, one should qualify a method with the WebMethod attribute.
47) How a SOAP message is structured?
A SOAP message is consists of SOAP Envelope, SOAP Headers, and SOAP Body.
48) Can you name different kinds of web services?
There are two types of web services in total i.e. SOAP based web service and RESTful web service.
This question is already mentioned earlier.
49) What’s different in RESTful web services?
The RESTful web services contains no contract or WSDL file.
50) Give me few reasons to use RESTful web service?
The RESTFul web services are simple to implement and test. It supports various data formats such as XML, JSON etc.
The security level for web services should be more than that of what we say Secure Socket Layer (SSL). This level of security can be only achieved from Entrust Secure Transaction Platform. Web services need this level of security to ensure reliable transactions and secure confidential information .
10) Do you have any idea about foundation security services?
As implies from its name, these services are the foundation or basics of integration, authentication, authorization, digital signatures and encryption processes.
11) Define Entrust Identification Service?
Entrust Identification Service comes from the Entrust Security Transaction Platform. This platform allows companies to control the identities that are trusted to perform transactions for Web services transactions.
12) What UDDI means?
UDDI stands for Universal, Description, Discovery, and Integration. It is the discovery layer in the web services protocol stack.
13) Define Entrust Entitlements Service?
This service verifies entities that attempt to access a web service. For Example, the authentication service, the Entitlements Service ensures security in business operations.
14) Define Entrust Privacy Service?
As its name implies, it deals with security and confidentiality. This service encrypts data to ensure that only concerned parties can access the data.
15) What do you mean by PKI?
It means Public-Key Infrastructure.
16) What tools are used to test a web service?
I have used SoapUI for SOAP WS and Firefox poster plugin for RESTFul Services.
17) Differentiate between a SOA and a Web service?
SOA is a design and architecture to implement other services. SOA can be easily implemented using various protocols such as HTTP, HTTPS, JMS, SMTP, RMI, IIOP, RPC etc. While Web service, itself is an implemented technology. In fact one can implement SOA using the web service.
18) Discuss various approaches to develop SOAP based web service?
We can develop SOAP based web service with two different types of approaches such as contract-first and contract-last. In the first approach, the contract is defined first and then the classes are derived from the contract while in the later one, the classes are defined first and then the contract is derived from these classes.
19) If you have to choose one approach, then what will be your choice?
In my point of view, the first approach that is the contract-first approach is more feasible as compared to the second one but still it depends on other factors too.
20) Is there any special application required to access web service?
No, you don’t need to install any special application to access web service. You can access web service from any application that supports XML based object request and response.
21) Can you name few free and commercial implementations for web services?
The implementations I know are Apache SOAP, JAX-WS Reference Implementation, JAX-RS Reference Implementation, Metro, Apache CXF, MS.NET and Java 6.
22) Name browser that allows access to web service?
JavaScript XmlHttpRequest object is required to access web service via browsers. The browsers that support this object are Internet Explorer, Safari and Mozilla-based browsers like FireFox.
23) What is REST?
REST stands for Representational State Transfer. REST itself is not a standard, while it uses various standards such as HTTP, URL, XML/HTML/GIF/JPEG (Resource Representations) and text/xml, text/html, image/gif, image/jpeg, etc (MIME Types).
24) How one can provide API to users?
To provide an API to the users, one can easily do this with an “open table”. All you need to do is to write open table which is basically an XML schema that point to a web service.
25) Name the various communication channels in web service?
Web service is integrated with three protocols such as HTTP/POST, HTTP/GET, and SOAP. It provides three different communication channels to clients. Client can choose any communication method as per requirements.
26) How can you document web service?
Web services are contemplated as self-documenting because they provide entire information regarding the available methods and parameters used for XML based standard, known as WSDL. One can also provide more information to explain web services via their own WebService and WebMethod attributes.
27) What are the situations, when we need ASP.NET web services?
ASP.NET web services are used when one need to implement three tier architecture in a web service. It allows handy ways to use middle tier components through internet. The main advantage of .NET Web services is that they are capable enough to communicate across firewalls because they use SOAP as transport protocol.
28) What are distributed technologies?
The increasing ratio of distributed applications has raised demand for distributed technologies. It allows segmenting of application units and transferring them to different computers on different networks.
29) Differentiate between web services, CORBA and DCOM?
Web services transfer/receive messages to/from application respectively, via HTTP protocol. It uses XML to encode data.
CORBA and DCOM transfer/receive messages to/from application respectively, via non-standard protocols such as IIOP and RPC.
30) Can you tell few benefits of web services?
The biggest advantage of web service is that is supported by wide variety of platforms. Moreover, in near future, web services may spread its boundary and enhance new methods that will provide ease to clients. The enhancement will not affect the clients, even if they offer old methods and parameters.
31) Can you name some standards used in web services?
The standards used in web services are WSDL (used to create interface definition), SOAP (used to structure data), HTTP (communication channels), DISCO (used to create discovery documents) and UDDI (used to create business registries).
32) Explain in brief, what DISCO is?
DISCO means discovery. It groups the list of interrelated web services. The organization that provides web services, issues a DISCO file on its server and that file contains the links of all the provided web services. This standard is good when client knows the company already. Also it can be used within a local network as well.
33) Explain in brief, what UDDI is?
UDDI (Universal Description, Discovery, and Integration) provides consolidated directory for web services on the internet. Clients use UDDI to find web services as per their business needs. It basically hosts the web services from various companies. In order to share web services, you need to publish it in UDDI.
34) Explain the .NET web services supported data types?
.Net web services uses XML-based standards to transfer/receive information. Thus, .NET web services can only works with data types known by XML schema standard. Like FileSteam, Eventlog etc. are not recognized by the XML schema standards and hence, not supported in web services.
35) How a .NET web service is tested?
ASP.NET uses a test page routinely, when one calls for the URL of .asmx file in any browser. This page shows complete information regarding web services.
36) How a .NET web service is consumed?
Since we know that web services are constructed on XML standards. Therefore, clients need to have complete understanding of XML-based messages to interchange messages. Clients can communicate with web services through .NET framework that offers proxy mechanisms. These proxy mechanisms have detailed information regarding data sharing within web services that can be easily used by the clients.
37) Can you name the two Microsoft solutions for distributed applications?
The two Microsoft solutions for distributed applications are .NET Web Services and .NET Remoting.
38) Differentiate between .NET Web Services and .NET Remoting?
As far as protocol is concerned, .NET Web Service uses HTTP, while, .NET Remoting uses any protocol i.e. TCP/HTTP/SMTP. When it comes to performance, .NET Remoting is comparatively, faster than.NET Web Service. Also, as .NET Web Services are hosted via IIS, therefore, it is far more reliable than the .NET Remoting.
39) Name the components to be published while deploying a Web Service?
The components that need to be published during a web service deployment are Web Application Directory, Webservice.asmx File, Webservice.Disco File, Web.Config File and Bin Directory.
40) What are the steps performed by the client to access a web service?
First of all a web reference to the web service is created by the client in his application. Then a proxy class is generated. After that an object of the proxy class is created and at last, the web service is accessed via that proxy object.
41) How web services are implemented in .NET?
To implement web services in .NET, HTTP handlers are used that interrupt requests to .asmx files.
42) Explain few disadvantages of Response Caching?
Response Caching is useless or incompetent when method accepts extensive amount of values because caching means to store lot of information. Also, if the method depends on external source of information, and that are not provided within the parameters then such methods are bypassed.
43) What is the alternate solution to Response Caching?
One can use Data Caching (System.Web.Caching.Cach) instead of Response Caching.
44) Brief few drawbacks of using GET and POST methods to communicate with the web service?
These methods are less secure and inhibit users to pass structures and objects as arguments. Also, it doesn’t allow users to pass ByRef arguments.
45) How can one access a class as a web service?
To access a class as a web service, one should inherit the class from the System.Web.Services.WebService class and qualify the class with the WebService attribute.
46) How can one access the web service class method via internet?
To access web service class method via internet, one should qualify a method with the WebMethod attribute.
47) How a SOAP message is structured?
A SOAP message is consists of SOAP Envelope, SOAP Headers, and SOAP Body.
48) Can you name different kinds of web services?
There are two types of web services in total i.e. SOAP based web service and RESTful web service.
This question is already mentioned earlier.
49) What’s different in RESTful web services?
The RESTful web services contains no contract or WSDL file.
50) Give me few reasons to use RESTful web service?
The RESTFul web services are simple to implement and test. It supports various data formats such as XML, JSON etc.
C# interview questions and answers
What’s the advantage of using System.Text.StringBuilder over System.String? StringBuilder is more efficient in the cases, where a lot of manipulation is done to the text. Strings are immutable, so each time it’s being operated on, a new instance is created.
What’s the advantage of using System.Text.StringBuilder over System.String? StringBuilder is more efficient in the cases, where a lot of manipulation is done to the text. Strings are immutable, so each time it’s being operated on, a new instance is created.
Can you store multiple data types in System.Array? No.
What’s the difference between the System.Array.CopyTo() and System.Array.Clone()? The first one performs a deep copy of the array, the second one is shallow.
How can you sort the elements of the array in descending order? By calling Sort() and then Reverse() methods.
What’s the .NET datatype that allows the retrieval of data by a unique key? HashTable.
What’s class SortedList underneath? A sorted HashTable.
Will finally block get executed if the exception had not occurred? Yes.
What’s the C# equivalent of C++ catch (…), which was a catch-all statement for any possible exception? A catch block that catches the exception of type System.Exception. You can also omit the parameter data type in this case and just write catch {}.
Can multiple catch blocks be executed? No, once the proper catch code fires off, the control is transferred to the finally block (if there are any), and then whatever follows the finally block.
Why is it a bad idea to throw your own exceptions? Well, if at that point you know that an error has occurred, then why not write the proper code to handle that error instead of passing a new Exception object to the catch block? Throwing your own exceptions signifies some design flaws in the project.
What’s a delegate? A delegate object encapsulates a reference to a method. In C++ they were referred to as function pointers.
What’s a multicast delegate? It’s a delegate that points to and eventually fires off several methods.
How’s the DLL Hell problem solved in .NET? Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32), but also the version of the assembly.
What are the ways to deploy an assembly? An MSI installer, a CAB archive, and XCOPY command.
What’s a satellite assembly? When you write a multilingual or multi-cultural application in .NET, and want to distribute the core application separately from the localized modules, the localized assemblies that modify the core application are called satellite assemblies.
What namespaces are necessary to create a localized application? System.Globalization, System.Resources.
What’s the difference between // comments, /* */ comments and /// comments? Single-line, multi-line and XML documentation comments.
How do you generate documentation from the C# file commented properly with a command-line compiler? Compile it with a /doc switch.
What’s the difference between <c> and <code> XML documentation tag? Single line code example and multiple-line code example.
Is XML case-sensitive? Yes, so <Student> and <student> are different elements.
What debugging tools come with the .NET SDK? CorDBG – command-line debugger, and DbgCLR – graphic debugger. Visual Studio .NET uses the DbgCLR. To use CorDbg, you must compile the original C# file using the /debug switch.
What does the This window show in the debugger? It points to the object that’s pointed to by this reference. Object’s instance data is shown.
What does assert() do? In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false. The program proceeds without any interruption if the condition is true.
What’s the difference between the Debug class and Trace class? Documentation looks the same. Use Debug class for debug builds, use Trace class for both debug and release builds.
Why are there five tracing levels in System.Diagnostics.TraceSwitcher? The tracing dumps can be quite verbose and for some applications that are constantly running you run the risk of overloading the machine and the hard drive there. Five levels range from None to Verbose, allowing to fine-tune the tracing activities.
Where is the output of TextWriterTraceListener redirected? To the Console or a text file depending on the parameter passed to the constructor.
How do you debug an ASP.NET Web application? Attach the aspnet_wp.exe process to the DbgClr debugger.
What are three test cases you should go through in unit testing? Positive test cases (correct data, correct output), negative test cases (broken or missing data, proper handling), exception test cases (exceptions are thrown and caught properly).
Can you change the value of a variable while debugging a C# application? Yes, if you are debugging via Visual Studio.NET, just go to Immediate window.
Explain the three services model (three-tier application). Presentation (UI), business (logic and underlying code) and data (from storage or other sources).
What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET? SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft. OLE-DB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix, but it’s a .NET layer on top of OLE layer, so not the fastest thing in the world. ODBC.NET is a deprecated layer provided for backward compatibility to ODBC engines.
What’s the role of the DataReader class in ADO.NET connections? It returns a read-only dataset from the data source when the command is executed.
What is the wildcard character in SQL? Let’s say you want to query database with LIKE for all employees whose name starts with La. The wildcard character is %, the proper query with LIKE would involve ‘La%’.
Explain ACID rule of thumb for transactions. Transaction must be Atomic (it is one unit of work and does not dependent on previous and following transactions), Consistent (data is either committed or roll back, no “in-between” case where something has been updated and something hasn’t), Isolated (no transaction sees the intermediate results of the current transaction), Durable (the values persist if the data had been committed even if the system crashes right after).
What connections does Microsoft SQL Server support? Windows Authentication (via Active Directory) and SQL Server authentication (via Microsoft SQL Server username and passwords).
Which one is trusted and which one is untrusted? Windows Authentication is trusted because the username and password are checked with the Active Directory, the SQL Server authentication is untrusted, since SQL Server is the only verifier participating in the transaction.
Why would you use untrusted verificaion? Web Services might use it, as well as non-Windows applications.
What does the parameter Initial Catalog define inside Connection String? The database name to connect to.
What’s the data provider name to connect to Access database? Microsoft.Access.
What does Dispose method do with the connection object? Deletes it from the memory.
What is a pre-requisite for connection pooling? Multiple processes must agree that they will share the same connection, where every parameter is the same, including the security settings.
What’s the difference between the System.Array.CopyTo() and System.Array.Clone()? The first one performs a deep copy of the array, the second one is shallow.
How can you sort the elements of the array in descending order? By calling Sort() and then Reverse() methods.
What’s the .NET datatype that allows the retrieval of data by a unique key? HashTable.
What’s class SortedList underneath? A sorted HashTable.
Will finally block get executed if the exception had not occurred? Yes.
What’s the C# equivalent of C++ catch (…), which was a catch-all statement for any possible exception? A catch block that catches the exception of type System.Exception. You can also omit the parameter data type in this case and just write catch {}.
Can multiple catch blocks be executed? No, once the proper catch code fires off, the control is transferred to the finally block (if there are any), and then whatever follows the finally block.
Why is it a bad idea to throw your own exceptions? Well, if at that point you know that an error has occurred, then why not write the proper code to handle that error instead of passing a new Exception object to the catch block? Throwing your own exceptions signifies some design flaws in the project.
What’s a delegate? A delegate object encapsulates a reference to a method. In C++ they were referred to as function pointers.
What’s a multicast delegate? It’s a delegate that points to and eventually fires off several methods.
How’s the DLL Hell problem solved in .NET? Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32), but also the version of the assembly.
What are the ways to deploy an assembly? An MSI installer, a CAB archive, and XCOPY command.
What’s a satellite assembly? When you write a multilingual or multi-cultural application in .NET, and want to distribute the core application separately from the localized modules, the localized assemblies that modify the core application are called satellite assemblies.
What namespaces are necessary to create a localized application? System.Globalization, System.Resources.
What’s the difference between // comments, /* */ comments and /// comments? Single-line, multi-line and XML documentation comments.
How do you generate documentation from the C# file commented properly with a command-line compiler? Compile it with a /doc switch.
What’s the difference between <c> and <code> XML documentation tag? Single line code example and multiple-line code example.
Is XML case-sensitive? Yes, so <Student> and <student> are different elements.
What debugging tools come with the .NET SDK? CorDBG – command-line debugger, and DbgCLR – graphic debugger. Visual Studio .NET uses the DbgCLR. To use CorDbg, you must compile the original C# file using the /debug switch.
What does the This window show in the debugger? It points to the object that’s pointed to by this reference. Object’s instance data is shown.
What does assert() do? In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false. The program proceeds without any interruption if the condition is true.
What’s the difference between the Debug class and Trace class? Documentation looks the same. Use Debug class for debug builds, use Trace class for both debug and release builds.
Why are there five tracing levels in System.Diagnostics.TraceSwitcher? The tracing dumps can be quite verbose and for some applications that are constantly running you run the risk of overloading the machine and the hard drive there. Five levels range from None to Verbose, allowing to fine-tune the tracing activities.
Where is the output of TextWriterTraceListener redirected? To the Console or a text file depending on the parameter passed to the constructor.
How do you debug an ASP.NET Web application? Attach the aspnet_wp.exe process to the DbgClr debugger.
What are three test cases you should go through in unit testing? Positive test cases (correct data, correct output), negative test cases (broken or missing data, proper handling), exception test cases (exceptions are thrown and caught properly).
Can you change the value of a variable while debugging a C# application? Yes, if you are debugging via Visual Studio.NET, just go to Immediate window.
Explain the three services model (three-tier application). Presentation (UI), business (logic and underlying code) and data (from storage or other sources).
What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET? SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft. OLE-DB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix, but it’s a .NET layer on top of OLE layer, so not the fastest thing in the world. ODBC.NET is a deprecated layer provided for backward compatibility to ODBC engines.
What’s the role of the DataReader class in ADO.NET connections? It returns a read-only dataset from the data source when the command is executed.
What is the wildcard character in SQL? Let’s say you want to query database with LIKE for all employees whose name starts with La. The wildcard character is %, the proper query with LIKE would involve ‘La%’.
Explain ACID rule of thumb for transactions. Transaction must be Atomic (it is one unit of work and does not dependent on previous and following transactions), Consistent (data is either committed or roll back, no “in-between” case where something has been updated and something hasn’t), Isolated (no transaction sees the intermediate results of the current transaction), Durable (the values persist if the data had been committed even if the system crashes right after).
What connections does Microsoft SQL Server support? Windows Authentication (via Active Directory) and SQL Server authentication (via Microsoft SQL Server username and passwords).
Which one is trusted and which one is untrusted? Windows Authentication is trusted because the username and password are checked with the Active Directory, the SQL Server authentication is untrusted, since SQL Server is the only verifier participating in the transaction.
Why would you use untrusted verificaion? Web Services might use it, as well as non-Windows applications.
What does the parameter Initial Catalog define inside Connection String? The database name to connect to.
What’s the data provider name to connect to Access database? Microsoft.Access.
What does Dispose method do with the connection object? Deletes it from the memory.
What is a pre-requisite for connection pooling? Multiple processes must agree that they will share the same connection, where every parameter is the same, including the security settings.