Microsoft Visual Studio
Microsoft ASP.NET Official Site
 
 
 
 

Interview Questions - ASP.NET

1.        Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process.
inetinfo.exe is theMicrosoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension),the ISAPI filter aspnet_isapi.dll takes care of it by passing the request tothe actual worker process aspnet_wp.exe.

2.        What’s the difference between Response.Write() andResponse.Output.Write()?
The latter one allows you to write formattedoutput. 0

3.        What methods are fired during the page load?
Init() - when the pageis instantiated, Load() - when the page is loaded into server memory,PreRender() - the brief moment before the page is displayed to the user asHTML, Unload() - when page finishes loading.

4.        Where does the Web page belong in the .NET Framework class hierarchy?
System.Web.UI.Page

5.        Where do you store the information about the user’s locale?
System.Web.UI.Page.Culture

6.        What’s the difference between Codebehind="MyCode.aspx.cs" andSrc="MyCode.aspx.cs"?
CodeBehind is relevant to Visual Studio.NET only.

7.        What’s a bubbled event?
When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents.

8.        Suppose you want a certain ASP.NET function executed on MouseOver overa certain button. Where do you add an event handler?
It’s the Attributesproperty, the Add function inside that property. So btnSubmit.Attributes.Add("onMouseOver","someClientCode();")

9.        What data type does the RangeValidator control support?
Integer,String and Date.

10.    Explain the differences between Server-side and Client-side code? 
Server-side code runs on the server. Client-side code runs in the clients’ browser.

11.    What type of code (server or client) is found in a Code-Behind class?
Server-side code.

12.    Should validation (did the user enter a real date) occur server-side or client-side? Why? Client-side. This reduces an additional request to the server to validate the users input.

13.    What does the "EnableViewState" property do? Why would I want it on or off? 
It enables the viewstate on the page. It allows the page to save the users input on a form.

14.    What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?
Server.Transfer is used to post a form to another page. Response.Redirect is used to redirect the user to another page or site.   3

15.    Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?

·         A DataSet can represent an entire relational database in memory, complete with tables, relations, and views.

·         A DataSet is designed to work without any continuing connection to the original data source.

·         Data in a DataSet is bulk-loaded, rather than being loaded on demand.

·         There's no concept of cursor types in a DataSet.

·         DataSets have no current record pointer You can use For Each loops to move through the data.

·         You can store many edits in a DataSet, and write them to the original data source in a single operation.

·         Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.

16.    Can you give an example of what might be best suited to place in the Application_Start and Session_Start subroutines? 
This is where you can set the specific variables for the Application and Session objects.

17.    If I’m developing an application that must accommodate multiple security levels though secure login and my ASP.NET web application is spanned across three web-servers (using round-robin load balancing) what would be the best approach to maintain login-in state for the users?
Maintain the login state security through a database.

18.    Can you explain what inheritance is and an example of when you might use it?
When you want to inherit (use the functionality of) another class. Base Class Employee. A Manager class could be derived from the Employee base class.

19.    Whats an assembly? 
Assemblies are the building blocks of the .NET framework. Overview of assemblies from MSDN

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

21.    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.

22.    Whats MSIL, and why should my developers need an appreciation of it if at all?
MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL.

23.    Which method do you invoke on the DataAdapter control to load your generated dataset with data?
The .Fill() method

24.    Can you edit data in the Repeater control?  
No, it just reads the information from its data source

25.    Which template must you provide, in order to display data in a Repeater control?
ItemTemplate

26.    How can you provide an alternating color scheme in a Repeater control?
Use the AlternatingItemTemplate

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

28.    What base class do all Web Forms inherit from?  
The Page class.

29.    Name two properties common in every validation control?
ControlToValidate property and Text property.

30.    What tags do you need to add within the asp:datagrid tags to bind columns manually?
Set AutoGenerateColumns Property to false on the datagrid tag

31.    What tag do you use to add a hyperlink column to the DataGrid?
<asp:HyperLinkColumn>

32.    What is the transport protocol you use to call a Web service?
SOAP is the preferred protocol.

33.    True or False: A Web service can only be written in .NET?
False

34.    What does WSDL stand for?
(Web Services Description Language)

35.    Where on the Internet would you look for Web services?
http://www.uddi.org

36.    Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box?
DataTextField property

37.    Which control would you use if you needed to make sure the values in two different controls matched?  
CompareValidator Control

38.    True or False: To test a Web service you must create a windows application or Web application to consume this service?
False, the webservice comes with a test page and it provides HTTP-GET method to test.

39.    How many classes can a single .NET DLL contain?  
It can contain many classes.
_____________________________________________________________________________
 

40.     How big is the datatype int in .NET?
32 bits.

41.     How big is the char?
16 bits (Unicode).

42.     How do you initiate a string without escaping each backslash?
Put an @ sign in front of the double-quoted string.

43.     What are valid signatures for the Main function?
1.       public static void Main()
2.       public static int Main()
3.       public static void Main( string[] args )
4.       public static int Main(string[] args )

44.     Does Main() always have to be public?
No.

45.     How do you initialize a two-dimensional array that you don’t know the dimensions of?
1.       int [, ] myArray; //declaration
2.       myArray= new int [5, 8]; //actual initialization

46.     What’s the access level of the visibility type internal?
Current assembly.

47.     What’s the difference between struct and class in C#? 
1.       Structs cannot be inherited.
2.       Structs are passed by value, not by reference.
3.       Struct is stored on the stack, not the heap.

48.     Explain encapsulation.
The implementation is hidden, the interface is exposed.

