ASP.Net, JAVA, PHP, Android, C, C++, C#, DFS, DBMS, SQL Server | 1 Asp.Net Question With Answer 1. What is ASP.NET? ASP.NET is a server side scripting technology that enables scripts (embedded in web pages) to be executed by an Internet server. ASP.NET provides increased performance by running compiled code. 2. What is the difference between Classic ASP and ASP.Net? ASP is Interpreted language based on scripting languages like Jscript or VBScript. ASP has Mixed HTML and coding logic. Limited development and debugging tools available. Limited OOPS support. Limited session and application state management. ASP.Net is supported by compiler and has compiled language support. Separate code and design logic possible. Variety of compilers and tools available including the Visual studio.Net. Completely Object Oriented. Complete session and application state management. Full XML Support for easy data exchange. 3. What is Difference between Namespace and Assembly? Namespace is a logical design-time naming convenience, whereas an assembly establishes the name scope for types at run time. 4. What is the difference between early binding and late binding? Calling a non-virtual method, decided at a compile time is known as early binding. Calling a virtual method (Pure Polymorphism), decided at a runtime is known as late binding. 5. What is the difference between ASP Session State and ASP.Net Session State?
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Output Caching: stores the responses from an asp.net page. Fragment Caching: Only caches/stores the portion of page (User Control) Data Caching: is Programmatic way to Cache objects for performance.
26. . What is Side-by-Side Execution?
The CLR allows any versions of the same-shared DLL (shared assembly) to
execute at the same time, on the same system, and even in the same process. This
concept is known as side-by-side execution.
27. How to view an assembly?
We can use the tool "ildasm.exe" known as "Assembly Disassembler" to view the
assembly.
28. Which are the namespaces that are imported automatically by Visual
Studio in ASP.Net?
There are 7 namespaces which are imported automatically.
36. What data type does the RangeValidator control support?
Integer
String.
Date.
37. What is cookies?
Cookies are small pieces of text, stored on the client’s computer to be used only by the website setting the cookies. This allows webapplications to save information
for the user, and then re-use it on each page if needed
38. How many classes can a single .NET DLL contain?
It can contain many classes.
39. What methods are fired during the page load?
Init() - when the page is instantiated.
Load() - when the page is loaded into server memory. PreRender() - the brief moment before the page is displayed to the user as
HTML. Unload() - when page finishes loading.
40. What is the difference between Value Types and Reference Types?
Value Types uses Stack to store the data.
where as Reference type uses the Heap to store the data.
41. What is the difference between Server-side scripting and Client-side scripting?
Server side scripting means that all the script will be executed by the server and
interpreted as needed. ASP doesn't have some of the functionality like sockets, uploading, etc. Client side scripting means that the script will be executed immediately in the
browser such as form field validation, clock, email validation, etc. Client side scripting is usually done in VBScript or JavaScript.
42. How do you create a permanent cookie?
Permanent cookies are available until a specified expiration date, and are stored
on the hard disk.So Set the 'Expires' property any value greater than DataTime.MinValue with respect to the current datetime. If u want the cookie which
never expires set its Expires property equal to DateTime.maxValue.
43. Which method do you use to redirect the user to another page without
performing a round trip to the client?
Server.Transfer Server.Execute.
44. Which method do you use to redirect the user to another page without
performing a round trip to the client?
Server.transfer
45. What tag do you use to add a hyperlink column to the DataGrid? < asp:HyperLinkColumn > < / asp:HyperLinkColumn >
46. What is web.config file?
Web.config file is the configuration file for the Asp.net web application. There is
one web.config file for one asp.net application which configures the particular application. Web.config file is written in XML with specific tags having specific
meanings.It includes databa which includes connections,Session States,Error Handling,Security etc.
47. What is the difference between in-proc and out-of-proc?
An Inproc is one which runs in the same process area as that of the client giving
tha advantage of speed but the disadvantage of stability becoz if it crashes it takes the client application also with it. Outproc is one which works outside the clients memory thus giving stability to the
client, but we have to compromise a bit on speed.
48. What is a PostBack?
The process in which a Web page sends data back to the same page on the server.
49. How many languages .NET is supporting now?
When .NET was introduced it came with several languages. VB.NET, C#, COBOL and Perl, etc. The site DotNetLanguages.Net says 44 languages are supported.
50. What is smart navigation?
The cursor position is maintained when the page gets refreshed due to the server
side validation and the page gets refreshed.
51. How do you validate the controls in an ASP .NET page?
Using special validation controls that are meant for this. We have Range Validator, Email Validator
52. How do you turn off cookies for one page in your site?
Use Cookie.Discard property, Gets or sets the discard flag set by the server. When true, this property instructs the client application not to save the Cookie on the user's hard disk when a session ends.
53. Which two properties are on every validation control?
We have two common properties for every validation controls:
Control to Validate Error Message
54. Which control would you use if you needed to make sure the values in
two different controls matched?
CompareValidator is used to ensure that two fields are identical.
55. What is the difference between HTTP-Post and HTTP-Get?
The GET method creates a query string and appends it to the script's URL on the server that handles the request.
The POST method creates a name/value pairs that are passed in the body of the HTTP request message.
56. What is strong-typing versus weak-typing?
Strong typing implies that the types of variables involved in operations are
associated to the variable, checked at compile-time, and require explicit conversion Weak typing implies that they are associated to the value, checked at run-time,
and are implicitly converted as required.
57. What is boxing and unboxing?
Implicit conversion of value type to reference type of a variable is known as BOXING, for example integer to object type conversion.
Conversion of reference type variable back to value type is called as UnBoxing.
58. What is garbage collection?
Garbage collection is a system whereby a run-time component takes responsibility for managing the lifetime of objects and the heap memory that they occupy.
Serialization is the process of converting an object into a stream of bytes. Deserialization is the opposite process of creating an object from a stream of bytes.
Serialization / Deserialization is mostly used to transport objects.
60. What is the differnce between Managed code and unmanaged code?
Managed Code: Code that runs under a "contract of cooperation" with the common language runtime. Managed code must supply the metadata necessary for
the runtimeto provide services such as memory management, cross-language integration, code access security, and automatic lifetime control of objects. All code
based on Microsoft intermediate language (MSIL) executes as managed code. Un-Managed Code:Code that is created without regard for the conventions and
requirements of the common language runtime. Unmanaged code executes in the common language runtime environment with minimal services (for example, no
garbage collection, limited debugging, and so on).
61. What is difference between constants, readonly and, static?
Constants: The value can’t be changed.
Read-only: The value will be initialized only once from the constructor of the class.
Static: Value can be initialized once.
62. What is namespace used for loading assemblies at run time and name the methods?
System.Reflection
63. How big is the datatype int in .NET?
32 bits
64. What is difference between abstract classes and interfaces?
Abstract classes can have concrete methods while interfaces have no methods implemented. Interfaces do not come in inheriting chain, while abstract classes come in
inheritance.
65. In which event are the controls fully loaded?
Page_load event guarantees that all controls are fully loaded. Controls are also accessed.
In Page_Init events but you will see that viewstate is not fully loaded during this event.
@Register directive informs the compiler of any custom server control added to the page.
67. Define RequiredFieldValidator?
It checks whether the control have any value. It's used when you want the control should not be empty.
68. What are the different types of Session state management options
available with ASP.NET?
ASP.NET provides In-Process and Out-of-Process state management. In-Process stores the session in memory on the web server. Out-of-Process Session state management stores data in an external data source. The external data source may
be either a SQL Server or a State Server service. Out-of-Process state management requires that all objects stored in session are serializable.
69. What are the difference between const and readonly?
A const can not be static, while readonly can be static. A const need to be declared and initialized at declaration only, while a
readonly can be initialized at declaration or by the code in the constructor. A const’s value is evaluated at design time, while a readonly’s value is
evaluated at runtime.
70. How do you turn off cookies in one page of your asp.net application?
We may not use them at the max, However to allow the cookies or not, is client side functionality.
71. What’s the difference between Response.Write () and
Response.Output.Write()?
Response.Outout.Write allows us to write the formatted out put.
72. What is the difference between inline and code behind?
Inline code written along with the html and design blocks in an .aspx page.
Code-behind is code written in a separate file (.cs or .vb) and referenced by the
.aspx page.
73. What is the difference between early binding and late binding?
Server side code is executed at the server side on IIS in ASP.NET framework. while client side code is executed on the browser.
100. What’s an interface?
It’s an abstract class with public abstract methods all of which must be
implemented in the inherited classes.
101. What is a formatter?
A formatter is an object that is responsible for encoding and serializing data into
messages on one end, and deserializing and decoding messages into data on the
other end.
102. What is Marshalling?
Marshaling is a process of making an object in one process (the server)
available to another process (the client). There are two ways to achieve the marshalling.
Marshal by value Marshal by reference.
103. What is a Static class?
Static class is a class which can be used or accessed without creating an instance
of the class.
104. What is a DataSet?
A DataSet is an in memory representation of data loaded from any data source.
105. What are the differences between value type and reference type?
Value type contain variable and reference type are not containing value directly in its memory.
Memory is allocated in managed heap in reference type and in value type memory allocated in stack. Reference type ex-class value type-struct, enumeration
106. What is a DataTable?
A DataTable is a class in .NET Framework and in simple words a DataTable object
represents a table from a database.
107. What is a life span of a static variable?
A static variable’s life span is till the class is in memory
Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.
Data in a DataSet is bulk-loaded, rather than being loaded on demand. You can store many edits in a DataSet, and write them to the original data
source in a single operation.
122. What are the validation controls?
A set of server controls included with ASP.NET that test user input in HTML and Web server controls for programmer-defined requirements. Validation controls
perform input checking in server code. If the user is working with a browser that supports DHTML, the validation controls can also perform validation using client script.
123. What is the difference between “Web.config” and “Machine.Config”?
“Web.config” files apply settings to each web application. While “Machine.config” file apply settings to all ASP.NET applications.
124. What is event bubbling?
Server controls like Data grid, Data List, and Repeater can have other child controls inside them. Example Data Grid can have combo box inside data grid.
These child control do not raise there events by themselves, rather they pass the event to the container parent (which can be a data grid, data list, repeater), which
passed to the page as “ItemCommand” event. As the child control send events to parent it is termed as event bubbling.
125. What is the use of @ Register directives?
@Register directive informs the compiler of any custom server control added to the
page.
126. Where is View State information stored?
In HTML Hidden Fields.
127. What is role based security?
By default, ASP.NET will store the session state in the same process that processes the request, just as ASP does. If cookies are not available, a session can be tracked
by adding a session identifier to the URL.
128. What is the difference between Asp and Asp.net?
ASP (Active Server Pages) and ASP.NET are both server side technologies for building web sites and web applications, ASP.NET is Managed compiled code - asp
is interpreted. and ASP.net is fully Object oriented. ASP.NET has been entirely re-architected to provide a highly productive
programming experience based on the .NET Framework, and a robust infrastructure for building reliable and scalable web applications.
129. What are the various security methods which IIS Provides apart from
.NET? The various security methods which IIS provides are :
Authentication Modes. IP Address and Domain Name Restriction. DNS Lookups DNS Lookups. Though the DataSet is universal, other objects in ADO.NET come in different
versions for different data sources. The Network ID and Subnet Mask.
SSL.
130. What are Master Pages in ASP.NET?
ASP.NET master pages allow you to create a consistent layout for the pages in your application. A single master page defines the look and feel and standard behavior
that you want for all of the pages in your application. You can then create individual content pages that contain the content you want to display. When users request the content pages, they merge with the master page to produce output that combines
the layout of the master page with the content from the content page.
131. What are the advantages of ASP.Net?
ASP.NET makes development simpler and easier to maintain with an event-driven, server-side programming model.
ASP.NET offers built-in security features through windows authentication or other authentication methods.
Content and program logic are separated which reduces the inconveniences of program maintenance.
Built-in caching features.
132. What is event bubbling?
Server controls like Data grid, Data List, and Repeater can have other child
controls inside them. Example Data Grid can have combo box inside data grid. These child control do not raise there events by themselves, rather they pass the
event to the container parent (which can be a data grid, data list, repeater), which passed to the page as “ItemCommand” event. As the child control send events to
WSDL stands for Web Services Description Language is an XML-based language for describing Web services and how to access them.
WSDL is used to describe Web services.
134. What is the use of @ Register directives?
@Register directive informs the compiler of any custom server control added to the page.
135. What is the difference between javascript and vbscript?
Javascript : JavaScript is a client-side scripting language. JavaScript is used to create interactive web applications supported by the Netscape
browser. JavaScript is simple to use, lightweight, and dynamic. Developers can easily embed
code functionality for interactive applications inside a web page. Javascript is case sensitive and it will be run on client side. VBScript:
VBScript is a server-side scripting language. VBScript is not case sensitive and it will be run on server side.
136. What is a web server?
A web server delivers requested web pages to users who enter the URL in a web
browser. Every computer on the Internet that contains a web site must have a web server program.
137. What are Cascading style sheets?
Cascading style sheets (CSS) collect and organize all of the formatting
information applied to HTML elements on a Web form. Because they keep this information in a single location, style sheets make it easy to adjust the appearance of Web applications.
138. What is the base class of .net?
System.object
139. What is the base class of Asp.net?
system.Web.UI
140. what is use of web.config?
Web.config is used connect database from front end to back end. Web.config is used to maintain the Appsettimgs instead of static variables.
141. What is difference between abstract classes and interfaces?
Abstract classes can have concrete methods while interfaces have no methods implemented.
Interfaces do not come in inheriting chain, while abstract classes come in inheritance.
142. What is GAC or Global Assembly Cache?
Global Assembly Cache (GAC) is a common place to share the .NET assemblies
across many applications. GAC caches all strong named assembly references within it. All System assemblies that come with the .NET framework reside in the GAC.
143. What is a HashTable?
The Hashtable object contains items in key/value pairs. The keys are used as
indexes, and very quick searches can be made for values by searching through their keys.
144. What is CAS or Code Access Security?
Code Access Security - CAS is the part of the .NET security model that
determines whether or not a piece of code is allowed to run, and what resources it can use when it is running.
145. What is the Composite Custom Control?
Combination of existing HTML and Server Controls.
146. What is RangeValidator?
RangeValidator - checks whether a value falls within a given range of number, date
or string.
147. What base class do all Web Forms inherit from?
System.web.UI.Page class
148. What is the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.
Cookie are one of several ways to store data about web site visitors during the time when web server and browser are not connected. Common use of cookies is to
remember users between visits. Practically, cookie is a small text file sent by web server and saved by web browser on client machine.
The“Response.Cookies” command is used to create cookies.
150. How do you identify a Master Page?
The master page is identified by a special @ Master directive that replaces the @ Page directive that is used for ordinary .aspx pages.
151. Explain what a diffgram is and a good use for one?
The DiffGram is one of the two XML formats that you can use to render DataSet
object contents to XML. For reading database data to an XML file to be sent to a Web Service.
152. What is ValidationSummary?
ValidationSummary - It show a summary of errors raised by each control on the
page on a specific spot or in a message box.
153. How do you indentify that the page is post back?
By checking the IsPostBack property. If IsPostBack is True, the page has been posted back.
154. what are the types of ASP Objects?
There are various types of Asp objects
Session Object Application Object
Server Object Request Object Request Object
Response Object Object Context
Error Object
155. What are remotable objects in .NET Remoting?
Remotable objects are the objects that can be marshaled across the application
domains. You can marshal by value, where a deep copy of the object is created and
then passed to the receiver. You can also marshal by reference, where just a
reference to an existing object is passed.
156. What is the difference between ASP Session and ASP.NET Session?