You are on page 1of 17

NET WebDev interview questions - Part 1

1. Which of the following languages is NOT included in the default .NET

Framework installation?
o C#
o JScript.NET
o VBScript.NET
2. What are the different types of serialization supported in .NET Framework
o XmlSerializer
o SoapFormatter
o XPathNavigator
o HttpFormatter
3. The CLR uses which format for assembly version numbers
o Major:Minor:Revision:Build
o Major:Build:Minor:Revision
o Major:Revision:Minor:Build
o Major:Minor:Build:Revision
4. What tool is used to manage the GAC?
o GacMgr.exe
o GacSvr32.exe
o GacUtil.exe
o RegSvr.exe
5. State True or False: A single .NET dll can contain unlimited classes
o True
o False
6. State True or False: ASP.NET can currently run only on Windows Platform
o True
o False
7. Which one of the following best describes “Type-Safe”
o It ensures that the data type are safely handled
o It ensures that types are not mismatched when they are called so uses a
typecasting before referencing any data object
o It ensures that an object only references memory locations that it’s
allowed to, preventing data corruption and the accidental misuse of object
o All of the above
8. The number of objects in ASP.NET is
o 6
o 7
o 9
o 10
9. The code used to turn off buffering is
o Buffering = false
o OutputBuffer = false
o BufferOutput = false
o Buffer = Off
10. Can you have two applications on the same machine one which is using .NET
Framework 1.1 and the other using 2.0 ?
o Yes
o No
o Depends on System configuration
11. Which of the following DOT.NET tools manages certificates, certificate trust lists
(CTLs), and certificate revocation lists (CRLs)?
o sn.exe
o certnet.exe
o certmgr.exe
o gacutil.exe
12. You need to generate a public/private key pair for using in creating a shared
assembly. Given the above scenario, which .NET SDK utility should be used?
o certmgr.exe
o gacutil.exe
o sn.exe
o resgen.exe
13. The object that contains all the properties and methods for every ASP.NET page,
that is built is
o Page Object
o HTTPPage Object
o WebPage Object
o System.Web.UI.Page
14. In C#, which character is used to indicate a verbatim string literal?
o @
o !
o "
o #
15. Which of the following operators has the highest precedence?
o Pre Increment (++x)
o Shift bits left: <<
o Bitwise Or: |
o Post Increment (x++)
16. The uniqueId that gets generated at the start of the Session is stored in
o Client computer as a cookie
o Server machine
o Passed to and fro on each and every request and response
o Both a and b are correct
17. State True or False: C# supports multiple-inheritance
o True
o False
18. Bitwise AND operator in C# is
o &
o &&
19. Bitwise OR operator in C# is
o OR
o ||
o |
20. What’s the .NET datatype that allows the retrieval of data by a unique key?
o Primary
o Integer
o Unique Identifier
o HashTable
21. The keyword ‘int’ maps to one of the following .NET types
o System.Int16
o System.Int32
o System.Int64
o System.Int128
22. What can be achieved in IL which is not possible in C# ?
o Creation of an ArrayList
o Creation of a Dictionary
o Creation of a two dimensional array
o Creation of a non-zero based array
23. Which of the following is the correct code for setting a Session timeout of 30
o Session.Timeout = 108000
o Session.Timeout = 1800
o Session.Timeout = 300
o Session.Timeout = 30
24. The process that ASP.NET uses to keep track of Sessions without cookies is
o Cookie Munging
o Cookie Monking
o Cookie Mocking
o Cookie Munching
25. The method that transfers ASP.NET execution to another page, but returns to the
original page when it is done is
o Server.Transfer()
o Server.Redirect()
o Server.Execute()
o Server.Return()

.NET WebDev interview questions - Part 2

1. A structure in C# can be derived from one or more

