You are on page 1of 46

Question: How to start Outlook,NotePad file in AsP.NET with code ?

Answer: Here is the syntax to open outlook or notepad file in ASP.NET VB.NET
Process.Start("Notepad.exe") Process.Start("msimn.exe"); C#.NET
System.Diagnostics.Process.Start("msimn.exe");
System.Diagnostics.Process.Start("Notepad.exe");
Question: How to get result from two table in SqlDataReader ?
Answer: string str="Select * from table1;Select * from table2";
cmd.commandtext=str; dr=cmd.executereader();
Question: What is Ref Cursor in .NET and how it is link with ExecuteReader ?

Answer: Ref cursor play its role when doing with the oracle database these comes in
ODP.NET. Ref Cursors are objects that link to Oracle server-side cursors.These Ref
Cursor can be converted in oracle datareader with this Ref cursor we can get result
with query written to pl/sql and the result can be get in .net.Now the question arise
why we use Ref Cursor when we have an option of ExceuteReader reson is simple
when we need more query in pl/sql means our work is done in pl/sql then we need
this ref cursor for getting result set because doennot have direct connection to that
table.Becasue advantage of pl/sql we can take two opertion in one query.
Question: Define tool Manage Statistics in SQL Serevr 2000 query ?
Answer: SQL Server creates internal statistics on the rows in all of our tables that is
used by the Query Optimizer to select the optimal execution plan for our query. And
Query Optimizer helps in doing this.Soome time when statistics isnot maintains then
this is done by tool Manage Statistics.We can add,edit or delete for statistics that is
maintained by SQL Server.We can experiment with different sets of statistics and see
how it affects the query otimizer execution plans.
Question: Some important instruction regarding ADO.NET connection
string ?
Answer: When we are making connection string always use Server's IP address not
the DNS name if we use IP address it will reduce the time taken for connection to
establish.Becasue server IP address is used to get a default or named instance of Sql
Server that ls running. if we are running the cluster we have to use the Virtual SQL
Server IP address.
Question: How to get database schema information when connection object
is establish in ADO.NET ?
Answer: There is a method that helps in getting schema information that is
GetSchema() and this method is called in three different ways first way when we call
this method without any parameter its return the metadata(table, view, stored
procedure.indexes etc).When method is called by passing metadata collection name
and filter criteria returns the items from the collection after applying the filter criteria
and last way is when we called by passing a metadata collection name returns
information about items found in the specified collection.

Question:-What is DataGrid wheater its a Server Control or something else ?


Answer:DataGrid is Web server control a powerful tool for displaying information
from a data source. we can display editable data in a professional-looking grid by
setting only a few properties. The grid has a sophisticated object model that provides
you with great flexibility in how you display the data.

Question:-Define different execute methods of ADO.NET command object ?


Answer: ExecuteScalar:- This method returns a single value from the first row and
first column of the result get from the execution of SQL query.
ExecuteNonQuery:- This method executes the DML SQL query just like insert, delete
or update and then returns the number of rows affected by the action.
ExecuteReader:- This method returns DataReader object which is a forward-only
resultset.
ExecuteXMLReader:- This method is available for SQL Server 2000 or later. Upon
execution it builds XMLReader object from standard SQL query.

Question:-What DataReader class do in ADO.NET ?


Answer:To get read-only and forward only access to data we use DataReader .the
DataReader object reduces the system overhead because one row at a time is taken
into memory so it is quite lightweight. To get second object connection is
reconnected. We can create a DataReader object by execute Execute readre()
method. There are two Data Reader class one is SqlDataReader and other is
OleDbDataReader.

Question:-Why is ADO.NET serialization slower than ADO ?


Answer: ADO uses binary serialization while ADO.NET uses text based serialization.
Since the text takes more space, it takes longer to write it out.

Question:-Is XML is a component of ADO.NET ?


Answer: The answer of this question is always Yes because XML is an important
component of ADO.NET architecture .ADO.NET use XML to store and transfer
data.We not have to convert data to XML format.Datasets helps XML to integrate
with ADO.NET. XML schema plays a role to get table definition,column,datatypes and
constraints helps DataSet.

Question:- How to check if the Dataset has records ?


Answer:
if ds.Tables(0).Rows.Count= 0 then
'No record
else
'record found

Question:- What is the significance of CommandBehavior.CloseConnection ?


Answer: To avoid having to explicitly close the connection associated with the
command used to create either a SqlDataReader or and OleDbDataReader, pass the
CommandBehavior.CloseConnection argument to the ExecuteReader method of the
Connection.

dr= cmd.ExecuteReader(CommandBehavior.CloseConnection);

The associated connection will be closed automatically when the Close method of the
Datareader is called. This makes it all the more important to always remember to call
Close on your datareaders.

Question:-Which method do you invoke on the DataAdapter control to load


your generated dataset with data?
Answer: The Fill() method.

Question:-What is Dataset and Diffgram?


Answer: When sending and retrieving a DataSet from an XML Web service, the
DiffGram format is implicitly used. Additionally, when loading the contents of a
DataSet from XML using the ReadXml method, or when writing the contents of a
DataSet in XML using the WriteXml method, you can select that the contents be read
or written as a DiffGram. For more information, see Loading a DataSet from XML and
Writing a DataSet as XML Data. While the DiffGram format is primarily used by the
.NET Framework as a serialization format for the contents of a DataSet, you can also
use DiffGrams to modify data in tables in a Microsoft SQL Server™ 2000 database.

Question:-What is typed dataset ?


Answer: A typed dataset is very much similar to a normal dataset. But the only
difference is that the sehema is already present for the same. Hence any mismatch
in the column will generate compile time errors rather than runtime error as in the
case of normal dataset. Also accessing the column value is much easier than the
normal dataset as the column definition will be available in the schema.

Question:-How can you provide an alternating color scheme in a Repeater


control?
Answer: AlternatingItemTemplate Like the ItemTemplate element, but rendered for
every other row (alternating items) in the Repeater control. You can specify a
different appearance for the AlternatingItemTemplate element by setting its style
properties.

Question:-What are good ADO.NET object(s) to replace the ADO Recordset


object?
Answer: There are alot...but the base once are SqlConnection, OleDbConnection,
etc...

Question:-Can you explain the difference between an ADO.NET Dataset and


an ADO Recordset?
Answer:Valid answers are:

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

Question:-What are the differences between Datalist DataGrid and


datarepeater ?
Answer:DataList

• Has table appearence by default


• Has no autoformat option
• has no default paging & sorting options
• can define separators between elements using template
DataGrid
• Has a grid appearence by default
• has a autoformat option
• has default paging and sorting
• has no separator between elements
DataRepeater
• simple,read-only output, has no built in support for selecting or editing items,
has no DEFAULT APPEARENCE, has no default paging.

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()?
Response.Output.Write() allows you to write formatted output.

3. What methods are fired during the page load?


Init() - when the page is instantiated
Load() - when the page is loaded into server memory
PreRender() - the brief moment before the page is displayed to the user as HTML
Unload() - when page finishes loading.

4. When during the page processing cycle is ViewState available?


After the Init() and before the Page_Load(), or OnLoad() for a control.

5. What namespace does the Web page belong in the .NET Framework class
hierarchy?
System.Web.UI.Page

6. Where do you store the information about the user’s locale?


System.Web.UI.Page.Culture

7. What’s the difference between Codebehind="MyCode.aspx.cs"


andSrc="MyCode.aspx.cs"?
CodeBehind is relevant to Visual Studio.NET only.

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

9. Suppose you want a certain ASP.NET function executed on MouseOver for


a certain button. Where do you add an event handler?
Add an OnMouseOver attribute to the button. Example:
btnSubmit.Attributes.Add("onmouseover","someClientCodeHere();");
10. What data types do the RangeValidator control support?
Integer, String, and Date.

11. Explain the differences between Server-side and Client-side code?


Server-side code executes on the server. Client-side code executes in the
client's browser.

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


The answer is server-side code since code-behind is executed on the server. However,
during the code-behind's execution on the server, it can render client-side code such
as JavaScript to be processed in the clients browser. But just to be clear, code-behind
executes on the server, thus making it server-side code.

13. Should user input data validation occur server-side or client-side? Why?
All user input data validation should occur on the server at a minimum. Additionally,
client-side validation can be performed where deemed appropriate and feasable to
provide a richer, more responsive experience for the user.

14. What is the difference between Server.Transfer and Response.Redirect? Why


would I choose one over the other?
Server.Transfer transfers page processing from one page directly to the next page
without making a round-trip back to the client's browser. This provides a faster
response with a little less overhead on the server. Server.Transfer does not update the
clients url history list or current url. Response.Redirect is used to redirect the user's
browser to another page or site. This performas a trip back to the client where the
client's browser is redirected to the new page. The user's browser history list is
updated to reflect the new address.

15. Can you explain the difference between an ADO.NET Dataset and an ADO
Recordset?
Valid answers are:
· 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. What is the Global.asax used for?


The Global.asax (including the Global.asax.cs file) is used to implement application
and session level events.

17. What are the Application_Start and Session_Start subroutines used for?
This is where you can set the specific variables for the Application and Session
objects.

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. Example: With
a base class named 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. A good use is 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. MSIL also allows the .NET Framework to JIT compile the assembly
on the installed computer.

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

31. Which control would you use if you needed to make sure the values in two
different controls matched?
CompareValidator control.
32. How many classes can a single .NET DLL contain?
It can contain many classes.

