Beruflich Dokumente
Kultur Dokumente
• Diversities
1. Diversities between Classic ASP and ASP.Net?
Answer:
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.
Poor Error handling system.
No in-built support for XML.
No fully distributed data source support.
while
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 proof error handling possible.
Full XML Support for easy data exchange.
Fully distributed data source support.
2. What’s the Diversities between Response.Write () and
Response.Output.Write ()?
Answer: Response.Outout.Write allows us to write the formatted out
put.
3. Can you explain the Diversities between an ADO.NET Dataset
and an ADO Recordset?
Answer:
A DataSet can represent an entire relational database in
memory, complete with tables, relations, and views, A
Recordset can not.
A DataSet is designed to work without any continues
connection to the original data source; Recordset maintains
continues connection with the original data source.
There's no concept of cursor types in a DataSet, They are bulk
loaded, while Recordset work with cursors and they are loaded
on demand.
DataSets have no current record pointer, you can use For Each
loops to move through the data. Recordsets have pointers to
move through them.
You can store many edits in a DataSet, and write them to the
original data source in a single operation. Recordset can have a
single edit at a time.
Dataset can fetch source data from many tables at a time, for
Recordset you can achieve the same only using the SQL joins.
4. What is the Diversities between an abstract method & virtual
method?
Answer: An Abstract method does not provide an implementation and
forces overriding to the deriving class (unless the deriving class also
Page 1 of 55
.Net Interview Questions
Page 2 of 55
.Net Interview Questions
Applications (If Shared Dlls), Even if Private can copy to bin directory
of web application add reference and use. Normally designed to
provide common functionality independent of consuming Application.
User Controls are similar to those of ASP include files, easy to create,
can not be placed in the toolbox and dragged - dropped from it. A User
Control is shared among the single application files.
13. What is the Diversities between ASP Session State and ASP.Net
Session State?
Answer: ASP session state relies on cookies, Serialize all requests from
a client, does not survive process shutdown, Can not maintained
across machines in a Web farm.
14. Diversities between ASP Session and ASP.NET Session?
Answer: Asp.net session supports cookie less session & it can span
across multiple servers.
15. Can you explain the Diversities between an ADO.NET Dataset
and an ADO Recordset? (Repeated but more explanatory)
Answer: In ADO, the in-memory representation of data is the
recordset. In ADO.NET, it is the dataset. There are important
Diversitiess between them.
o A recordset looks like a single table. If a recordset is to contain
data from multiple database tables, it must use a JOIN query,
which assembles the data from the various database tables into
a single result table. In contrast, a dataset is a collection of one
or more tables. The tables within a dataset are called data
tables; specifically, they are DataTable objects. If a dataset
contains data from multiple database tables, it will typically
contain multiple DataTable objects. That is, each DataTable
object typically corresponds to a single database table or view.
In this way, a dataset can mimic the structure of the underlying
database. A dataset usually also contains relationships. A
relationship within a dataset is analogous to a foreign-key
relationship in a database —that is, it associates rows of the
tables with each other. For example, if a dataset contains a
table about investors and another table about each investor’s
stock purchases, it could also contain a relationship connecting
each row of the investor table with the corresponding rows of
the purchase table. Because the dataset can hold multiple,
separate tables and maintain information about relationships
between them, it can hold much richer data structures than a
recordset, including self-relating tables and tables with many-
to-many relationships.
o In ADO you scan sequentially through the rows of the recordset
using the ADO MoveNext method. In ADO.NET, rows are
represented as collections, so you can loop through a table as
you would through any collection, or access particular rows via
ordinal or primary key index. DataRelation objects maintain
information about master and detail records and provide a
method that allows you to get records related to the one you
are working with. For example, starting from the row of the
Investor table for "Nate Sun," you can navigate to the set of
rows of the Purchase table describing his purchases. A cursor is
a database element that controls record navigation, the ability
to update data, and the visibility of changes made to the
Page 3 of 55
.Net Interview Questions
Page 4 of 55
.Net Interview Questions
• True/False
Tr A Web service can only be written in .NET?
Answer: False
An To test a Web service you must create a windows application or
Web application to consume this service?
Answer: False, the web service comes with a test page and it
provides HTTP-GET method to test it.
pr A wbe service is only available through http://www.uddi.org?
Answer: False
• Simple Questions
Si What is IL? (What is MSIL or CIL, What is JIT?)
MSIL is the CPU –independent instruction set into which .Net
Page 5 of 55
.Net Interview Questions
Page 6 of 55
.Net Interview Questions
Page 7 of 55
.Net Interview Questions
Page 8 of 55
.Net Interview Questions
• Tricky Questions
Page 9 of 55
.Net Interview Questions
btnSubmit.Attributes.Add(“onMouseOver”,”someClientCode();”)
//For on mouse over of a button
TextBox1.Attributes.Add(“onFocus”,“ClearText();”) //For on focus
of a text box
4. Explain what a diffgram is and a good use for one?
Answer: 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.
5. Name two properties common in every validation control?
Answer: ControlToValidate and Text property.
6. What tags do you need to add within the Datagrid tags to bind
columns manually?
Answer: Set AutoGenerateColumns Property to false on the
Datagrid tag.
7. What tag do you use to add a hyperlink column to the DataGrid?
Answer: <asp:HyperLinkColumn></asp:HyperLinkColumn>
8. What is the transport protocol you use to call a Web service?
Answer: SOAP (Simple Object Access Protocol) is the preferred
protocol.
9. Where on the Internet would you look for Web services?
Answer: http://www.uddi.org
10. Which control would you use if you needed to make sure the values
in two different controls matched?
Answer: CompareValidator Control
11. What are the assembly entry points? An Assembly can have how
many entry points at a time?
Answer: An assembly can have only one entry point from DllMain,
WinMain or Main.
12. What does an assembly contain?
Answer:
• Manifest - The metadata describing the information below.
• Assembly name - Aids in versioning and visibility scope.
Page 10 of 55
.Net Interview Questions
Page 11 of 55
.Net Interview Questions
x = o; // Implicit Un-Boxing
x = (int)o; // Explicit Un-Boxing
28. What are the different methods available under sqlcommand class
to access the data?
ExecuteReader – Used where one or more records are
returned – SELECT Query.
ExecuteNonQuery – Used where it affects a state of the
table and no data is being queried - INSERT, UPDATE,
DELETE, CREATE and SET queries.
ExecuteScalar – Used where it returns a single record(a
single value normally) – SQL Functions like MIN(), NAX()
Page 12 of 55
.Net Interview Questions
29. What are the different types of Session state management options
available with ASP.NET?
Answer: ASP.NET provides In-Process & Out-of-Process state
management,
Also known as "In-Proc" and "Out-Proc". In-Proc stores the session
in memory of the web server, that is on the same server the
ASP.Net page is.
On the other hand Out-Proc session state management stores the
session data on external data source, which can be a SQL Server or
Server State Service. Out-of-Process state management requires
the objects stored in session, must be serializable.
30. What is Remoting? Give Example.
Answer: Remoting is a means by which one operating system
process, or program, can communicate with another process. The
two processes can exist on the same computer or on two
computers connected by a LAN or the Internet. Web services are
probably the best known type of remoting, but they are not the
only option.
31. When would you use .NET Remoting and when Web services?
Answer: Use remoting for more efficient exchange of information
when you control both ends of the application. Use Web services
for open-protocol-based information exchange when you are just a
client or a server with the other end belonging to someone else.
32. What’s a proxy of the server object in .NET Remoting?
Answer: It’s a fake copy of the server object that resides on the
client side and behaves as if it was the server. It handles the
communication between real server object and the client object.
This process is also known as marshaling.
33. What are remotable objects in .NET Remoting?
Answer: 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.
34. What is Marshalling?
Answer: 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.
i. Marshal by value: the server creates a copy of the object
passes the copy to the client. When a client makes a call to an
object marshaled by value (MBV), the server creates an exact
copy and sends that copy to the client. The client can then use
the object's data and executable functionality directly within its
own process or application domain without making additional
calls to the server. Objects that the application accesses
frequently are best remoted using MBV.
ii. Marshal by reference: the client creates a proxy for the object
and then uses the proxy to access the object. When a client
makes a call to an object marshaled by reference (MBR), the
.NET framework creates a proxy in the client's application
domain and the client uses that proxy to access the original
object on the server. Large objects that the application
accesses relatively infrequently are good candidates for MBR.
Page 13 of 55
.Net Interview Questions
Page 14 of 55
.Net Interview Questions
Page 15 of 55
.Net Interview Questions
Pre-Render
SaveViewState
Render
Unload
51. Can the action attribute of a server-side <form>tag be set to a
value and if not how can you possibly pass data from a form to a
subsequent Page?
Answer: No, Assigning value will not work because will be
overwritten at the time of rendering. We can assign value to it by
register a startup script which will set the action value of form on
client-side. On other hand we can use Server.Transfer or
Response.Redirect.
52. How do you turn off cookies in one page of your asp.net
application?
Answer: We may not use them at the max, However to allow the
cookies or not, is client side functionality.
53. Which method do you use to redirect to user to another page
without performing a round trip to Client?
Answer: Server.Transfer(“AnotherPage.aspx”).
54. How many namespaces are in .NET version 1.1?
Answer: 124.
55. Should Validation occur on Client/Server Side for Date Input?
Answer: Both. Client-side reduces extra round-trip. Server-Side
ensures prevention against hacking and failure against automated
requests.
56. What are the web form events?
Answer:
i. The first event that occurs in the life of a Web Form is the Init
event. This is raised so that we can have initialization code for
the page. The controls on the page are not yet created at this
point. This event is raised once for each user of the page.
ii. The Load event follows the Init event. Subsequently, it is raised
each time the page is requested. When this event is raised, all
child controls of the Web Form are loaded and accessible. You
should be able to retrieve data and populate the controls so
that they can render themselves on the page when sent back to
the client.
iii. The PreRender event happens just before the page is rendered
and sent back to the client. We don't often handle this event;
however, it depends on the situation.
iv. The last event in the life of a Web Form is the Unload event.
This happens when the page is unloaded from memory. Final
cleanup should be done here.
57. Why main function is static?
Answer: To ensure there is only one entry point to the application.
58. How CCW (COM Callable Wrapper) and RCW (Runtime Callable
Wrapper) work?
Answer:
CCW: The .NET Framework includes support for COM clients to
use .NET components. When a COM client needs to create a .NET
object, the CLR creates the managed object and a COM callable
wrapper (CCW) that wraps the object. The COM client interacts
with the managed object through the CCW. The runtime creates
Page 16 of 55
.Net Interview Questions
only one CCW for a managed object, regardless of how many COM
clients are using it.
Page 17 of 55
.Net Interview Questions
Page 18 of 55
.Net Interview Questions
81. What’s the C# equivalent of C++ try catch blocks, which was a
catch-all statement for any possible exception?
Answer: a simple catch block shown as under will catch all the
exceptions which fall under System.Exception class.
try{
---Some code to execute----
}
catch {
----some exception handling---
}
82. Can multiple catch blocks be executed?
Answer: No, once an exception fall under a catch block the control
will never be passed to next catch block instead it will be passed to
the finally block (if any or/and) the code next to the finally block.
83. How do you generate documentation from the C# file commented
properly with a command-line compiler?
Answer: Compile it with a /doc switch.
84. What debugging tools come with the .NET SDK?
Answer: 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.
85. What does assert () do?
Answer: 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.
86. What’s the Diversities between the Debug class and Trace class?
Answer: Documentation looks the same. Use Debug class for
debug builds, use Trace class for both debug and release builds.
87. How do you debug an ASP.NET Web application?
Answer: Attach the aspnet_wp.exe process to the DbgClr
debugger.
88. Name the 4 .NET authentification methods.
Answer: 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:
a. Windows: Basic, digest, or Integrated Windows Authentication
(NTLM or Kerberos).
b. Microsoft Passport authentication
c. Forms authentication
d. Client Certificate authentication
89. Explain what a diffgram is and a good use for one?
Answer: A DiffGram is an XML format that is used to identify
current and original versions of data elements. The DataSet uses
the DiffGram format to load and persists its contents, and to
serialize its contents for transport across a network connection.
When a DataSet is written as a DiffGram, it populates the DiffGram
with all the necessary information to accurately recreate the
contents, though not the schema, of the DataSet, including column
values from both the Original and Current row versions, row error
information, and row order.
Page 19 of 55
.Net Interview Questions
90. Where would you use an iHTTPModule, and what are the limitations
of anyapproach you might take in implementing one?
Answer: One of ASP.NET’s most useful features is the extensibility
of the HTTP pipeline, the path that data takes between client and
server. You can use them to extend your ASP.NET applications by
adding pre- and post-processing to each HTTP request coming into
your application. For example, if you wanted custom authentication
facilities for your application, the best technique would be to
intercept the request when it comes in and process the request in a
custom HTTP module.
91. What method do you use to explicitly kill a user’s session?
Answer: The Abandon method destroys all the objects stored in a
Session object and releases their resources.
If you do not call the Abandon method explicitly, the server
destroys these objects when the session times out.
Syntax: Session.Abandon
92. How do you turn off cookies for one page in your site?
Answer: Use the Cookie.Discard Property which 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.
93. Which method do you use to redirect the user to another page
without performing a round trip to the client?
Answer: Server.transfer()
94. Where do you store the information about the user’s locale?
Answer: System.Web.UI.Page.Culture
95. What’s the Diversities between Codebehind="MyCode.aspx.cs"
andSrc="MyCode.aspx.cs"?
Answer: CodeBehind is relevant to Visual Studio.NET only.
96. What data type does the RangeValidator control support?
Answer: Integer, String and Date.
97. What is cookie less session? How it works?
Answer: 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. This can be enabled by setting the
following:
<sessionState cookieless="true" />
98. What is State Management in .Net and how many ways are there
to maintain a state in .Net? What is view state?
Answer: Web pages are recreated each time the page is posted to
the server. In traditional Web programming, this would ordinarily
mean that all information associated with the page and the controls
on the page would be lost with each round trip.
To overcome this inherent limitation of traditional Web
programming, the ASP.NET page framework includes various
options to help you preserve changes — that is, for managing
state. The page framework includes a facility called view state that
automatically preserves property values of the page and all the
controls on it between round trips.
However, you will probably also have application-specific values
that you want to preserve. To do so, you can use one of the state
management options.
Page 20 of 55
.Net Interview Questions
Page 21 of 55
.Net Interview Questions
• OOPS
1. What are the OOPS concepts?
Answer:
1) Encapsulation: It is the mechanism that binds together code and
data in manipulates, and keeps both safe from outside interference
and misuse. In short it isolates a particular code and data from all
other codes and data. A well-defined interface controls the access
to that particular code and data.
2) Inheritance: It is the process by which one object acquires the
properties of another object. This supports the hierarchical
classification. Without the use of hierarchies, each object would
need to define all its characteristics explicitly. However, by use of
inheritance, an object need only define those qualities that make it
unique within its class. It can inherit its general attributes from its
parent. A new sub-class inherits all of the attributes of all of its
ancestors.
3) Polymorphism: It is a feature that allows one interface to be
used for general class of actions. The specific action is determined
by the exact nature of the situation. In general polymorphism
means "one interface, multiple methods"; this means that it is
possible to design a generic interface to a group of related
activities. This helps reduce complexity by allowing the same
interface to be used to specify a general class of action. It is the
compiler's job to select the specific action (that is, method) as it
applies to each situation.
2. What is a class?
Answer: Class is concrete representation of an entity. It represents
a group of objects, which hold similar attributes and behavior. It
provides Abstraction and Encapsulations.
3. What is an Object? What is Object Oriented Programming?
Answer: Object represents/resembles a Physical/real entity. An
object is simply something you can give a name. Object Oriented
Programming is a Style of programming that represents a program
as a system of objects and enables code-reuse.
4. What is Encapsulation?
Encapsulation is binding of attributes and behaviors. Hiding the
actual implementation and exposing the functionality of any object.
Encapsulation is the first step towards OOPS, is the procedure of
covering up of data and functions into a single unit (called class).
Its main aim is to protect the data from out side world.
5. What is Abstraction?
Answer: Hiding the complexity. It is a process of defining
communication interface for the functionality and hiding rest of the
things.
Page 22 of 55
.Net Interview Questions
6. What is Overloading?
Answer: Adding a new method with the same name in
same/derived class but with different number/types of parameters.
It implements Polymorphism.
7. What is Overloading?
Answer: A process of creating different implementation of a
method having a same name as base class, in a derived class. It
implements Inheritance.
8. What is Shadowing?
Answer: When the method is defined as Final/sealed in base class
and not override able and we need to provide different
implementation for the same. This process is known as shadowing,
uses shadows/new keyword.
9. What is Inheritance?
Answer: It is a process of acquiring attributes and behaviors from
another object (normally a class or interface).
10. What is an Abstract class?
Answer: An abstract class is a special kind of class that cannot be
instantiated. It normally contains one or more abstract methods or
abstract properties. It provides body to a class.
11. What is an Interface?
Answer: An interface has no implementation; it only has the
signature or in other words, just the definition of the methods
without the body.
12. What is Polymorphism?
Answer: Mean by more than one form. Ability to provide different
implementation based on different number/type of parameters.
13. What is Pure-Polymorphism?
Answer: When a method is declared as abstract/virtual method in a
base class and which is overridden in a base class. If we create a
variable of a type of a base class and assign an object of a derived
class to it, it will be decided at a run time, which implementation of
a method is to be called.
This is known as Pure-Polymorphism or Late-Binding.
14. What is a Constructor?
Answer: A special Method Always called whenever an instance of
the class is created.
15. What is a Destructor?
Answer: A special method called by GC. Just before object is being
reclaimed by GC.
16. How a base class method is hidden?
Answer: Hiding a base class method by declaring a method in
derived class with keyword new. This will override the base class
method and old method will be suppressed.
17. What Command is used to implement properties in C#?
Answer: get & set access modifiers are used to implement
properties in c#.
18. What is method overloading?
Answer: Method overloading is having methods with same name
but carrying different signature, this is useful when you want a
method to behave differently depending upon a data passed to it.
19. Can constructors have parameters?
Page 23 of 55
.Net Interview Questions
Page 24 of 55
.Net Interview Questions
will complete first. As soon as one ends, the freed thread is used to
execute the next asynchronous operation.
31. How to create events for a control? What are custom events?
Answer:
Declare a public delegate and set of events to listen from.
public delegate void CarEventHandler(string msg);
public event CarEventHandler AboutToBlow;
public event CarEventHandler BlewUp;
32. What’s the advantage of using System.Text.StringBuilder over
System.String?
Answer: 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.
33. Can you store multiple data types in System.Array?
Answer: No.
34. What’s the Diversities between the System.Array.CopyTo() and
System.Array.Clone()?
Answer: System.Array.CopyTo() performs a deep copy while
System.Array.Clone() performs a shallow copy.
35. How can you sort the elements of the array in descending order?
Answer: First use Sort () method to sort the array and then call
Reverse () method to arrange array elements in descending order.
36. What’s the .NET datatype that allows the retrieval of data by a
unique key?
Answer: A HashTable.
37. What’s class SortedList underneath?
Answer: A sorted HashTable.
38. Will finally block get executed if the exception had not occurred?
Answer: Yes.
39. When you inherit a protected class-level variable, who is it
available to?
Answer: Classes in the same namespace.
40. Are private class-level variables inherited?
Answer: Yes, but they are not accessible, so looking at it you can
honestly say that they are not inherited. But they are.
41. Describe the accessibility modifier protected internal.
Answer: It’s available to derived classes and classes within the
same Assembly (and naturally from the base class it’s declared in).
42. How’s method overriding different from overloading?
Answer: When overriding, you change the method behavior for a
derived class. Overloading simply involves having a method with
the same name within the class.
43. What does the keyword virtual mean in the method definition?
Answer: The method can be over-ridden.
44. Can you declare the override method static while the original
method is non-static?
Answer: No, you can’t, the signature of the virtual method must
remain the same, only the keyword virtual is changed to keyword
override.
45. Can you override private virtual methods?
Answer: No, moreover, you cannot access private methods in
inherited classes, have to be protected in the base class to allow
any sort of access.
Page 25 of 55
.Net Interview Questions
46. Can you prevent your class from being inherited and becoming a
base class for some other classes?
Answer: Yes, that’s what keyword sealed in the class definition is
for. The developer trying to derive from your class will get a
message: cannot inherit from Sealed class
WhateverBaseClassName. It’s the same concept as final class in
Java.
47. Can you allow class to be inherited, but prevent the method from
being over-ridden?
Answer: Yes, just leave the class public and make the method
sealed.
48. When do you absolutely have to declare a class as abstract?
Answer: When at least one of the methods in the class is abstract.
When the class itself is inherited from an abstract class, but not all
base abstract methods have been over-ridden.
49. Can we declare private methods inside an Interface? Why can’t you
specify the accessibility modifier for methods inside the interface?
No, they all must be public. Therefore, to prevent you from getting
the false impression that you have any freedom of choice, you are
not allowed to specify any accessibility, its public by default.
50. What’s the Diversities between an interface and abstract class?
Answer: In the interface all methods must be abstract; in the
abstract class some methods can be concrete. In the interface no
accessibility modifiers are allowed, which is ok in abstract classes.
51. If a base class has a bunch of overloaded constructors, and an
inherited class has another bunch of overloaded constructors, can
you enforce a call from an inherited constructor to an arbitrary
base constructor?
Answer: Yes, just place a colon, and then keyword base
(parameter list to invoke the appropriate constructor) in the
overloaded constructor definition inside the inherited class.
52. What’s the Diversities between System.String and
System.StringBuilder classes?
Answer: System.String is immutable; System.StringBuilder was
designed with the purpose of having a mutable string where a
variety of operations can be performed.
53. How do you initiate a string without escaping each backslash?
Answer: Put @ sign in front of the double-quoted string.
e.g. @“C:\Documents and Settings\Administrator\My Documents”;
is equivalent to “C:\\Documents and Settings\\Administrator\\My
Documents”.
54. What are valid signatures for the Main function?
Answer:
public static void Main()
public static int Main()
public static void Main( string[] args )
public static int Main(string[] args )
55. Explain encapsulation.
Answer: The implementation is hidden, the interface is exposed.
56. Where all the value-type variables allocated in the computer RAM?
Answer: Stack
Page 26 of 55
.Net Interview Questions
Page 27 of 55
.Net Interview Questions
• SQL: Queries
1. Write a query to select the second highest salary from a table.
Answer: SELECT max(salary) AS salary2 FROM orders WHERE
salary < (SELECT max(salary) AS salary1 FROM orders)
2. Write a query to select the 5th highest salary from a table.
Answer: SELECT min(salary) AS high5 FROM employee WHERE
Page 28 of 55
.Net Interview Questions
• SQL: Questions
1. What is the Diversities between Delete and Truncate command in
SQL?
Answer: Delete command and truncate command both will delete
the data, however the truncate command can not be rolled back as
delete can be. The delete command can be used for selected
records using the where clause but with the truncate command we
have to loose data. DELETE statement is a logged operation and
hence takes more time then truncate.
2. What is Magic Table in SQL?
Answer: The insert and Delete commands are known as magic
tables in SQL.
3. Can Primary key is a Foreign Key on the same table?
Answer: Yes, Consider a category table in a e-commerce web site.
Category_Id, Category_Name, Parent_Category_ID. In this table
all the parent categories are also categories. When we create a self
join category id will be treated as foreign key to the same table.
4. What is Normalization?
5. What are the advantages and disadvantages of Normalization?
Answer: There are several advantages of normalization as under:
Faster sorting and index creation.
A larger number of clustered indexes.
Narrower and more compact indexes.
Fewer indexes per table, which improves the
performance of INSERT, UPDATE, and DELETE
statements
Fewer null values and less opportunity for inconsistency,
which increase database compactness.
Page 29 of 55
.Net Interview Questions
Page 30 of 55
.Net Interview Questions
Page 31 of 55
.Net Interview Questions
Page 32 of 55
.Net Interview Questions
18. Generic method: A method that accepts type parameters (C# 2.0
feature).
19. immutable: Unchangeable: a string may appear to change, but a
method merely returns a modified string object. (Strings are
immutable, stringbuilder class is mutable.)
20. inheritance: a methodology in which functionality is inherited (class
and interface type).
21. jagged array: A multidimensional array where the rows are of
varying sizes: an array is comprised of elements that are
themselves arrays. It is also known as Array of Arrays.
22. linked list: A data structure that has a series of connected nodes.
23. late binding: A methodology in which binding is determined at
runtime.
24. manifest: An assembly’s contents; it is also referred to as
assembly metadata.
25. multidimensional array: An array with multiple dimensions (rows
and columns). C# has two: jagged ([][])and rectangular([,]).
26. new: A keyword that calls a class’s constructor.
27. operator overloading: A technique whereby an operator is
overloaded to give a class the functionality of the operator.
28. overloading: The ability to include more than one method in the
same class with the same name.
29. overriding: When a virtual method in a base class has its
functionality superimposed or overridden by a method in a
subclass, which has the same name and signature.
30. polymorphism: Object-oriented concept whereby a specialized
class may be passed as an instance of a generalized class (class
polymorphism): also refers to methods of a class (method
polymorphism).
31. passing by reference: Reference types are passed to a calling
method by reference—a reference to a memory location (“the
heap”) is passed rather than a copy of the type (contrast passing
by value).
32. passing by value: Value types are passed to a calling method by
way of a copy of the underlying value type—altering the copy does
not alter the underlying (original) value type. Passing by value
occurs on the stack (contrast with passing by reference).
33. readonly: Keyword used to declare that a class member variable is
read-only and can’t be edited at runtime.
34. Rectangular array: A form of multidimensional array with two or
more dimensions that has rows of the same length (contrast with
jagged array).
35. sealed: A modifier that signifies that a given concrete class cannot
be derived from or inherited.
36. shallow copy: A technique that copies an object variable into
another variable by value rather than by reference.
37. strong name: A unique composite of assembly name, assembly
version, and encryption key.
38. typed dataset: Dataset associated with a defined XML schema:
faster and more efficient than untyped dataset because the schema
is defined and does not require runtime type identification when
run.
Page 33 of 55
.Net Interview Questions
39. value type: Data that is stored in a variable: value types are stored
with their contents on the stack. Consists of structures, primitives,
and enumerations.
• Testing Questions
1. What debugging tools come with the .NET SDK?
1. CorDBG – command-line debugger. To use CorDbg, you must
compile the original C# file using the /debug switch.
2. DbgCLR – graphic debugger. Visual Studio .NET uses the
DbgCLR.
2. What does assert () method 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.
3. What’s the Diversities 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.
4. Why are there five tracing levels in
System.Diagnostics.TraceSwitcher?
The tracing dumps can be quite verbose. For applications that are
constantly running you run the risk of overloading the machine and
the hard drive. Five levels range from None to Verbose, allowing
you to fine-tune the tracing activities.
5. Where is the output of TextWriterTraceListener redirected?
To the Console or a text file depending on the parameter passed to
the constructor.
6. How do you debug an ASP.NET Web application?
Attach the aspnet_wp.exe process to the DbgClr debugger.
7. What are three test cases you should go through in unit testing?
1. Positive test cases (correct data, correct output).
2. Negative test cases (broken or missing data, proper handling).
3. Exception test cases (exceptions are thrown and caught
properly).
8. 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”.
Page 34 of 55
.Net Interview Questions
• DataGrid Questions
Da What is datagrid?
Answer: The DataGrid Web server control is a powerful tool for
displaying information from a data source. It is easy to use; you
can display editable data in a professional-looking grid by setting
only a few properties. At the same time, the grid has a
sophisticated object model that provides you with great flexibility
in how you display the data.
i n What’s the Diversities between the
System.Web.UI.WebControls.DataGrid and and
System.Windows.Forms.DataGrid?
Answer: The Web UI control does not inherently support master-
detail data structures. As with other Web server controls, it does
not support two-way data binding. If you want to update data, you
must write code to do this yourself. You can only edit one row at a
time. It does not inherently support sorting; although it raises
events you can handle in order to sort the grid contents. You can
bind the Web Forms DataGrid to any object that supports the
IEnumerable interface. The Web Forms DataGrid control supports
paging. It is easy to customize the appearance and layout of the
Web Forms DataGrid control as compared to the Windows Forms
one.
on How do you customize the column content inside the datagrid?
Answer: If you want to customize the content of a column, make
the column a template column. Template columns work like item
templates in the DataList or Repeater control, except that you are
defining the layout of a column rather than a row.
de How do you apply specific formatting to the data inside the cells?
Answer: You cannot specify formatting for columns generated
when the grid’s AutoGenerateColumns property is set to true, only
for bound or template columns. To format, set the column’s
DataFormatString property to a string-formatting expression
suitable for the data type of the data you are formatting.
su How do you hide the columns?
Answer: One way to have columns appear dynamically is to create
them at design time, and then to hide or show them as needed.
You can do this by setting a column’s “Visible” property.
Yo How do you display an editable drop-down list?
Answer: Displaying a drop-down list requires a template column in
the grid. Typically, the ItemTemplate contains a control such as a
data-bound Label control to show the current value of a field in the
record. You then add a drop-down list to the EditItemTemplate. In
Visual Studio, you can add a template column in the Property
builder for the grid, and then use standard template editing to
remove the default TextBox control from the EditItemTemplate and
drag a DropDownList control into it instead. Alternatively, you can
add the template column in HTML view. After you have created the
Page 35 of 55
.Net Interview Questions
template column with the drop-down list in it, there are two tasks.
The first is to populate the list. The second is to preselect the
appropriate item in the list — for example, if a book’s genre is set
to “fiction,” when the drop-down list displays, you often want
“fiction” to be pre-selected.
“f How do you check whether the row data has been changed?
Answer: The definitive way to determine whether a row has been
dirtied is to handle the changed event for the controls in a row. For
example, if your grid row contains a TextBox control, you can
respond to the control’s TextChanged event. Similarly, for check
boxes, you can respond to a CheckedChanged event. In the
handler for these events, you maintain a list of the rows to be
updated. Generally, the best strategy is to track the primary keys
of the affected rows. For example, you can maintain an ArrayList
object that contains the primary keys of the rows to update.
Page 36 of 55
.Net Interview Questions
o \v
• 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
• 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()
• 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
• 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
• 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
• The following is a valid statement in ASP.NET<%@ Page
Language="C" %>
o True
o False
• A valid comment block in ASP.NET is
o <!- - - Comment - - - >
o <!- - Comment - - >
o <% - - Comment - - %>
o <% ! - - Comment - - >
• 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
Page 37 of 55
.Net Interview Questions
o Compiler Error
o Runtime Error
o Hello C# world
o None of the above
• What will be the values of x and y?
{
int x = 5; int y = 10;
y += x++;
System.Console.WriteLine("x:" + x.toString() + " y:" +
y.toString());
}
o x: 6 y: 16
o x: 6 y: 15
Page 38 of 55
.Net Interview Questions
o x: 10 y: 15
o x: 10 y: 26
• 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
• 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
• 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=127.0.0.1:42424" sqlConnectionString=" data
source=127.0.0.1;user id=sa;password="cookieless="false"
timeout="30" />
o <SessionState mode="OutProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;user
id=sa;password=" cookieless="false" timeout="30" />
o <SessionState mode="stateserver"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;user
id=sa;password=" cookieless="false" timeout="30" />
• 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
• How can be the web application get configured with the following
authorization rules
o Anonymous users must not be allowed to access the
application.
o All persons except David and John must be allowed to
access the application.
<authorization><deny users =
"applicationname\David, applicationname\John"
Page 39 of 55
.Net Interview Questions
using System;
class MainClass
{
static void Main( )
{
new MainClass().Display( 3.56 );
}
o System.Single 3.56
o System.Float 3.56
o System.Double 3.56
o System.Decimal 3.56
Dim I as integer = 5
Do
Page 40 of 55
.Net Interview Questions
I=I+2
Response.Write (I & " ")
Loop Until I > 10
o 58
o 579
o 7 9 11
o Errors out
• A structure in C# can be derived from one or more
o class
o interface
o both
o none
• State True or False: Static method cannot be overridden
o True
o False
• The Equivalent HTML Control for the <input type=”button”> tag is
o HtmlInput
o HtmlButton
o HtmlPushButton
o HtmlInputButton
• The Equivalent Html Control for the <input type=”checkbox”> tag
is
o HtmlCheckBox
o HtmlInputChkBox
o HtmlInputCheckBox
o HtmlInputTypeChkBox
• Which operator is used for connecting a event with a procedure in
C#?
o +=
o =
o both
o none
• The Equivalent Html Control for the <select> tag is
o <HtmlSelectInput>
o <HtmlSelect>
o <HtmlInputSelect>
o <HtmlSelectControl>
• State True or False: Events in Web forms are processed before the
“Page Load” event
o True
o False
• What namespaces are necessary to create a localized application?
o System.Globalization
o System.Globalization and System.Resources.
o System.Resources.
o System.Array
• A new server-side control can be created by implementing the
class ___________
Page 41 of 55
.Net Interview Questions
o System.Web.WebControl
o System.Web.UI.WebControl
o System.Web.UI.WebControls.WebControl
o Any one of the above
• The parameter “clienttarget = downlevel” does one of the following
o Adds aliases for specific user agents to an internal collection
of user agent aliases
o Indicates the useragents level of validating the controls
o Disables all DHTML events(including Validation controls)
o None of the above
• 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 parameters
o By giving different method names and same number of
parameters
o By having the same method name and specifying different
types of parameters
o By giving different method names and same types of
parameters
• 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
• What is the Diversities 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.
• State True or False: Any ODBC-compliant database can be
accessed through ASP.NET
o True
o False
• 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
• A set of tables are maintained in a Dataset as
o TablesCollection object
o DataTableCollection object
o DataRowsCollection object
o TableRowCollection object
Page 42 of 55
.Net Interview Questions
Page 43 of 55
.Net Interview Questions
o Constraints
o GetConstraints
o ConstraintsEnforce
• Which of the following languages is NOT included in the default
.NET Framework installation?
o C#
o VB.NET
o JScript.NET
o VBScript.NET
• What are the different types of serialization supported in .NET
Framework
o XmlSerializer
o SoapFormatter
o XPathNavigator
o HttpFormatter
• 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
• What tool is used to manage the GAC?
o GacMgr.exe
o GacSvr32.exe
o GacUtil.exe
o RegSvr.exe
• State True or False: A single .NET dll can contain unlimited classes
o True
o False
• State True or False: ASP.NET can currently run only on Windows
Platform
o True
o False
• 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 types
o All of the above
• The number of objects in ASP.NET is
o 6
o 7
o 9
o 10
• The code used to turn off buffering is
o Buffering = false
o OutputBuffer = false
o BufferOutput = false
Page 44 of 55
.Net Interview Questions
o Buffer = Off
• 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
• 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
• 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
• 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
• In C#, which character is used to indicate a verbatim string literal?
o @
o !
o "
o #
• Which of the following operators has the highest precedence?
o Pre Increment (++x)
o Shift bits left: <<
o Bitwise Or: |
o Post Increment (x++)
• 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
• State True or False: C# supports multiple-inheritance
o True
o False
• Bitwise AND operator in C# is
o &
o &&
o AND
o XAND
Page 45 of 55
.Net Interview Questions
• Bitwise OR operator in C# is
o OR
o ||
o |
o XOR
• What’s the .NET datatype that allows the retrieval of data by a
unique key?
o Primary
o Integer
o Unique Identifier
o HashTable
• The keyword ‘int’ maps to one of the following .NET types
o System.Int16
o System.Int32
o System.Int64
o System.Int128
• 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
• Which of the following is the correct code for setting a Session
timeout of 30 minutes
o Session.Timeout = 108000
o Session.Timeout = 1800
o Session.Timeout = 300
o Session.Timeout = 30
• 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
• 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()
Page 46 of 55
.Net Interview Questions
Page 47 of 55
.Net Interview Questions
Page 48 of 55
.Net Interview Questions
Page 49 of 55
.Net Interview Questions
• Tabled points
Page 50 of 55
.Net Interview Questions
Page 51 of 55
.Net Interview Questions
corresponding method in
the actual class. Modern
JVMs are discovering
ways to reduce this
speed penalty.
The constant
You can put shared code into
declarations in an
an abstract class, where you
interface are all
cannot into an interface. If
presumed public static
interfaces want to share code,
final, so you may leave
you will have to write other
that part out. You can't
bubblegum to arrange that.
call any methods to
Terseness You may use methods to
compute the initial
compute the initial values of
values of your
your constants and variables,
constants. You need not
both instance and static. You
declare individual
must declare all the individual
methods of an interface
methods of an abstract class
abstract. They are all
abstract.
presumed so.
If you add a new
method to an interface, If you add a new method to an
you must track down all abstract class, you have the
Adding implementations of that option of providing a default
functionality interface in the universe implementation of it. Then all
and provide them with a existing code will continue to
concrete implementation work without change.
of that method.
Page 52 of 55
.Net Interview Questions
Diversities between
Web user controls Web custom controls
Easier to create Harder to create
Limited support for consumers who Full visual design tool support for
Page 53 of 55
.Net Interview Questions
Page 54 of 55
.Net Interview Questions
heterogeneous
environments.
Can also take advantage of IIS for
Highly reliable due to the fact fault isolation. If IIS is not used,
Reliability that Web services are always application needs to provide
hosted in IIS plumbing for ensuring the
reliability of the application.
Provides extensibility by
Very extensible by allowing us to
allowing us to intercept the
customize the different
Extensibility SOAP messages during the
components of the .NET remoting
serialization and
framework.
deserialization stages.
Ease-of-
Programmin Easy-to-create and deploy. Complex to program.
g
Page 55 of 55