o class
o interface
o both
o none
2. State True or False: Static method cannot be overridden
o True
o False
3. The Equivalent HTML Control for the <input type=”button”> tag is
o HtmlInput
o HtmlButton
o HtmlPushButton
o HtmlInputButton
4. The Equivalent Html Control for the <input type=”checkbox”> tag is
o HtmlCheckBox
o HtmlInputChkBox
o HtmlInputCheckBox
o HtmlInputTypeChkBox
5. Which operator is used for connecting a event with a procedure in C#?
o +=
o =
o both
o none
6. The Equivalent Html Control for the <select> tag is
o <HtmlSelectInput>
o <HtmlSelect>
o <HtmlInputSelect>
o <HtmlSelectControl>
7. State True or False: Events in Web forms are processed before the “Page Load”
o True
o False
8. What namespaces are necessary to create a localized application?
o System.Globalization
o System.Globalization and System.Resources.
o System.Resources.
o System.Array
9. A new server-side control can be created by implementing the class ___________
o System.Web.WebControl
o System.Web.UI.WebControl
o System.Web.UI.WebControls.WebControl
o Any one of the above
10. The parameter “clienttarget = downlevel” does one of the following
o Adds aliases for specific user agents to an internal collection of user agent
o Indicates the useragents level of validating the controls
o Disables all DHTML events(including Validation controls)
o None of the above
11. The methods in C# can be overloaded in which of the following ways
o By having the same method name and specifying different number of
o By giving different method names and same number of parameters
o By having the same method name and specifying different types of
o By giving different method names and same types of parameters
12. The RangeValidator control supports the following datatype
o Integer and String
o Integer, Float, String, XMLDatatypes
o Integer, String and Date
o Integer, Boolean, Short, String and Date
13. What is the difference between Convert.ToInt32 and int.Parse?
o Both are same and both can handle null value.
o Convert.ToInt32 can handle null value but int.Parse throws
ArgumentNullException error.
o int.Parse can handle null value but Convert.ToInt32 throws
ArgumentNullException error.
o Both Convert.ToInt32 and int.Parse cannot handle null value.
14. State True or False: Any ODBC-compliant database can be accessed through
o True
o False
15. You need to select a .NET language that has auto-documenting features built into
the source code and compiler. Given the scenario above what language compiler
should be selected?
o vbc.exe
o cl.exe
o ilasm.exe
o cs.exe
16. A set of tables are maintained in a Dataset as
o TablesCollection object
o DataTableCollection object
o DataRowsCollection object
o TableRowCollection object
17. The namespaces needed to use data mechanisms in ASP.NET pages are
o System.Data, System.Data.OleDb or System.Data.SQL
o System.Data, System.Data.ODBC
o System.Data, System.Data.DataRow
o System.Data.DataRowCollection, System.Data.DbType
18. What are the different methods to access Database in .NET ?
o OleDB,ODBC,SQLClient
o OleDB, JDBC, SQLServer
o ODBC-JDBC, DataSet, SQLClient
o Datasource, DataSet, DSN
19. The two properties of a DataGrid that has to be specified to turn on sorting and
paging respectively are
o EnableSorting = “true” and EnablePaging = “true”
o DisableSorting = “false” and DisablePaging = “false”
o AllowSorting = “true” and AllowPaging = “true”
o Sorting = “true” and Paging = “true”
20. Which one of the following objects is used to create a foreign key between two
o DataRelation
o DataRelationship
o DataConstraint
o DataKey
21. The Syntax for data-binding expressions is
o <%# property or collection %>
o <%# property or collection #%>
o <%$ property or collection %>
o <%@ property or collection %>
22. The method that need to be invoked on the DataAdapter control to load the
generated dataset with data is
o Bind()
o Fill()
o FillData()
o SetData()
23. Which of the following operations can you NOT perform on an ADO.NET
o A DataSet can be synchronised with the database.
o A DataSet can be synchronised with a RecordSet.
o A DataSet can be converted to XML.
o You can infer the schema from a DataSet
24. Which is the correct statement to set the alias name for namespace in C#?
o using System Data.OracleClient = aliasName;
o using aliasName = System.Data.OracleClient;
o string aliasName = using.System.Data.OracleClient;
o Both a & b
25. The property that indicates whether existing database constraints should be
observed when performing updates
o EnforceConstraints
o Constraints
o GetConstraints
o ConstraintsEnforce