Web Service Questions

1. What is the transport protocol you use to call a Web service?


SOAP (Simple Object Access Protocol) is the preferred protocol.

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


False

3. What does WSDL stand for?


Web Services Description Language.

4. Where on the Internet would you look for Web services?


http://www.uddi.org

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

State Management Questions

1. What is ViewState?
ViewState allows the state of objects (serializable) to be stored in a hidden field on the
page. ViewState is transported to the client and back to the server, and is not stored
on the server or any other external source. ViewState is used the retain the state of
server-side objects between postabacks.

2. What is the lifespan for items stored in ViewState?


Item stored in ViewState exist for the life of the current page. This includes postbacks
(to the same page).

3. What does the "EnableViewState" property do? Why would I want it on or


off?
It allows the page to save the users input on a form across postbacks. It saves the
server-side values for a given control into ViewState, which is stored as a hidden value
on the page before sending the page to the clients browser. When the page is posted
back to the server the server control is recreated with the state stored in viewstate.

4. What are the different types of Session state management options available
with ASP.NET?
ASP.NET provides In-Process and Out-of-Process state management. In-Process
stores the session in memory on the web server. This requires the a "sticky-server"
(or no load-balancing) so that the user is always reconnected to the same web server.
Out-of-Process Session state management stores data in an external data source. The
external data source may be either a SQL Server or a State Server service. Out-of-
Process state management requires that all objects stored in session are serializable.
NET Remoting Interview Questions

To Do: Comfirm these are correct answers. Many of these question I have obtained
from other sources and have found they are not entirely correct, or simply wrong.

1. What’s a Windows process?


It’s an application that’s running and had been allocated memory.

2. What’s typical about a Windows process in regards to memory allocation?


Each process is allocated its own block of available RAM space, no process can access
another process’ code or data. If the process crashes, it dies alone without taking the
entire OS or a bunch of other applications down.

3. Explain what relationship is between a Process, Application Domain, and


Application?
A process is an instance of a running application. An application is an executable on
the hard drive or network. There can be numerous processes launched of the same
application (5 copies of Word running), but 1 process can run just 1 application.

4. What are possible implementations of distributed applications in .NET?


.NET Remoting and ASP.NET Web Services. If we talk about the Framework Class
Library, noteworthy classes are in System.Runtime.Remoting and
System.Web.Services.

5. What are the consideration in deciding to use .NET Remoting or ASP.NET Web
Services?
Remoting is a more efficient communication exchange when you can control both ends
of the application involved in the communication process. Web Services provide an
open-protocol-based exchange of informaion. Web Services are best when you need
to communicate with an external organization or another (non-.NET) technology.

6. What’s a proxy of the server object in .NET Remoting?


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.

7. What are remotable objects in .NET Remoting?


Remotable objects are the objects that can be marshaled across the application
domains. You can marshal by value, where a deep copy of the object is created and
then passed to the receiver. You can also marshal by reference, where just a reference
to an existing object is passed.

8. What are channels in .NET Remoting?


Channels represent the objects that transfer the other serialized objects from one
application domain to another and from one computer to another, as well as one
process to another on the same box. A channel must exist before an object can be
transferred.

9. What security measures exist for .NET Remoting in


System.Runtime.Remoting?
None. Security should be taken care of at the application level. Cryptography and
other security techniques can be applied at application or server level.
10. What is a formatter?
A formatter is an object that is responsible for encoding and serializing data into
messages on one end, and deserializing and decoding messages into data on the other
end.

11. Choosing between HTTP and TCP for protocols and Binary and SOAP for
formatters, what are the trade-offs?
Binary over TCP is the most effiecient, SOAP over HTTP is the most interoperable.

12. What’s SingleCall activation mode used for?


If the server object is instantiated for responding to just one single request, the
request should be made in SingleCall mode.

13. What’s Singleton activation mode?


A single object is instantiated regardless of the number of clients accessing it. Lifetime
of this object is determined by lifetime lease.

14. How do you define the lease of the object?


By implementing ILease interface when writing the class code.

15. Can you configure a .NET Remoting object via XML file?
Yes, via machine.config and application level .config file (or web.config in ASP.NET).
Application-level XML settings take precedence over machine.config.

16. How can you automatically generate interface for the remotable object in
.NET with Microsoft tools?
Use the Soapsuds tool.

C# Interview Questions

This is a list of questions I have gathered from other sources and created myself over a period
of time from my experience, many of which I felt where incomplete or simply wrong. I have
finally taken the time to go through each question and correct them to the best of my ability.
However, please feel free to post feedback to challenge, improve, or suggest new questions. I
want to thank those of you that have contributed quality questions and corrections thus far.

There are some question in this list that I do not consider to be good questions for an
interview. However, they do exist on other lists available on the Internet so I felt compelled to
keep them easy access.

General Questions

1. Does C# support multiple-inheritance?


No.
2. Who is a protected class-level variable available to?
It is available to any sub-class (a class inheriting this class).

3. Are private class-level variables inherited?


Yes, but they are not accessible. Although they are not visible or accessible via the
class interface, they are inherited.

4. Describe the accessibility modifier “protected internal”.


It is available to classes that are within the same assembly and derived from the
specified base class.

5. What’s the top .NET class that everything is derived from?


System.Object.

6. What does the term immutable mean?


The data value may not be changed. Note: The variable value may be changed, but
the original immutable data value was discarded and a new data value was created in
memory.

7. What’s the difference between System.String and System.Text.StringBuilder


classes?
System.String is immutable. System.StringBuilder was designed with the purpose of
having a mutable string where a variety of operations can be performed.

8. What’s the advantage of using System.Text.StringBuilder over System.String?


StringBuilder is more efficient in cases where there is a large amount of string
manipulation. Strings are immutable, so each time a string is changed, a new
instance in memory is created.

9. Can you store multiple data types in System.Array?


No.

10. What’s the difference between the System.Array.CopyTo() and


System.Array.Clone()?
The Clone() method returns a new array (a shallow copy) object containing all the
elements in the original array. The CopyTo() method copies the elements into another
existing array. Both perform a shallow copy. A shallow copy means the contents
(each array element) contains references to the same object as the elements in the
original array. A deep copy (which neither of these methods performs) would create a
new instance of each element's object, resulting in a different, yet identacle object.

11. How can you sort the elements of the array in descending order?
By calling Sort() and then Reverse() methods.

12. What’s the .NET collection class that allows an element to be accessed using
a unique key?
HashTable.

13. What class is underneath the SortedList class?


A sorted HashTable.

14. Will the finally block get executed if an exception has not occurred?
Yes.
15. What’s the C# syntax to catch any possible exception?
A catch block that catches the exception of type System.Exception. You can also omit
the parameter data type in this case and just write catch {}.

16. Can multiple catch blocks be executed for a single try statement?
No. Once the proper catch block processed, control is transferred to the finally block
(if there are any).

17. Explain the three services model commonly know as a three-tier application.
Presentation (UI), Business (logic and underlying code) and Data (from storage or
other sources).

Class Questions

1. What is the syntax to inherit from a class in C#?


Place a colon and then the name of the base class.
Example: class MyNewClass : MyBaseClass

2. Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.

3. Can you allow a class to be inherited, but prevent the method from being
over-ridden?
Yes. Just leave the class public and make the method sealed.

4. What’s an abstract class?


A class that cannot be instantiated. An abstract class is a class that must be inherited
and have the methods overridden. An abstract class is essentially a blueprint for a
class without any implementation.

5. When do you absolutely have to declare a class as abstract?


1. When the class itself is inherited from an abstract class, but not all base abstract
methods have been overridden.
2. When at least one of the methods in the class is abstract.

6. What is an interface class?


Interfaces, like classes, define a set of properties, methods, and events. But unlike
classes, interfaces do not provide implementation. They are implemented by classes,
and defined as separate entities from classes.

7. Why can’t you specify the accessibility modifier for methods inside the
interface?
They all must be public, and are therefore public by default.

8. Can you inherit multiple interfaces?


Yes. .NET does support multiple interfaces.

9. What happens if you inherit multiple interfaces and they have conflicting
method names?
It’s up to you to implement the method inside your own class, so implementation is
left entirely up to you. This might cause a problem on a higher-level scale if similarly
named methods from different interfaces expect different data, but as far as compiler
cares you’re okay.
To Do: Investigate

10. What’s the difference between an interface and abstract class?


In an interface class, all methods are abstract - there is no implementation. In an
abstract class some methods can be concrete. In an interface class, no accessibility
modifiers are allowed. An abstract class may have accessibility modifiers.

11. What is the difference between a Struct and a Class?


Structs are value-type variables and are thus saved on the stack, additional overhead
but faster retrieval. Another difference is that structs cannot inherit.

Method and Property Questions

1. What’s the implicit name of the parameter that gets passed into the set
method/property of a class?
Value. The data type of the value parameter is defined by whatever data type the
property is declared as.

2. What does the keyword “virtual” declare for a method or property?


The method or property can be overridden.

3. How is method overriding different from method overloading?


When overriding a method, you change the behavior of the method for the derived
class. Overloading a method simply involves having another method with the same
name within the class.

4. Can you declare an override method to be static if the original method is not
static?
No. The signature of the virtual method must remain the same. (Note: Only the
keyword virtual is changed to keyword override)

5. What are the different ways a method can be overloaded?