49.     What data type should you use if you want an 8-bit value that’s signed?
sbyte.

50.     Speaking of Boolean data types, what’s different between C# and C/C++?
There’s no conversion between 0 and false, as well as any other number and true, like in C/C++.

51.     Where are the value-type variables allocated in the computer RAM?
Stack.

52.     Where do the reference-type variables go in the RAM?
The references go on the stack, while the objects themselves go on the heap. However, in reality things are more elaborate.

53.     What is the difference between the value-type variables and reference-type variables in terms of garbage collection?
The value-type variables are not garbage-collected, they just fall off the stack when they fall out of scope, the reference-type objects are picked up by GC when their references go null.

54.     How do you convert a string into an integer in .NET?
Int32.Parse(string), Convert.ToInt32()    (3)

55.     How do you box a primitive data type variable?
Initialize an object with its value, pass an object, cast it to an object

56.     Why do you need to box a primitive variable?
To pass it by reference or apply a method that an object supports, but primitive doesn’t.

57.     What’s the difference between Java and .NET garbage collectors?
Sun left the implementation of a specific garbage collector up to the JRE developer, so their performance varies widely, depending on whose JRE you’re using. Microsoft standardized on their garbage collection. 0

58.     How do you enforce garbage collection in .NET?
System.GC.Collect();    3

59.     Can you declare a C++ type destructor in C# like ~MyClass()?
Yes, but what’s the point, since it will call Finalize(), and Finalize() has no guarantees when the memory will be cleaned up, plus, it introduces additional load on the garbage   collector. The only time the finalizer should be implemented, is when you’re dealing with unmanaged code.  (5)

60.     What’s different about namespace declaration when comparing that to package declaration in Java?
No semicolon. Package declarations also have to be the first thing within the file, can’t be nested, and affect all classes within the file.

61.     What’s the difference between const and readonly? You can initialize readonly variables to some runtime values. Let’s say your program uses current date and time as one of the values that won’t change. This way you declare

1.        public readonly string DateT = new DateTime().ToString().

62.     Can you create enumerated data types in C#?
Yes.  5

63.     What’s different about switch statements in C# as compared to C++?
No fall-throughs allowed.

64.     What happens when you encounter a continue statement inside the for loop?
The code for the rest of the loop is ignored, the control is transferred back to the beginning of the loop.

65.     Is goto statement supported in C#? How about Java?
Gotos are supported in C#to the fullest. In Java goto is a reserved keyword that provides absolutely no functionality.   5

66.     Describe the compilation process for .NET code?
Source code is compiled and run in the .NET Framework using a two-stage process. First, source code is compiled to Microsoft intermediate language (MSIL) code using a .NET Framework-compatible compiler, such as that for Visual Basic .NET or Visual C#. Second, MSIL code is compiled to native code. ---(4)

67.     Name any 2 of the 4 .NET authentification methods.
ASP.NET, in conjunction with Microsoft Internet Information Services (IIS), can authenticate user credentials such as names and passwords using any of the following authentication methods:

1.       Windows: Basic, digest, or Integrated Windows Authentication (NTLM or Kerberos).
2.       Microsoft Passport authentication                        
3.       Forms authentication
4.       Client Certificate authentication ---

68.     How do you turn off SessionState in the web.config file?
In the system.web section of web.config, you should locate the httpmodule tag and you simply disable session by doing a remove tag with attribute name set to session.

1.        <httpModules>
<remove name="Session” />  mode =off
</httpModules>    0

69.     What is main difference between Global.asax and Web.Config?
ASP.NET uses the global.asax to establish any global objects that your Web application uses. The .asax extension denotes an application file rather than .aspx for a page file. Each ASP.NET application can contain at most one global.asax file. The file is compiled on the first page hit to your Web application. ASP.NET is also configured so that any attempts to browse to the global.asax page directly are rejected. However, you can specify application-wide settings in the web.config file. The web.config is an XML-formatted text file that resides in the Web site’s root directory. Through Web.config you can specify settings like custom 404 error pages, authentication and authorization settings for the Web site, compilation options for the ASP.NET Web pages, if tracing should be enabled, etc.  3

70.     What do you know about .NET assemblies?
Assemblies are the smallest units of versioning and deployment in the .NET application. Assemblies are also the building blocks for programs such as Web services, Windows services, serviced components, and .NET remoting applications.

71.     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.

72.     What is SOAP and how does it relate to XML?
The Simple Object Access Protocol (SOAP) uses XML to define a protocol for the exchange of information in distributed computing environments. SOAP consists of three components: an envelope, a set of encoding rules, and a convention for representing remote procedure calls. Unless experience with SOAP is a direct requirement for the open position, knowing the specifics of the protocol, or how it can be used in conjunction with HTTP, is not as important as identifying it as a natural application of XML.

73.     Using XSLT, how would you extract a specific attribute from an element in an XML document?
Successful candidates should recognize this as one of the most basic applications of XSLT. If they are not able to construct a reply similar to the example below, they should at least be able to identify the components necessary for this operation: xsl:template to match the appropriate XML element, xsl:value-of to select the attribute value, and the optional xsl:apply-templates to continue processing the document.  (2)

74.     What are the core protocols/standards behind XML Web services?
XML (for message format), HTTP and others (for transport), WSDL (Web Service Definition Language, to describe the Web services and define the contract), and UDDI (Universal Description, Discovery and Integration, to dynamically discover and invoke Web services).  

  Designed & Developed by Gangor Creations

 

1