.NET WebDev interview questions - Part 3

1. State True or False: If you set AutoGenerateColumns=True and still provide custom
column definitions, the DataGrid will render both
o True
o False
2. The data from an XSL Transform with XmlReader can be returned in one of the
following ways
o objReader = objXslT.Transform(objNav, nothing)
o objXslT.Transform(objNav, nothing)
o objReader = objXslT.Transform(objNav, nothing, objWriter)
o objXslT.Transform(objNav, nothing, objWriter)
3. Pick the command line that would result in the C# compiler generating an XML
documentation file
o csc /doc:NewHome.xml NewHome.cs
o c /doc /docfile: NewHome.xml NewHome.cs
o csc /doc /out: NewHome.xml NewHome.cs
o csc /xml NewHome.cs
4. What is the comment syntax for C#’s XML-based documentation?
o /** and **/
o //#
o ///
o //*
5. When creating a C# Class Library project, what is the name of the supplementary
file that Visual Studio.NET creates that contains General Information about the
o AssemblyInfo.xml
o AssemblyInfo.cs
o AssemblyInformation.cs
o AssemblyAttributes.cs
6. Which of the following is the C# escape character for Null?
o \n
o \0
o \f
o \v
7. What is the exception that is thrown when there is an attempt to dynamically
access a method that does not exist?
o MissingMethodException
o TypeLoadException
o MethodLoadException
o MethodAccessException
8. What method(s) must be used with the Application object to ensure that only one
process accesses a variable at a time?
o Synchronize()
o Lock() and UnLock()
o Lock()
o Asynchroize()
9. After capturing the SelectedIndexChanged event for a ListBox control, you find
that the event handler doesn’t execute. What could the problem be?
o The AutoEventWireup attribute is set to False
o The AutomaticPostBack attribute is set to False
o The codebehind module is not properly compiled
o The ListBox must be defined WithEvents
10. What method must be overridden in a custom control?
o The Paint() method
o The Control_Build() method
o The Render() method
o The default constructor
11. What is used to validate complex string patterns like an e-mail address?
o Extended expressions
o Regular expressions
o Irregular expressions
o Basic expressions
12. The following is a valid statement in ASP.NET<%@ Page Language="C" %>
o True
o False
13. A valid comment block in ASP.NET is
o <!- - - Comment - - - >
o <!- - Comment - - >
o <% - - Comment - - %>
o <% ! - - Comment - - >
14. The event handlers that can be included in the Global.asax file are
o Application Start and
Session Start event handlers only
o Application End and
Session End event handlers only
o Per-request and Non-deterministic event handlers only
o Application Start and End ,
Session Start and End, Per-request and Non-deterministic event handlers
15. A Few of the Namespaces that get imported by default in an ASPX file are
o System, System.Data, System.Drawing,
o System,
System.IO, System.Management, System.Globalization
o System, System.Collections,
System.Text, System.Web
o System,
System.Reflection, System.Web
16. The Assemblies that can be referenced in an ASPX file without using @Assembly
Directive is
o System.dll, System.Data.dll,
System.Web.dll, System.Xml.dll,
o System.dll,
System.Collections.dll, System.IO.dll
o System.dll, System.Reflection.dll,
o System.Drawing.dll, System.Assembly.dll,
17. An .ASHX file contains the following
o Code-behind that are used in the code
o Server Controls that can be called from a code-behind file
o HTTP handlers-software modules that handle raw HTTP requests received
o Contains normal ASP.NET code and can be used as an include file
18. What is the output for the following code snippet:
19. public class testClass
20. {
21. public static void Main(string[] args)
22. {
23. System.Console.WriteLine(args[1]);
24. }//end Main
}//end class testClass