Different parameter data types, different number of parameters, different order of
parameters.

6. If a base class has a number of overloaded constructors, and an inheriting


class has a number of overloaded constructors; can you enforce a call from an
inherited constructor to a specific base constructor?
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.

Events and Delegates

1. What’s a delegate?
A delegate object encapsulates a reference to a method.

2. What’s a multicast delegate?


A delegate that has multiple handlers assigned to it. Each assigned handler (method)
is called.
XML Documentation Questions

1. Is XML case-sensitive?
Yes.

2. What’s the difference between // comments, /* */ comments and ///


comments?
Single-line comments, multi-line comments, and XML documentation comments.

3. How do you generate documentation from the C# file commented properly


with a command-line compiler?
Compile it with the /doc switch.

Debugging and 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 difference between the Debug class and Trace class?
Documentation looks the same. Use Debug class for debug builds, use Trace class for
both debug and release builds.

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.

ADO.NET and Database Questions


1. What is the role of the DataReader class in ADO.NET connections?
It returns a read-only, forward-only rowset from the data source. A DataReader
provides fast access when a forward-only sequential read is needed.

2. What are advantages and disadvantages of Microsoft-provided data provider


classes in ADO.NET?
SQLServer.NET data provider is high-speed and robust, but requires SQL Server
license purchased from Microsoft. OLE-DB.NET is universal for accessing other sources,
like Oracle, DB2, Microsoft Access and Informix. OLE-DB.NET is a .NET layer on top of
the OLE layer, so it’s not as fastest and efficient as SqlServer.NET.

3. What is the wildcard character in SQL?


Let’s say you want to query database with LIKE for all employees whose name starts
with La. The wildcard character is %, the proper query with LIKE would involve ‘La%’.

4. Explain ACID rule of thumb for transactions.


A transaction must be:
1. Atomic - it is one unit of work and does not dependent on previous and
following transactions.
2. Consistent - data is either committed or roll back, no “in-between” case where
something has been updated and something hasn’t.
3. Isolated - no transaction sees the intermediate results of the current
transaction).
4. Durable - the values persist if the data had been committed even if the system
crashes right after.

5. What connections does Microsoft SQL Server support?


Windows Authentication (via Active Directory) and SQL Server authentication (via
Microsoft SQL Server username and password).

6. Between Windows Authentication and SQL Server Authentication, which one


is trusted and which one is untrusted?
Windows Authentication is trusted because the username and password are checked
with the Active Directory, the SQL Server authentication is untrusted, since SQL Server
is the only verifier participating in the transaction.

7. What does the Initial Catalog parameter define in the connection string?
The database name to connect to.

8. What does the Dispose method do with the connection object?


Deletes it from the memory.
To Do: answer better. The current answer is not entirely correct.

9. What is a pre-requisite for connection pooling?


Multiple processes must agree that they will share the same connection, where every
parameter is the same, including the security settings. The connection string must be
identical.

Assembly Questions

1. How is the DLL Hell problem solved in .NET?


Assembly versioning allows the application to specify not only the library it needs to
run (which was available under Win32), but also the version of the assembly.
2. What are the ways to deploy an assembly?
An MSI installer, a CAB archive, and XCOPY command.

3. What is a satellite assembly?


When you write a multilingual or multi-cultural application in .NET, and want to
distribute the core application separately from the localized modules, the localized
assemblies that modify the core application are called satellite assemblies.

4. What namespaces are necessary to create a localized application?


System.Globalization and System.Resources.

5. What is the smallest unit of execution in .NET?


an Assembly.

6. When should you call the garbage collector in .NET?


As a good rule, you should not call the garbage collector. However, you could call the
garbage collector when you are done using a large object (or set of objects) to force
the garbage collector to dispose of those very large objects from memory. However,
this is usually not a good practice.

7. How do you convert a value-type to a reference-type?


Use Boxing.

8. What happens in memory when you Box and Unbox a value-type?


Boxing converts a value-type to a reference-type, thus storing the object on the heap.
Unboxing converts a reference-type to a value-type, thus storing the value on the
stack.

ASP.NET 2.0 Interview Questions –


(Intermediate)
The Q&A mentioned over here have been taken from forums, my colleagues and my
own experience of conducting interviews. I have tried to mention the contributor
wherever possible. If you would like to contribute, kindly use the Contact form. If you
think that a credit for a contribution is missing somewhere, kindly use the same
contact form and I will do the needful.
What is XHTML? Are ASP.NET Pages compliant with XHTML?
In simple words, XHTML is a stricter and cleaner version of HTML. XHTML stands for
EXtensible Hypertext Markup Language and is a W3C Recommendation.
Yes, ASP.NET 2.0 Pages are XHTML compliant. However the freedom has been given
to the user to include the appropriate document type declaration.
More info can be found at http://msdn2.microsoft.com/en-us/library/exc57y7e.aspx
Can I deploy the application without deploying the source code on the
server?
Yes. You can obfuscate your code by using a new precompilation process called
‘precompilation for deployment’. You can use the aspnet_compiler.exe to precompile
a site. This process builds each page in your web application into a single application
DLL and some placeholder files. These files can then be deployed to the server.
You can also accomplish the same task using Visual Studio 2005 by using the Build-
>Publish menu.
Does ViewState affect performance? What is the ideal size of a ViewState?
How can you compress a viewstate?
Viewstate stores the state of controls in HTML hidden fields. At times, this
information can grow in size. This does affect the overall responsiveness of the page,
thereby affecting performance. The ideal size of a viewstate should be not more than
25-30% of the page size.
Viewstate can be compressed to almost 50% of its size. .NET also provides the
GZipStream or DeflateStream to compress viewstate. Another option is explained
by Scott Hanselmann over here.
How can you detect if a viewstate has been tampered?
By setting the EnableViewStateMac to true in the @Page directive. This attribute
checks the encoded and encrypted viewstate for tampering.
Can I use different programming languages in the same application?
Yes. Each page can be written with a different programming language in the same
application. You can create a few pages in C# and a few in VB.NET.
Can the App_Code folder contain source code files in different programming
languages?
No. All source code files kept in the App_Code folder must be in the same
programming language.
How do you secure your connection string information?
By using the Protected Configuration feature.
How do you secure your configuration files to be accessed remotely by
unauthorized users?
ASP.NET configures IIS to deny access to any user that requests access to the
Machine.config or Web.config files.
How can I configure ASP.NET applications that are running on a remote
machine?
You can use the Web Site Administration Tool to configure remote websites.
How many web.config files can I have in an application?
You can keep multiple web.config files in an application. You can place a Web.config
file inside a folder or wherever you need (apart from some exceptions) to override
the configuration settings that are inherited from a configuration file located at a
higher level in the hierarchy.
I have created a configuration setting in my web.config and have kept it at
the root level. How do I prevent it from being overridden by another
web.config that appears lower in the hierarchy?
By setting the element's Override attribute to false.
What is the difference between Response.Write and
Response.Output.Write?
As quoted by Scott Hanselman, the short answer is that the latter gives you
String.Format-style output and the former doesn't.
To get a detailed explanation, follow this link.
What is Cross Page Posting? How is it done?
By default, ASP.NET submits a form to the same page. In cross-page posting, the
form is submitted to a different page. This is done by setting the ‘PostBackUrl’
property of the button(that causes postback) to the desired page. In the code-behind
of the page to which the form has been posted, use the ‘FindControl’ method of the
‘PreviousPage’ property to reference the data of the control in the first page.
Can you change a Master Page dynamically at runtime? How?
Yes. To change a master page, set the MasterPageFile property to point to the
.master page during the PreInit page event.
How do you apply Themes to an entire application?
By specifying the theme in the web.config file.
Eg: <configuration>
<system.web>
<pages theme=”BlueMoon” />
</system.web>
</configuration>

How do you exclude an ASP.NET page from using Themes?


To remove themes from your page, use the EnableTheming attribute of the Page
directive.
Your client complains that he has a large form that collects user input. He
wants to break the form into sections, keeping the information in the forms
related. Which control will you use?
The ASP.NET Wizard Control.
To learn more about this control, visit this link.
Do webservices support data reader?
No. However it does support a dataset.
What is use of the AutoEventWireup attribute in the Page directive ?
The AutoEventWireUp is a boolean attribute that allows automatic wireup of page
events when this attribute is set to true on the page. It is set to True by default for a
C# web form whereas it is set as False for VB.NET forms. Pages developed with
Visual Studio .NET have this attribute set to false, and page events are individually
tied to handlers.
What happens when you change the web.config file at
run time?
ASP.NET invalidates the existing cache and assembles a new cache. Then ASP.NET
automatically restarts the application to apply the changes.
Can you programmatically access IIS configuration
settings?
Yes. You can use ADSI, WMI, or COM interfaces to configure IIS programmatically.

ASP.NET 2.0 Interview Questions –