o Compiler Error
o Runtime Error
o Hello C# world
o None of the above
25. One of the possible way of writing an ASP.NET handler that works like an ISAPI
filter- that is, that sees requests and responses and modifies them also, is by,
o writing a module that extends FormsAuthenticatonModule and using it
o writing a component class that extends HttpModuleCollection and using it
o writing an HTTP module-a Class that implements IhttpModule and
registering it in Web.Config
o All of the above
26. The ASP.NET directive that lets you cache different versions of a page based on
varying input parameters, HTTP headers and browser type is
o @OutputCache
o @CacheOutput
o @PageCache
o @CacheAll
27. If we develop an application that must accommodate multiple security levels
through secure login and 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?
o <SessionState mode="InProc"stateConnectionString="
tcpip=" sqlConnectionString=" data source=;user
id=sa;password="cookieless="false" timeout="30" />
o <SessionState mode="OutProc"
sqlConnectionString="data source=;user id=sa;password="
cookieless="false" timeout="30" />
o <SessionState mode="stateserver"
sqlConnectionString="data source=;user id=sa;password="
cookieless="false" timeout="30" />
28. What is the output for the below mentioned compilation command>csc
/addmodule:A.Exe B.Cs
o A.exe
o B.exe
o A.dll
o B.dll
29. How can be the web application get configured with the following authorization
o Anonymous users must not be allowed to access the application.
o All persons except David and John must be allowed to access the
 <authorization><deny users = "applicationname\David,
applicationname\John" ><allow roles ="*"><deny roles =
 <authorization><allow users ="*"><deny users =
"applicationname\David; applicationname\John" ><deny users =
 <authorization><deny users = "applicationname\David,
applicationname\John" ><deny users = "?"><allow users
 <authorization><allow users ="*"><deny users =
"applicationname\David, applicationname\John" ></authorization>
30. What will be the output of the following code snippet?
31. using System;
32. class MainClass
33. {
34. static void Main( )
35. {
36. new MainClass().Display( 3.56 );
37. }
39. private void Display( float anArg )
40. {
41. Console.Write( “{0} {1}”, anArg.GetType(),
anArg );
42. }
44. double Display( double anArg )
45. {
46. Console.Write( “{0} {1}”, anArg.GetType(),
anArg );
47. return anArg;
48. }
50. public decimal Display( decimal anArg )
51. {
52. Console.Write( “{0} {1}”, anArg.GetType(),
anArg ); return anArg;
53. }
54. }
o System.Single 3.56
o System.Float 3.56
o System.Double 3.56
o System.Decimal 3.56
55. What will be output for the given code?
56. Dim I as integer = 5
57. Do
58. I = I + 2
59. Response.Write (I & " ")
60. Loop Until I > 10
o 58
o 579
o 7 9 11
o Errors out

.NET database dev questions

1. To test a Web Service you must create a windows application or web application
to consume this service? It is True/False?
2. How many classes can a single.NET DLL contain?
3. What are good ADO.NET object(s) to replace the ADO Recordset object?
4. On order to get assembly info which namespace we should import?
5. How do you declare a static variable and what is its lifetime? Give an example.
6. How do you get records number from 5 to 15 in a dataset of 100 records? Write
7. How do you call and execute a Stored Procedure in.NET? Give an example.
8. What is the maximum length of a varchar in SQL Server?
9. How do you define an integer in SQL Server?
10. How do you separate business logic while creating an ASP.NET application?
11. If there is a calendar control to be included in each page of your application, and
and we do not intend to use the Microsoft-provided calendar control, how do you
develop it? Do you copy and paste the code into each and every page of your
12. How do you debug an ASP.NET application?
13. How do you deploy an ASP.NET application?
14. Explain similarities and differences between Java and.NET?
15. Specify the best ways to store variables so that we can access them in various
pages of ASP.NET application?
16. What are theXML files that are important in developing an ASP.NET application?
17. What are theXML files that are important in developing an ASP.NET application?
18. What is XSLT and what is its use?
19. How many objects are there in ASP?
20. Which DLL file is needed to be registered for ASP?
21. Is there any inbuilt paging (for example shoping cart, which will show next 10
records without refreshing) in ASP? How will you do pating?
22. What does Server.MapPath do?
23. Name atleast three methods of response object other than Redirect.
24. Name atleast two methods of response object other than Transfer.
25. What is State?
26. Explain differences between ADO and DAO.
27. How many types of cookies are there?
28. Tell few steps for optimizing (for speed and resource) ASP page/application.
29. Which command using Query Analyzer will give you the version of SQL Server
and Operating System?
30. Using query analyzer, name 3 ways you can get an accurate count of the number
of records in a table.
31. What is the purpose of using COLLATE in a query?
32. What is one of the first things you would do to increase performance of a query?
For example, a boss tells you that “a query that ran yesterday took 30 seconds, but
today it takes 6 minutes”?
33. What is an execution plan? When would you use it? How would you view the
execution plan?
34. What is the STUFF function and how does it differ from the REPLACE function?
35. What does it mean to have quoted_identifier on? What are the implications of
having it off?
36. What are the different type of replication? How are they used?
37. What is the difference between a Local temporary table and a Global temporary
table? How is each one used?
38. What are cursors? Name four type of cursors and when each one would be
39. What is the purpose of UPDATE STATISTICS?
40. How do you use DBCC statements to monitor various ASPects of a SQL Server
41. How do SQL Server 2000 andXML linked? What is SQL Server agent?
42. What is referential integrity and how can we achieve it?
43. What is indexing?
44. Explain differences between server.transfer and server.execute method?
45. What is de-normalization? When do you do it and how?
46. Explain features of SQL Server like Scalibility, Availability, Integration with
47. What is DataWarehousing?
48. What is OLAP?
49. How do we upgrade SQL Server 7.0 to 2000?
50. What is job?
51. What is Task?
52. How would you update the rows which are divisible by 10, given a set of numbers
in column?
53. How do you find the error, how can you know the number of rows affected by last
SQL Statement?
54. What are the advantages/disadvantages of viewstate?
55. Describe session handling in webform. How does it work and what are the limits?
56. Explain differences between framework 1.0 and framework 1.1
57. If we write any code for dataGrid methods, what is the access specifier used for
that methods in the code behind file and why and how? Give an example.
58. What is the use of trace utility?
59. What are the differences between User control and Web control and Custom
60. If I have more than one version of one assemblies, then how will I use old version
in my application? Give an example.
61. How do you create threadinf in.NET?
62. Describe the Managed Execution Process.
63. What is Active Directory? What is the namespace used to access the Microsoft
Active Directories?
64. What are Interop Services?
65. How does you handle this COM components developed in other programming
languages in.NET?
66. How will you register COM+ services?

Basic .NET and ASP.NET interview questions

Submitter said questions were asked in a US company hiring a Web developer.

1. Explain the .NET architecture.