Beginner Level (Part 1)
The Q&A mentioned over here have been taken from forums, my colleagues and my
own experience of conducting interviews. I have tried to mention the contributor
wherever possible. If you would like to contribute, kindly use the Contact form. If you
think that a credit for a contribution is missing somewhere, kindly use the same
contact form and I will do the needful.
What is ASP.NET?
Microsoft ASP.NET is a server side technology that enables programmers to build
dynamic Web sites, web applications, and XML Web services. It is a part of the .NET
based environment and is built on the Common Language Runtime (CLR) . So
programmers can write ASP.NET code using any .NET compatible language.
What are the differences between ASP.NET 1.1 and ASP.NET 2.0?
A comparison chart containing the differences between ASP.NET 1.1 and ASP.NET 2.0
can be found over here.
Which is the latest version of ASP.NET? What were the previous versions
released?
The latest version of ASP.NET is 2.0. There have been 3 versions of ASP.NET released
as of date. They are as follows :
ASP.NET 1.0 – Released on January 16, 2002.
ASP.NET 1.1 – Released on April 24, 2003.
ASP.NET 2.0 – Released on November 7, 2005.
Additionally, ASP.NET 3.5 is tentatively to be released by the end of the 2007.
Explain the Event Life cycle of ASP.NET 2.0?
The events occur in the following sequence. Its best to turn on tracing(<% @Page
Trace=”true”%>) and track the flow of events :
PreInit – This event represents the entry point of the page life cycle. If you need to
change the Master page or theme programmatically, then this would be the event to
do so. Dynamic controls are created in this event.
Init – Each control in the control collection is initialized.
Init Complete* - Page is initialized and the process is completed.
PreLoad* - This event is called before the loading of the page is completed.
Load – This event is raised for the Page and then all child controls. The controls
properties and view state can be accessed at this stage. This event indicates that the
controls have been fully loaded.
LoadComplete* - This event signals indicates that the page has been loaded in the
memory. It also marks the beginning of the rendering stage.
PreRender – If you need to make any final updates to the contents of the controls
or the page, then use this event. It first fires for the page and then for all the
controls.
PreRenderComplete* - Is called to explicitly state that the PreRender phase is
completed.
SaveStateComplete* - In this event, the current state of the control is completely
saved to the ViewState.
Unload – This event is typically used for closing files and database connections. At
times, it is also used for logging some wrap-up tasks.
The events marked with * have been introduced in ASP.NET 2.0.
You have created an ASP.NET Application. How will you run it?
With ASP.NET 2.0, Visual Studio comes with an inbuilt ASP.NET Development Server
to test your pages. It functions as a local Web server. The only limitation is that
remote machines cannot access pages running on this local server. The second
option is to deploy a Web application to a computer running IIS version 5 or 6 or 7.
Explain the AutoPostBack feature in ASP.NET?
AutoPostBack allows a control to automatically postback when an event is fired. For
eg: If we have a Button control and want the event to be posted to the server for
processing, we can set AutoPostBack = True on the button.
How do you disable AutoPostBack?
Hence the AutoPostBack can be disabled on an ASP.NET page by disabling
AutoPostBack on all the controls of a page. AutoPostBack is caused by a control on
the page.
What are the different code models available in ASP.NET 2.0?
There are 2 code models available in ASP.NET 2.0. One is the single-file page and the
other one is the code behind page.
Which base class does the web form inherit from?
Page class in the System.Web.UI namespace.
Which are the new special folders that are introduced in ASP.NET 2.0?
There are seven new folders introduced in ASP.NET 2.0 :
\App_Browsers folder – Holds browser definitions(.brower) files which identify the
browser and their capabilities.
\App_Code folder – Contains source code (.cs, .vb) files which are automatically
compiled when placed in this folder. Additionally placing web service files generates a
proxy class(out of .wsdl) and a typed dataset (out of .xsd).
\App_Data folder – Contains data store files like .mdf (Sql Express files), .mdb,
XML files etc. This folder also stores the local db to maintain membership and role
information.
\App_GlobalResources folder – Contains assembly resource files (.resx) which
when placed in this folder are compiled automatically. In earlier versions, we were
required to manually use the resgen.exe tool to compile resource files. These files
can be accessed globally in the application.
\App_LocalResources folder – Contains assembly resource files (.resx) which can
be used by a specific page or control.
\App_Themes folder – This folder contains .css and .skin files that define the
appearance of web pages and controls.
\App_WebReferences folder – Replaces the previously used Web References
folder. This folder contains the .disco, .wsdl, .xsd files that get generated when
accessing remote web services.
Explain the ViewState in ASP.NET?
Http is a stateless protocol. Hence the state of controls is not saved between
postbacks. Viewstate is the means of storing the state of server side controls
between postbacks. The information is stored in HTML hidden fields. In other words,
it is a snapshot of the contents of a page.
You can disable viewstate by a control by setting the EnableViewState property to
false.
What does the EnableViewState property signify?
EnableViewState saves the state of an object in a page between postbacks. Objects
are saved in a Base64 encoded string. If you do not need to store the page, turn it
off as it adds to the page size.
There is an excellent article by Peter Bromberg to understand Viewstate in depth.
Explain the ASP.NET Page Directives?
Page directives configure the runtime environment that will execute the page. The
complete list of directives is as follows:
@ Assembly - Links an assembly to the current page or user control declaratively.
@ Control - Defines control-specific attributes used by the ASP.NET page parser and
compiler and can be included only in .ascx files (user controls).
@ Implements - Indicates that a page or user control implements a specified .NET
Framework interface declaratively.
@ Import - Imports a namespace into a page or user control explicitly.
@ Master - Identifies a page as a master page and defines attributes used by the
ASP.NET page parser and compiler and can be included only in .master files.
@ MasterType - Defines the class or virtual path used to type the Master property of
a page.
@ OutputCache - Controls the output caching policies of a page or user control
declaratively.
@ Page - Defines page-specific attributes used by the ASP.NET page parser and
compiler and can be included only in .aspx files.
@ PreviousPageType - Creates a strongly typed reference to the source page from
the target of a cross-page posting.
@ Reference - Links a page, user control, or COM control to the current page or user
control declaratively.
@ Register - Associates aliases with namespaces and classes, which allow user
controls and custom server controls to be rendered when included in a requested
page or user control.
This list has been taken from here.
Explain the Validation Controls used in ASP.NET 2.0?
Validation controls allows you to validate a control against a set of rules. There are 6
different validation controls used in ASP.NET 2.0.
RequiredFieldValidator – Checks if the control is not empty when the form is
submitted.
CompareValidator – Compares the value of one control to another using a
comparison operator (equal, less than, greater than etc).
RangeValidator – Checks whether a value falls within a given range of number, date
or string.
RegularExpressionValidator – Confirms that the value of a control matches a pattern
defined by a regular expression. Eg: Email validation.
CustomValidator – Calls your own custom validation logic to perform validations that
cannot be handled by the built in validators.
ValidationSummary – Show a summary of errors raised by each control on the page
on a specific spot or in a message box.
How do you indentify that the page is post back?
By checking the IsPostBack property. If IsPostBack is True, the page has been posted
back.
What are Master Pages?
Master pages is a template that is used to create web pages with a consistent layout
throughout your application. Master Pages contains content placeholders to hold
page specific content. When a page is requested, the contents of a Master page are
merged with the content page, thereby giving a consistent layout.
How is a Master Page different from an ASP.NET page?
The MasterPage has a @Master top directive and contains ContentPlaceHolder server
controls. It is quiet similar to an ASP.NET page.
How do you attach an exisiting page to a Master page?
By using the MasterPageFile attribute in the @Page directive and removing some
markup.
How do you set the title of an ASP.NET page that is attached to a Master
Page?
By using the Title property of the @Page directive in the content page. Eg:
<@Page MasterPageFile="Sample.master" Title="I hold content" %>
What is a nested master page? How do you create them?
A Nested master page is a master page associated with another master page. To
create a nested master page, set the MasterPageFile attribute of the @Master
directive to the name of the .master file of the base master page.
What are Themes?
Themes are a collection of CSS files, .skin files, and images. They are text based
style definitions and are very similar to CSS, in that they provide a common look and
feel throughout the website.
What are skins?
A theme contains one or more skin files. A skin is simply a text file with a .skin
extension and contains definition of styles applied to server controls in an ASP.NET
page. For eg:
<asp:button runat="server" BackColor="blue" BorderColor="Gray" Font-Bold ="true"
ForeColor="white"/>
Defines a skin that will be applied to all buttons throughout to give it a consistent
look and feel.
What is the difference between Skins and Css files?
Css is applied to HTML controls whereas skins are applied to server controls.
What is a User Control?
User controls are reusable controls, similar to web pages. They cannot be accessed
directly.
Explain briefly the steps in creating a user control?
• Create a file with .ascx extension and place the @Control directive at top of the
page.
• Included the user control in a Web Forms page using a @Register directive
What is a Custom Control?
Custom controls are compiled components that run on the server and that
encapsulate user-interface and other related functionality into reusable packages.
They can include all the design-time features of standard ASP.NET server controls,
including full support for Visual Studio design features such as the Properties
window, the visual designer, and the Toolbox.
What are the differences between user and custom controls?
User controls are easier to create in comparison to custom controls, however user
controls can be less convenient to use in advanced scenarios.
User controls have limited support for consumers who use a visual design tool
whereas custom controls have full visual design tool support for consumers.
A separate copy of the user control is required in each application that uses it
whereas only a single copy of the custom control is required, in the global assembly
cache, which makes maintenance easier.
A user control cannot be added to the Toolbox in Visual Studio whereas custom
controls can be added to the Toolbox in Visual Studio.
User controls are good for static layout whereas custom controls are good for
dynamic layout.
Where do you store your connection string information?
The connection string can be stored in configuration files (web.config).
What is the difference between ‘Web.config’ and ‘Machine.config’?
Web.config files are used to apply configuration settings to a particular web
application whereas machine.config file is used to apply configuration settings for all
the websites on a web server.
Web.config files are located in the application's root directory or inside a folder
situated in a lower hierarchy. The machine.config is located in the Windows directory
Microsoft.Net\Framework\Version\CONFIG.
There can be multiple web.config files in an application nested at different
hierarchies. However there can be only one machine.config file on a web server.
What is the difference between Server.Transfer and Response.Redirect?
Response.Redirect involves a roundtrip to the server whereas Server.Transfer
conserves server resources by avoiding the roundtrip. It just changes the focus of
the webserver to a different page and transfers the page processing to a different
page.
Response.Redirect can be used for both .aspx and html pages whereas
Server.Transfer can be used only for .aspx pages.
Response.Redirect can be used to redirect a user to an external websites.
Server.Transfer can be used only on sites running on the same server. You cannot
use Server.Transfer to redirect the user to a page running on a different server.
Response.Redirect changes the url in the browser. So they can be bookmarked.
Whereas Server.Transfer retains the original url in the browser. It just replaces the
contents of the previous page with the new one.
What method do you use to explicitly kill a users session?
Session.Abandon().
What is a webservice?
Web Services are applications delivered as a service on the Web. Web services allow
for programmatic access of business logic over the Web. Web services typically rely
on XML-based protocols, messages, and interface descriptions for communication
and access. Web services are designed to be used by other programs or applications
rather than directly by end user. Programs invoking a Web service are called clients.
SOAP over HTTP is the most commonly used protocol for invoking Web services