2. 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.
3. How is .NET able to support multiple languages? - a language should comply
with the Common Language Runtime standard to become a .NET language. In
.NET, code is compiled to Microsoft Intermediate Language (MSIL for short).
This is called as Managed Code. This Managed code is run in .NET environment.
So after compilation to this IL the language is not a barrier. A code can call or use
a function written in another language.
4. How ASP .NET different from ASP? - Scripting is separated from the HTML,
Code is compiled as a DLL, these DLLs can be executed on the server.
5. Resource Files: How to use the resource files, how to know which language to
6. 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.
7. What is view state? - The web is stateless. But in ASP.NET, the state of a page is
maintained in the in the page itself automatically. How? The values are encrypted
and saved in hidden controls. this is done automatically by the ASP.NET. This
can be switched off / on for a single control
8. Explain the life cycle of an ASP .NET page.
9. 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
10. Can the validation be done in the server side? Or this can be done only in the
Client side? - Client side is done by default. Server side validation is also
possible. We can switch off the client side and server side can be done.
11. How to manage pagination in a page? - Using pagination option in DataGrid
control. We have to set the number of records for a page, then it takes care of
pagination by itself.
12. What is ADO .NET and what is difference between ADO and ADO.NET? -
ADO.NET is stateless mechanism. I can treat the ADO.Net as a separate in-
memory database where in I can use relationships between the tables and select
insert and updates to the database. I can update the actual database as a batch.

C# developer interview questions

A representative of a high-tech company in United Kingdom sent this in today noting that
the list was used for interviewing a C# .NET developer. Any corrections and suggestions
would be forwarded to the author. I won’t disclose the name of the company, since as far
as I know they might still be using this test for prospective employees. Correct answers
are in green color.

1) The C# keyword ‘int’ maps to which .NET type?

1. System.Int16
2. System.Int32
3. System.Int64
4. System.Int128

2) Which of these string definitions will prevent escaping on backslashes in C#?

1. string s = #”n Test string”;

2. string s = “’n Test string”;
3. string s = @”n Test string”;
4. string s = “n Test string”;

3) Which of these statements correctly declares a two-dimensional array in C#?

1. int[,] myArray;
2. int[][] myArray;
3. int[2] myArray;
4. System.Array[2] myArray;

4) If a method is marked as protected internal who can access it?

1. Classes that are both in the same assembly and derived from the declaring class.
2. Only methods that are in the same class as the method in question.
3. Internal methods can be only be called using reflection.
4. Classes within the same assembly, and classes derived from the declaring

5) What is boxing?

a) Encapsulating an object in a value type.

b) Encapsulating a copy of an object in a value type.

c) Encapsulating a value type in an object.

d) Encapsulating a copy of a value type in an object.

6) What compiler switch creates an xml file from the xml comments in the files in an

1. /text
2. /doc
3. /xml
4. /help

7) What is a satellite Assembly?

1. A peripheral assembly designed to monitor permissions requests from an

2. Any DLL file used by an EXE file.
3. An assembly containing localized resources for another assembly.
4. An assembly designed to alter the appearance or ‘skin’ of an application.

8) What is a delegate?

1. A strongly typed function pointer.

2. A light weight thread or process that can call a single method.
3. A reference to an object in a different process.
4. An inter-process message channel.

9) How does assembly versioning in .NET prevent DLL Hell?

1. The runtime checks to see that only one version of an assembly is on the machine
at any one time.
2. .NET allows assemblies to specify the name AND the version of any
assemblies they need to run.
3. The compiler offers compile time checking for backward compatibility.
4. It doesn’t.

10) Which “Gang of Four” design pattern is shown below?

public class A {

private A instance;

private A() {

static A Instance {


if ( A == null )

A = new A();

return instance;

1. Factory
2. Abstract Factory
3. Singleton
4. Builder

11) In the NUnit test framework, which attribute must adorn a test class in order for
it to be picked up by the NUnit GUI?

1. TestAttribute
2. TestClassAttribute
3. TestFixtureAttribute
4. NUnitTestClassAttribute

12) Which of the following operations can you NOT perform on an ADO.NET

1. A DataSet can be synchronised with the database.

2. A DataSet can be synchronised with a RecordSet.
3. A DataSet can be converted to XML.
4. You can infer the schema from a DataSet.

13) In Object Oriented Programming, how would you describe encapsulation?

1. The conversion of one type of object to another.
2. The runtime resolution of method calls.
3. The exposition of data.
4. The separation of interface and implementation.