What is .NET?
.NET is essentially a framework for software development. It is similar in
nature to any other software development framework (J2EE etc) in that it
provides a set of runtime containers/capabilities, and a rich set of pre-built
functionality in the form of class libraries and APIs
The .NET Framework is an environment for building, deploying, and
running Web Services and other applications. It consists of three main
parts: the Common Language Runtime, the Framework classes, and
ASP.NET.

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.

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.

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.

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.

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

How do you validate the controls in an ASP .NET page?


Using special validation controls that are meant for this. We have Range
Validator, Email Validator.

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.

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.

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.

Observations between VB.NET and VC#.NET?


Choosing a programming language depends on your language experience
and the scope of the application you are building. While small applications
are often created using only one language, it is not uncommon to develop
large applications using multiple languages.

For example, if you are extending an application with existing XML Web
services, you might use a scripting language with little or no programming
effort. For client-server applications, you would probably choose the single
language you are most comfortable with for the entire application. For new
enterprise applications, where large teams of developers create components
and services for deployment across multiple remote sites, the best choice
might be to use several languages depending on developer skills and long-
term maintenance expectations.

The .NET Platform programming languages - including Visual Basic .NET,


Visual C#, and Visual C++ with managed extensions, and many other
programming languages from various vendors - use .NET Framework
services and features through a common set of unified classes. The .NET
unified classes provide a consistent method of accessing the platform's
functionality. If you learn to use the class library, you will find that all tasks
follow the same uniform architecture. You no longer need to learn and
master different API architectures to write your applications.

In most situations, you can effectively use all of the Microsoft programming
languages. Nevertheless, each programming language has its relative
strengths and you will want to understand the features unique to each
language. The following sections will help you choose the right programming
language for your application.

Visual Basic .NET


Visual Basic .NET is the next generation of the Visual Basic language from
Microsoft. With Visual Basic you can build .NET applications, including Web
services and ASP.NET Web applications, quickly and easily. Applications
made with Visual Basic are built on the services of the common language
runtime and take advantage of the .NET Framework.

Visual Basic has many new and improved features such as inheritance,
interfaces, and overloading that make it a powerful object-oriented
programming language. Other new language features include free threading
and structured exception handling. Visual Basic fully integrates the .NET
Framework and the common language runtime, which together provide
language interoperability, garbage collection, enhanced security, and
improved versioning support. A Visual Basic support single inheritance and
creates Microsoft intermediate language (MSIL) as input to native code
compilers.

Visual Basic is comparatively easy to learn and use, and Visual Basic has
become the programming language of choice for hundreds of thousands of
developers over the past decade. An understanding of Visual Basic can be
leveraged in a variety of ways, such as writing macros in Visual Studio and
providing programmability in applications such as Microsoft Excel, Access,
and Word.

Visual Basic provides prototypes of some common project types, including:


• Windows Application.
• Class Library.
• Windows Control Library.
• ASP.NET Web Application.
• ASP.NET Web Service.
• Web Control Library.
• Console Application.
• Windows Service.
• Windows Service.
Visual C# .NET

Visual C# (pronounced C sharp) is designed to be a fast and easy way to


create .NET applications, including Web services and ASP.NET Web
applications. Applications written in Visual C# are built on the services of
the common language runtime and take full advantage of the .NET
Framework.

C# is a simple, elegant, type-safe, object-oriented language recently


developed by Microsoft for building a wide range of applications. Anyone
familiar with C and similar languages will find few problems in adapting to
C#. C# is designed to bring rapid development to the C++ programmer
without sacrificing the power and control that are a hallmark of C and C++.
Because of this heritage, C# has a high degree of fidelity with C and C++,
and developers familiar with these languages can quickly become productive
in C#. C# provides intrinsic code trust mechanisms for a high level of
security, garbage collection, and type safety. C# supports single inheritance
and creates Microsoft intermediate language (MSIL) as input to native code
compilers.

C# is fully integrated with the .NET Framework and the common language
runtime, which together provide language interoperability, garbage
collection, enhanced security, and improved versioning support. C#
simplifies and modernizes some of the more complex aspects of C and C++,
notably namespaces, classes, enumerations, overloading, and structured
exception handling. C# also eliminates C and C++ features such as macros,
multiple inheritance, and virtual base classes. For current C++ developers,
C# provides a powerful, high-productivity language alternative.

Visual C# provides prototypes of some common project types, including:


• Windows Application.
• Class Library.
• Windows Control Library.
• ASP.NET Web Application.
• ASP.NET Web Service.
• Web Control Library.
• Console Application.
• Windows Service.

Advantages of migrating to VB.NET ?


Visual Basic .NET has many new and improved language features — such
as inheritance, interfaces, and overloading that make it a powerful object-
oriented programming language. As a Visual Basic developer, you can now
create multithreaded, scalable applications using explicit multithreading.
Other new language features in Visual Basic .NET include structured
exception handling, custom attributes, and common language specification
(CLS) compliance.

The CLS is a set of rules that standardizes such things as data types and
how objects are exposed and interoperate. Visual Basic .NET adds several
features that take advantage of the CLS. Any CLS-compliant language can
use the classes, objects, and components you create in Visual Basic .NET.
And you, as a Visual Basic user, can access classes, components, and
objects from other CLS-compliant programming languages without worrying
about language-specific differences such as data types.

CLS features used by Visual Basic .NET programs include assemblies,


namespaces, and attributes.

These are the new features to be stated briefly:


Inheritance
Visual Basic .NET supports inheritance by allowing you to define classes
that serve as the basis for derived classes. Derived classes inherit and can
extend the properties and methods of the base class. They can also override
inherited methods with new implementations. All classes created with
Visual Basic .NET are inheritable by default. Because the forms you design
are really classes, you can use inheritance to define new forms based on
existing ones.

Exception Handling
Visual Basic .NET supports structured exception handling, using an
enhanced version of the Try...Catch...Finally syntax supported by other
languages such as C++.

Structured exception handling combines a modern control structure (similar


to Select Case or While) with exceptions, protected blocks of code, and
filters. Structured exception handling makes it easy to create and maintain
programs with robust, comprehensive error handlers.

Overloading
Overloading is the ability to define properties, methods, or procedures that
have the same name but use different data types. Overloaded procedures
allow you to provide as many implementations as necessary to handle
different kinds of data, while giving the appearance of a single, versatile
procedure. Overriding Properties and Methods The Overrides keyword allows
derived objects to override characteristics inherited from parent objects.
Overridden members have the same arguments as the members inherited
from the base class, but different implementations. A member's new
implementation can call the original implementation in the parent class by
preceding the member name with MyBase.

Constructors and Destructors


Constructors are procedures that control initialization of new instances of a
class. Conversely, destructors are methods that free system resources when
a class leaves scope or is set to Nothing. Visual Basic .NET supports
constructors and destructors using the Sub New and Sub Finalize
procedures.
Data Types
Visual Basic .NET introduces three new data types. The Char data type is an
unsigned 16-bit quantity used to store Unicode characters. It is equivalent
to the .NET Framework System. Char data type. The Short data type, a
signed 16-bit integer, was named Integer in earlier versions of Visual Basic.
The Decimal data type is a 96-bit signed integer scaled by a variable power
of 10. In earlier versions of Visual Basic, it was available only within a
Variant.

Interfaces
Interfaces describe the properties and methods of classes, but unlike
classes, do not provide implementations. The Interface statement allows you
to declare interfaces, while the Implements statement lets you write code
that puts the items described in the interface into practice.

Delegates
Delegates objects that can call the methods of objects on your behalf are
sometimes described as type-safe, object-oriented function pointers. You
can use delegates to let procedures specify an event handler method that
runs when an event occurs. You can also use delegates with multithreaded
applications. For details, see Delegates and the AddressOf Operator.

Shared Members
Shared members are properties, procedures, and fields that are shared by
all instances of a class. Shared data members are useful when multiple
objects need to use information that is common to all. Shared class methods
can be used without first creating an object from a class.

References
References allow you to use objects defined in other assemblies. In Visual
Basic .NET, references point to assemblies instead of type libraries. For
details, see References and the Imports Statement. Namespaces prevent
naming conflicts by organizing classes, interfaces, and methods into
hierarchies.

Assemblies
Assemblies replace and extend the capabilities of type libraries by,
describing all the required files for a particular component or application.
An assembly can contain one or more namespaces.

Attributes
Attributes enable you to provide additional information about program
elements. For example, you can use an attribute to specify which methods
in a class should be exposed when the class is used as a XML Web service.
Multithreading
Visual Basic .NET allows you to write applications that can perform multiple
tasks independently. A task that has the potential of holding up other tasks
can execute on a separate thread, a process known as multithreading. By
causing complicated tasks to run on threads that are separate from your
user interface, multithreading makes your applications more responsive to
user input.

Using ActiveX Control in .Net


ActiveX control is a special type of COM component that supports a User
Interface. Using ActiveX Control in your .Net Project is even easier than
using COM component. They are bundled usually in .ocx files. Again a proxy
assembly is made by .Net utility AxImp.exe (which we will see shortly) which
your application (or client) uses as if it is a .Net control or assembly.

Making Proxy Assembly For ActiveX Control: First, a proxy assembly is


made using AxImp.exe (acronym for ActiveX Import) by writing following
command on Command Prompt:

C:> AxImp C:MyProjectsMyControl.ocx


This command will make two dlls, e.g., in case of above command

MyControl.dll
AxMyControl.dll
The first file MyControl.dll is a .Net assembly proxy, which allows you to
reference the ActiveX as if it were non-graphical object.

The second file AxMyControl.dll is the Windows Control, which allows u to


use the graphical aspects of activex control and use it in the Windows Form
Project.

Adding Reference of ActiveX Proxy Assembly in your Project Settings: To add


a reference of ActiveX Proxy Assembly in our Project, do this:

o Select Project A Add Reference (Select Add Reference from Project Menu).
o This will show you a dialog box, select .Net tab from the top of window.
o Click Browse button on the top right of window.
o Select the dll file for your ActiveX Proxy Assembly (which is MyControl.dll)
and click OK o Your selected component is now shown in the ‘Selected
Component’ List Box. Click OK again Some More On Using COM or ActiveX
in .Net

.Net only provides wrapper class or proxy assembly (Runtime Callable


Wrapper or RCW) for COM or activeX control. In the background, it is
actually delegating the tasks to the original COM, so it does not convert your
COM/activeX but just imports them.
A good thing about .Net is that when it imports a component, it also imports
the components that are publically referenced by that component. So, if
your component, say MyDataAcsess.dll references ADODB.dll then .Net will
automatically import that COM component too!

The Visual Studio.NET does surprise you in a great deal when u see that it
is applying its intellisense (showing methods, classes, interfaces, properties
when placing dot) even on your imported COM components!!!! Isn’t it a
magic or what?

When accessing thru RCW, .Net client has no knowledge that it is using
COM component, it is presented just as another C# assembly.

U can also import COM component thru command prompt (for reference see
Professional C# by Wrox)

U can also use your .Net components in COM, i.e., export your .net
components (for reference see Professional C# by Wrox)

What is Machine.config?
Machine configuration file: The machine.config file contains settings that
apply to the entire computer. This file is located in the %runtime install
path%Config directory. There is only one machine.config file on a computer.
The Machine.Config file found in the "CONFIG" subfolder of your .NET
Framework install directory (c:WINNTMicrosoft.NETFramework{Version
Number} CONFIG on Windows 2000 installations). The machine.config,
which can be found in the directory
$WINDIR$Microsoft.NETFrameworkv1.0.3705CONFIG, is an XML-formatted
configuration file that specifies configuration options for the machine. This
file contains, among many other XML elements, a browser Caps element.
Inside this element are a number of other elements that specify parse rules
for the various User-Agents, and what properties each of these parsing
supports.

For example, to determine what platform is used, a filter element is used


that specifies how to set the platform property based on what platform name
is found in the User-Agent string. Specifically, the machine.config file
contains:

platform=Win95
platform=Win98
platform=WinNT
...

That is, if in the User-Agent string the string "Windows 95" or "Win95" is
found, the platform property is set to Win95. There are a number of filter
elements in the browserCaps element in the machine.config file that define
the various properties for various User-Agent strings.

Hence, when using the Request.Browser property to determine a user's


browser features, the user's agent string is matched up to particular
properties in the machine.config file. The ability for being able to detect a
user's browser's capabilities, then, is based upon the honesty in the
browser's sent User-Agent string. For example, Opera can be easily
configured to send a User-Agent string that makes it appear as if it's IE 5.5.
In this case from the Web server's perspective (and, hence, from your
ASP.NET Web page's perspective), the user is visiting using IE 5.5, even
though, in actuality, he is using Opera.

What is Web.config?
In classic ASP all Web site related information was stored in the metadata of
IIS. This had the disadvantage that remote Web developers couldn't easily
make Web-site configuration changes. For example, if you want to add a
custom 404 error page, a setting needs to be made through the IIS admin
tool, and you're Web host will likely charge you a flat fee to do this for you.
With ASP.NET, however, these settings are moved into an XML-formatted
text file (Web.config) 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 sitempilation options
for the ASP.NET Web pages, if tracing should be enabled, etc.
The Web.config file is an XML-formatted file. At the root level is the tag.
Inside this tag you can add a number of other tags, the most common and
useful one being the system.web tag, where you will specify most of the Web
site configuration parameters. However, to specify application-wide settings
you use the tag.

For example, if we wanted to add a database connection string parameter we


could have a Web.config file like so.

What is the difference between ADO and ADO.NET?


ADO uses Recordsets and cursors to access and modify data. Because of its
inherent design, Recordset can impact performance on the server side by
tying up valuable resources. In addition, COM marshalling - an expensive
data conversion process - is needed to transmit a Recordset. ADO.NET
addresses three important needs that ADO doesn't address:

1. Providing a comprehensive disconnected data-access model, which is


crucial to the Web environment
2. Providing tight integration with XML, and
3. Providing seamless integration with the .NET Framework (e.g.,
compatibility with the base class library's type system). From an ADO.NET
implementation perspective, the Recordset object in ADO is eliminated in
the .NET architecture. In its place, ADO.NET has several dedicated objects
led by the DataSet object and including the DataAdapter, and DataReader
objects to perform specific tasks. In addition, ADO.NET DataSets operate in
disconnected state whereas the ADO RecordSet objects operated in a fully
connected state.

In ADO, the in-memory representation of data is the RecordSet. In


ADO.NET, it is the dataset. 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.

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. A cursor is a database
element that controls record navigation, the ability to update data, and the
visibility of changes made to the database by other users. ADO.NET does
not have an inherent cursor object, but instead includes data classes that
provide the functionality of a traditional cursor. For example, the
functionality of a forward-only, read-only cursor is available in the ADO.NET
DataReader object.

There is one significant difference between disconnected processing in ADO


and ADO.NET. In ADO you communicate with the database by making calls
to an OLE DB provider. In ADO.NET you communicate with the database
through a data adapter (an OleDbDataAdapter, SqlDataAdapter,
OdbcDataAdapter, or OracleDataAdapter object), which makes calls to an
OLE DB provider or the APIs provided by the underlying data source.

What is a Web Service?


A web service is a software component that exposes itself through the open
communication channels of the Internet. Applications running on remote
machines, on potentially different platforms, can access these components
in a language and platform-independent manner. A Web Service is a group
of functions, packaged together for use in a common framework throughout
a network.

webFarm Vs webGardens
A web farm is a multi-server scenario. So we may have a server in each state
of US. If the load on one server is in excess then the other servers step in to
bear the brunt.
How they bear it is based on various models.
1. RoundRobin. (All servers share load equally)
2. NLB (economical)
3. HLB (expensive but can scale up to 8192 servers)
4. Hybrid (of 2 and 3).
5. CLB (Component load balancer).
A web garden is a multi-processor setup. i.e., a single server (not like the
multi server above).
How to implement webfarms in .Net:
Go to web.config and Here for mode = you have 4 options.
a) Say mode=inproc (non web farm but fast when you have very few
customers).
b) Say mode=StateServer (for webfarm)
c) Say mode=SqlServer (for webfarm)
Whether to use option b or c depends on situation. StateServer is faster but
SqlServer is more reliable and used for mission critical applications.
How to use webgardens in .Net:
Go to web.config and Change the false to true. You have one more attribute
that is related to webgarden in the same tag called cpuMask.

What is the difference between a namespace and assembly name?


A namespace is a logical naming scheme for types in which a simple type
name, such as MyType, is preceded with a dot-separated hierarchical name.
Such a naming scheme is completely under control of the developer. For
example, types MyCompany.FileAccess.A and MyCompany.FileAccess.B
might be logically expected to have functionally related to file access. The
.NET Framework uses a hierarchical naming scheme for grouping types into
logical categories of related functionality, such as the ASP.NET application
framework, or remoting functionality. Design tools can make use of
namespaces to make it easier for developers to browse and reference types
in their code. The concept of a namespace is not related to that of an
assembly. A single assembly may contain types whose hierarchical names
have different namespace roots, and a logical namespace root may span
multiple assemblies. In the .NET Framework, a namespace is a logical
design-time naming convenience, whereas an assembly establishes the
name scope for types at run time.

What’s a Windows process?


It’s an application that’s running and had been allocated memory.

What’s typical about a Windows process in regards to memory


allocation?
Each process is allocated its own block of available RAM space, no process
can access another process’ code or data. If the process crashes, it dies
alone without taking the entire OS or a bunch of other applications down.

Explain what relationship is between a Process, Application Domain,


and Application?
Each process is allocated its own block of available RAM space, no process
can access another process’ code or data. If the process crashes, it dies
alone without taking the entire OS or a bunch of other applications down.
A process is an instance of a running application. An application is an
executable on the hard drive or network. There can be numerous processes
launched of the same application (5 copies of Word running), but 1 process
can run just 1 application.

What are possible implementations of distributed applications in .NET?


.NET Remoting and ASP.NET Web Services. If we talk about the Framework
Class Library, noteworthy classes are in System.Runtime.Remoting and
System.Web.Services.

What are the consideration in deciding to use .NET Remoting or


ASP.NET Web Services?
Remoting is a more efficient communication exchange when you can control
both ends of the application involved in the communication process. Web
Services provide an open-protocol-based exchange of information. Web
Services are best when you need to communicate with an external
organization or another (non-.NET) technology.

What’s a proxy of the server object in .NET Remoting?


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.

What are remotable objects in .NET Remoting?


Remotable objects are the objects that can be marshaled across the
application domains. You can marshal by value, where a deep copy of the
object is created and then passed to the receiver. You can also marshal by
reference, where just a reference to an existing object is passed.

What are channels in .NET Remoting?


Channels represent the objects that transfer the other serialized objects
from one application domain to another and from one computer to another,
as well as one process to another on the same box. A channel must exist
before an object can be transferred.

What security measures exist for .NET Remoting in


System.Runtime.Remoting?
None. Security should be taken care of at the application level.
Cryptography and other security techniques can be applied at application or
server level.

What is a formatter?
A formatter is an object that is responsible for encoding and serializing data
into messages on one end, and deserializing and decoding messages into
data on the other end.

Choosing between HTTP and TCP for protocols and Binary and SOAP
for formatters, what are the trade-offs?
Binary over TCP is the most effiecient, SOAP over HTTP is the most
interoperable.

What’s SingleCall activation mode used for?


If the server object is instantiated for responding to just one single request,
the request should be made in SingleCall mode.

What’s Singleton activation mode?


A single object is instantiated regardless of the number of clients accessing
it. Lifetime of this object is determined by lifetime lease.

How do you define the lease of the object?


By implementing ILease interface when writing the class code.

Can you configure a .NET Remoting object via XML file?


Yes, via machine.config and application level .config file (or web.config in
ASP.NET). Application-level XML settings take precedence over
machine.config.

How can you automatically generate interface for the remotable object
in .NET with Microsoft tools?
Use the Soapsuds tool.

What is Delegation?
A delegate acts like a strongly type function pointer. Delegates can invoke
the methods that they reference without making explicit calls to those
methods.
Delegate is an entity that is entrusted with the task of representation,
assign or passing on information. In code sense, it means a Delegate is
entrusted with a Method to report information back to it when a certain task
(which the Method expects) is accomplished outside the Method's class.
Basic interview questions with answers - 1
Here is a list of most common Interview Question asked in a job interview.
Interviewer ask these question generally to gauge your communication skills, to
meke yourself comfortable or even to test your clarity and wittiness in answering
questions :

1.Please tell me something about yourself

One of the very basic things that any company would ask a job applicant is her or his
personal information. The main problem in this question is the start. With what
information you should start to tell about yourself. One possible strategy is to ask the
interviewer : So what should I start with ? Education, Family or experience ?

2. Why are you leaving your presnet job?

Answer this question truthfully but be careful not to badmouth your superiors or co-
workers. Do not say negative things about the management of your previous
company. You can state that you left your previous company in hope for a better
career opportunity.

3. What experience do you have in this field?


Talk about your specific experiences that relate to the work you are applying for. Let
them know the activities and contributions that you have done for your chosen
industry.

4. Do you consider yourself successful?

Answer this question positively. Stay humble. Let them know that you set your own
personal goals and reaching these goals is what makes you a successful person.

5. What do you know about this organization?

Your answer to this question should be backed up with basic research. You should
know the latest news, issues and updates about the company you are applying to so
that they would get the impression that you are indeed very interested in becoming
part of their organization.

6. What have you done to improve your knowledge / skills in the last year?

Share some activities that you have done in the past that relates to the job you are
applying for. If you have been to seminars and other self-improvement activities,
share these experiences as well.

7. Are you applying for other jobs?

Keep your answer to this question quick and honest.

8. Why do you want to work for this organization?

This is a question you need to dwell on. You should come out sincere. Talk about your
goals as a career person and how much you think the organization can help you in
achieving your goals.

9. What kind of salary do you need?

This is actually a tricky question. Do not give a quick answer and give a figure right
away. You can ask something like “What is the salary range for this job?” Most
interviewers might just answer your question. If not, tell them that your rate
depends on the nature of the job. This is the right time when you can give an
estimate figure of how much you wanted your salary to be. Give a wide range.

10. Are you a team player?

Say yes. It would also be a good idea to state some situations where you have
showed that you are indeed a team player. Let them know that they you can work
with other people for the betterment of the company.

11. How long would you expect to work for us if hired?

Do not give out a specific length of time. Say something like, “I’d like to stay with
this company for a long time”. Or something like “As long as the company feel that I
am giving them good service”.

12. Have you ever had to fire anyone? How did you feel about that?

Answer this question honestly. You should convey the idea that you know how that
you should put the company on top of your priority list than personal favors.

13. What is your philosophy towards work?

You should keep your answer to this question short and precise. Convey that you
always put your work first. Let them know how your work philosophy can help their
organization improve.

14. Have you ever been asked to leave a position?

Answer this question truthfully. Do not explain why you were asked to leave unless
they questioned you about that. Be brief and honest. Again, do not talk about
negative things about your previous company, superiors or co-workers.

15. Why should we hire you?

In answering this question, state what you have to offer to the company. Show them
that you can be a real asset to them. It is not a good idea to compare yourself to
other applicants who are vying for the same position.

ADO.NET

1.) Which namespace do you include while using ODBC connectivity?

System.Data.ODBC.

2.) How many objects does ADO.net have and what are they?

ADO.net has 5 objects as follows:

• Connection
• Adapter
• Command
• Reader
• Dataset.

3.) State any 3 difference between ADO.NET and ADO?

• Recordset and Dataset


• Disconnected Architecture
• Lock Types

4.)what is Execute NOn Query?

Execute non Query is used to execute more than one command at the time (it is used for
insert ,delete ,update) orthis method is invoked whenever DMLcommands has been
excecuted

5.)What is @@rowcount and with small code snippet explain the usage?

@@rowcount gives the number of rows given as an result of previous query ran. Create
procedure get_emp_count ( @emp_id int) As Select * from emp where emp_id
=@emp_id If @@rowcount = 0 Begin Select 'no rows with emp_id= ' Select @emp_id
End

6.)What provider ADO.net use by default?

no default provider
7.)what is data access layer?

Data Access layer is actually a part of Architecture layer. It has 2 tier,3 tier or N tier
Layer. Generally we use 3 tier Layer 1) Presentation layer,Business Logic layer and then
Data Access Layer. Data Access layer is a medium to talk between database and
Business Logic layer. It helps to maintain flexibility,resuablity and even secuity also. In
security SQL Injection can be stopped with 3 iter Archietcture.

8.)what is Sql Native Client?

SQL NATIVE CLIENT is a Provider used to Connect with the SQL Server database

9.)What are advantages and disadvantages of Microsoft-provided data provider


classes in ADO.NET?

SQLServer.NET data provider is high-speed and robust, but requires SQL Server license
purchased from Microsoft. OLE-DB.NET is universal for accessing other sources, like
Oracle, DB2, Microsoft Access and Informix. OLE-DB.NET is a .NET layer on top of the
OLE layer, so it’s not as fastest and efficient as SqlServer.NET.

ASP.Net - FAQ
1.) What are the different types of caching?

Page output caching, Fragment and Data caching.

2.) What are the two main keywords used for authorization?

Allow and Deny

3.) How many types of Authentication modes available and what are they?

There are 3 types of authentication as follows:

• Windows
• Passport
• Form

3.) Explain the differences between Server-side and Client-side code?

Server side code will process at server side & it will send the result to client. Client side
code (javascript) will execute only at client side

4.) How do assemblies find each other?


By searching directory paths. There are several factors which can affect the path (such
as the App Domain host, and application configuration files), but for private assemblies
the search path is normally the application’s directory and its sub-directories. For shared
assemblies, the search path is normally same as the private assembly path plus the
shared assembly cache.

5.) What are the cycle of methods when page load?

The Cylce of methods when page load will be the following

• Init() - when the page is instantiated


• Load() - when the page is loaded into server memory
• PreRender() - the brief moment before the page is displayed to the user
as HTML
• Unload() - when page finishes loading.

C# - FAQ

.) What is the access limit of internal keyword?

Access inside the program or namespaces

2.) What is jagged array?

Its array of arrays. Arrays inside an array element.

3.) How do you prevent the class from being inheritance?

Simply include the keyword ‘Sealed’ in front of the class keyword.

4.) Tell C# syntax to catch any exception?

The Answer of the question as follows.A catch block that catches the exception of type
System.Exception. can also omit the parameter data type in this case and just write
catch {}.

5.)What does the term immutable mean?

The data value may not be changed. Note: The variable value may be changed, but the
original immutable data value was discarded and a new data value was created in
memory.

6.)What’s the advantage of using System.Text.StringBuilder over System.String?


StringBuilder is more efficient in cases where there is a large amount of string
manipulation. Strings are immutable, so each time a string is changed, a new instance in
memory is created.

7.)What’s the C# syntax to catch any possible exception?

A catch block that catches the exception of type System.Exception. You can also omit
the parameter data type in this case and just write catch {}.

VB.Net - Frequently Asked Questions

1.) How many views available in list view control and what are they?

4 views…

Large icon, small icon, Details and List.

2.) What is the use of ‘Preserve’ Keyword?

The preserve keyword helps to prevent data in an array from being lost.

3.) How do you prevent the class from being inheritance?

Simply include the keyword ‘NotOverridable’ in front of the class keyword.

4.) What is VB.Net

• VB.net is object oriented


• VB.Net can be used in Managed Code
• It supports inheritance, implement

5.) What is the base class of .net?

System.Object

6.) Differeces B/W VB.NET and C#(Coding)?

c# is case sensitive while VB.Net is case insensitive


c# is specifically targeted to programmers more efficient in C++, or Java its syntax is
very much similar to java. While VB.Net is targeted for VB programmer and syntactically
is very much similar to VB 6. with a much strong implementation of OOP modal
c# supports pointers ( although not recommended ) VB.Net does not.
7.) What is the difference between datagrid and gridview?

Datagrid is used in windows application and gridview is used in web and in datagrid we
cannot write the code for datagrid properties where as for grid view we can write the
code like template column item template etc this will not be done in datagrid

8.) What are the limitations of XML serialization?

XML serialization has some limitations. It converts public property values and fields, but
does not encode type information. Also it does not encode private properties and fields,
which requires binary serialization. Any class to be serialized to XML must have a public,
parameterless constructor. One advantage of XML serialization is that the serialized
data, being XML, rarely has any problems passing over networks and through security
measures, such as firewalls, that might be unhappy with a binary data stream. For this
reason, XML serialization is used by .Net Web services. Another advantage is that XML
serialization is not platform-specific. In other words, you do not have to have .Net or
Windows on both ends of the process.

9.) What is the difference between string class and stringbuilder class?

string class in immutable. Immutable is nothing but the value assigned to string cannot
be changed. Stringbuilder class is mutable. mutable is nothing but the value assigned to
stringbuilder can be changed.

10.) What are the Types of globalization we use?

when you want to use your application should run in differnet language like you have
developed the application for english and should also run in dutch, french, japanese etc.,
then through globalization you can set lacal and culture for the each language in
seperate folder. So that when the application will run for a specific region it will be show
the content in same language.

11.) Is .Net Platform independent ?

As you all know that in .net there are different compilers like for c#-csc,vb-vbc etc after
your code is complied it will convert to MSIL code which is independent this MSIL code
will goes to CLR & this CLR is platform dependent i.e for unix platform you should have
unix type of CLR ,for windows like the same so we can say that .net code is platform
independent

Oops - Frequently Asked Questions


1.) Why JAVA is known as securable language?
There are two reasons behind this. The first one is, as JAVA runs in JVM, which is a
virtual machine, and it converts source code to byte code, which is not understandable
for humans, so its safe. The second reason is JAVA does not support the Pointer
concept, hence we can say that JAVA is a securable language.

2.) What is the necessity of Interface?

As java is a Partially Object Oriented language, and it does not support the multiple
inheritance concepts, it creates problem for the developers. To over come this situation
JAVA provides Interface concept for multiple inheritance.

3.) What is Abstraction?

An essential element of object-oriented programming is abstraction. Abstraction is the


process to hide the complexity. A powerful way to manage abstraction is through the use
of hierarchical classifications. This allows programmer to understand the semantics of
complex system.

4.) What is Polymorphism?

The meaning of Polymorphism is something like one name many forms. Polymorphism
enables one entity to be used as general category for different types of actions. The
specific action is determined by the exact nature of the situation. The concept of
polymorphism can be explained as “one interface, multiple methods”.

5.) What is Inheritance?

Inheritance is the process of basing one class on another. In this process, a base class
provides methods, properties, and other members to a derived class. The advantage of
inheritance is that you can write and maintain code once it is in the base class and reuse
it over and over in the derived classes. But the main draw back of Java is it doesn’t
support multiple Inheritances; hence to over come this draw back Java provides us the
Interface concept.

6.) What is Object Oriented Programming Language ?

The language, which obeys all the basic principles of Object Oriented Programming,
which are Encapsulation, Inheritance and Polymorphism, is generally known as Object
Oriented Programming Language. Languages like c++ and java are some well-known
Object Oriented Programming Languages.

7.) What is Encapsulation?

Encapsulation is a process of binding or wrapping the data and the codes that operates
on the data into a single entity. This keeps the data safe from outside interface and
misuse.

8.) What is Class and Object?


A class defines the abstract characteristics of a thing (object), including the thing’s
characteristics, like its attributes or properties and the things it can do .The code for a
class should be relatively self-contained. Collectively, the properties and methods
defined by a class are called members. Object a particular instance of a class. Object
holds the characteristics of the Class. The set of values of the attributes of a particular
object is called its state.

9.) Is JAVA a completely Object Oriented Programming Language?

The answer to this question is certainly no. The reason behind this is JAVA does not
obey the OOPs concept purely. Certain concepts like Operator over loading and Multiple
Inheritance are not supported by JAVA. Hence JAVA is known as Partially Object
Oriented Programming Language.

XML - Frequently Asked Questions

1.) DOM Interfaces and DOM Implementations?

The DOM specifies interfaces, which may be used to manage XML or HTML documents.
It is important to realize that these interfaces are an abstraction they are a means of
specifying a way to access and manipulate an application’s internal representation of a
document. Interfaces do not imply a particular concrete implementation. Each DOM
application is free to maintain documents in any convenient representation, as long as
the interfaces shown in this specification are supported.

2.) The main difference between XML and HTML?

• XML was designed to describe data and to focus on what data is. HTML was
designed to display data and to focus on how data looks . HTML is about
displaying information, while XML is about describing information.
• The tags used to mark up HTML documents and the structures of HTML
documents are predefined. · XML allows the author to define his own tags and
his own document structure.

3.) What are the services that should not be used in a Clustered Environment?

A) File Services

B) Time services

C) Web logic events


D) All the above.

E) None of the above.

Ans: D)

4.) The process of propagating the changes in the properties of a server group
during runtime to all the associated clones is called?

A) Ruther’s Effect.

B) Simpson’s Effect.

C) Ripple Effect.

D) None of the above.

Ans: C)

5.) Horizontal Scaling is:

A) When Clones of an application server are defined on multiple physical machines.

B) When Clones of an application server are defined on single physical machines.

C) When no Clones of an application server are defined on any physical machines.

D) None of the above.

Ans: A)

6.) What is Document Type Definition?

A Document Type Definition (DTD) is a set of syntax rules for tags. It tells about what
tags can use in a document, what order they should appear in, which tags can appear
inside other ones, which tags have attributes, and so on.

7.) What is a Namespace?

A namespace is a collection of element and attribute names identified by a Uniform


Resource Identifier reference. The reference may appear in the root element as a value
of the xmlns attribute.

8.) What is meant by XML?

The ‘XML’ stands dor Xtensible Markup Language’.It is used to create and define own
tags and attributes.
9.) Give a few examples of types of applications that can benefit from using XML?

There are literally thousands of applications that can benefit from XML technologies. The
point of this question is not to have the candidate rattle off a laundry list of projects that
they have worked on, but, rather, to allow the candidate to explain the rationale for
choosing XML by citing a few real world examples. For instance, one appropriate answer
is that XML allows content management systems to store documents independently of
their format, which thereby reduces data redundancy. Another answer relates to B2B
exchanges or supply chain management systems. In these instances, XML provides a
mechanism for multiple companies to exchange data according to an agreed upon set of
rules. A third common response involves wireless applications that require WML to
render data on hand held devices

10.) When constructing an XML DTD, how do you create an external entity
reference in an attribute value?

when using SGML, XML DTDs don't support defining external entity references in
attribute values. It's more important for the candidate to respond to this question in a
logical way than than the candidate know the somewhat obscure answer.

11.) How would you build a search engine for large volumes of XML data?

The way candidates answer this question may provide insight into their view of XML
data. For those who view XML primarily as a way to denote structure for text files, a
common answer is to build a full-text search and handle the data similarly to the way
Internet portals handle HTML pages. Others consider XML as a standard way of
transferring structured data between disparate systems. These candidates often
describe some scheme of importing XML into a relational or object database and relying
on the database's engine for searching. Lastly, candidates that have worked with
vendors specializing in this area often say that the best way the handle this situation is to
use a third party software package optimized for XML data.

12.) 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.

13.) What are the rules for making a tag name in XML?

Rules for making a tag name are


1.It should start with a letter or underscore( _ )
2.There are no reserved words , but however xml(in any case) should not be used as a
tag name
3.It can include digits, hyphen,periods, ':' can be used but best avoided because it is
used for the name space.

You might also like