350InterViewQuestions (2 Files Merged)
350InterViewQuestions (2 Files Merged)
Object30
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
1
2
3
4
5
6
7
8
9
http://www.f5debug.net/post/2012/09/17/350-Interview-Questions-and-Answers-on-Net-
Framework-OOPS-ASPNet-CNet-SQL-Server-WCF-in-one-place.aspx
CTS is Common Type System, which describes how types are declared, used and managed. CTS
facilitate cross-language integration, type safety, and high performance code execution.
Example in VB you have “Integer” and in C++ you have “long” these data types are not compatible
so the interfacing between them is very complicated. In order that these two different languages
communicate Microsoft introduced Common Type System. So “Integer” data type in VB and “int”
data type in C++ will convert it to System.int32, which is data type of CTS.
Question 4 - What is CLS?
CLS Is Common Language Specification, is a specification that defines the rules to support
language integration. This is done in such a way, that programs written in any language (.NET
compliant) can interoperate with one another. This also can take full advantage of inheritance,
polymorphism, exceptions, and other features. It was always a dream of Microsoft to unite all
different languages in to one umbrella and CLS is one-step towards that.
Question 5 - What is an Intermediate Language?
(IL) Intermediate Language Or (CIL) Common Intermediate Language Or (MSIL) Microsoft
Intermediate Language, is one of the Core component of the .NET Framework. Any .NET source
codes written in any .net supportive language (C#,VB.net etc), when compiled are converted to
MSIL. This MSIL, when installed or at the Runtime, gets converted to machine code. The Runtime
conversion of MSIL code to the machine code is handled by a component called as the Just In Time
(JIT) Compiler.
Managed code runs inside the environment of CLR i.e. .NET runtime. In short, all IL are managed
code. However, if you are using some third party software example VB6 or VC++ component they
are unmanaged code, as .NET runtime (CLR) does not have control over the source code execution
of these languages.
A runtime-aware compiler compiles the IL into native executable code within a managed execution
environment that ensures type safety, array bound and index checking, exception handling, and
garbage collection. Also, many unproductive programming tasks are automatically taken care of,
such as type safety checking, memory management, and destruction of unneeded objects. You can
therefore focus on the business logic of your applications and write them using fewer lines of code.
The result is shorter development time and more secure and stable applications.
Question 9 - What is UnManaged Code?
As mentioned above the Unmanaged code will be one where
• The CLR cannot able to understand the code.
• The CLR cannot instruct the code.
• The second time compilation is unmanaged code. It is understood only by the machine not
by the user.
Question 10 - What is Garbage Collector?
Garbage collection is a process of releasing the memory used by the objects, which are no longer
referenced. This is done in different ways and different manners in various platforms and languages.
When an program is loaded in the memory there will be a bunch of memory allocated for that
particular program alone and loaded with memory. This bunch of memory is called Managed
Heap(is nothing but a bunch of memory allocated for the program at run time). This amount of
memory will only be used when an object is to be loaded in to the memory for that particular
program.
This memory is separated in to three parts:
• Generation Zero – Smaller size
• Generation One – Medium size
• Generation Two – Larger size
When we try to create an object by using NEW keyword the system will,
• Calculate the number of bytes required for the object or type to be loaded in to the managed
heap.
• The CLR then checks that the bytes required to allocate the object are available in the
reserved region. IF the object fits, it is allocated at the address pointed to by NextObjPtr.
• These processes will happen at the Generation zero level.
Question 11 - What is a Strong Name?
A strong name is a .NET assembly name combined with its version number and other information
to uniquely identify the assembly. This allows multiple versions of the same assembly to peacefully
co-exist in the global assembly cache, where shared assemblies are typically stored. It consists of
five parts as mentioned below
• Simple Name – Usually the name of the file (without the extension) that contains the
assembly
• Public Key – RSA cryptographic public key that helps verify the assembly's authenticity
• Version – Four-part version number, in the form of Major.Minor.Build.Revision
• Culture – Target audience for the assembly, such as "neutral" (default audience), "en-us"
(English – United States) or "fr" (France) etc.
• Processor Architecture – Defines the assembly's format, such as MSIL (intermediate
language) or x86 (binary for Intel x86 processors)
It is signing an assembly with its strong name public key, which is freely distributable, instead of
using the private key as usual. This allows developers to use and test a strong-named assembly
without access to the private key. Then at a later stage (typically just before shipping the assembly),
a manager or trusted key holder must sign the assembly with the corresponding private key.
[ad]
• In some cases, the default serialization techniques provided by .NET may not be sufficient in
real life.
• This is when we require implementing custom serialization.
• It is possible to implement custom serialization in .NET by implementing the ISerializable
interface.
• This interface allows an object to take control of its own serialization and de-serialization
process.
• It gives us a great deal of flexibility in the way we can save and restore objects.
Question 53 - What is difference between Code Based Security and Role Based Security?
CAS is the approach of using permissions and permission sets for a given code to run.
Example, Admin can disable running executables off the Internet or restrict access to
corporate database to only few applications.
• Role security most of the time involves the code running with the privileges of the current
user. This way the code cannot supposedly do more harm than mess up a single user
account.
• Neither is better. It depends on the nature of the application; both code-based and role-based
security could be implemented to an extent.
Indexers are created with this keyword Properties don't require this keyword
Indexers are accessed using indexes Properties are accessed by their names
Indexer are instance member, so can't be static Properties can be static as well as instance
members
Hiding the internal details or mechanics of how It focus on what the object does instead of how it
an object does something. does it.
Binding data and member functions together Hiding the complexities of your type from
inside a single unit. outside world.
Cannot be instantiated, means one cannot make a We can only define method definition and no
object of this class. implementation.
Question 118 – What is the difference between Array and Array List?
Array ArrayList
Question 123 – What are the different String Compare options available?
String Functions Description
Question 133 – What are the differences of Out and Ref Parameters?
REF OUT
Ref must be initialized before it is passed to Out its is not necessary, but after method
the method call it should get initialized
Extra performance cost. Faster
The called method can read the argument at The called method must initialize the
any time parameter before reading it
ref parameters are used to get a value and out parameters are used when you just
return a change to that value(Secondary need to get a secondary return value
value)
Question 134 – What are the differences between String and String Builder?
String String Builder
String objects are immutable, which means StringBuilder are mutable class, which means
that once they are created they cannot be when concatenate any text to the variable it
changed. When we use one of the methods allows us to modify the original value
of the String class, we create a new string without creating a new object.
object.
Here concatenation is used to combine two Here Append method is used.
strings.
String object is used to concatenate two Stringbuilder object is used.
strings.
The first string is combined to the other Insertion is done on the existing string.
string by creating a new copy in the memory
as a string object, and then the old string is
deleted
Less efficient StringBuilder is more efficient for large
amounts of string manipulations
Question 138 – What are the differences between Const & Readonly?
Const Read Only
Must be initialized at the time of its creation Assigned in constructor and called at
Runtime
Used if we want to define something at At Runtime you can make use of the value
compile time.
Protects from accidentally changing value of
the field
Can't be static. Can be either instance-level or static.
Value is evaluated at compile time. Value is evaluated at run time.
Initialized at declaration only. Initialized in declaration or by code in the
constructor
Question 152 – What are the Steps for ASP.net environment creation?
Step 1 IIS checks which ISAPI extension can server and pass to respective. e.g. aspx page to
aspnet_isapi.dll
Step 2 If first request then ApplicationManager creates a Application Domain.
Step 3 App Domain will create hosting environment (HttpRuntime) object, then core objects like
HttpContext, HttpRequest and HttpResponse will be created.
Step 4 Once core objects created, HttpApplication is created, if global.aspx is available then object
for that will be created. global.asax file inherits from ‘HttpApplication’ class
Step 5 The HttpApplication object is then assigned to the core ASP.NET objects(HttpContext,
HttpRequest and HttpResponse) to process the page.
Step 6 HttpApplication then starts processing the request by the following format HTTP module
events, handlers and page events. (MHPM)
Step 7 (M: HttpModule): Client request processing starts. Used when we want to inject logic in
events of ASP.NET pipeline. It is an event based processor. 6 important events we can utilize before
page object is created BeginRequest, AuthenticateRequest, AuthorizeRequest,
ResolveRequestCache, AcquireRequestState and PreRequestHandlerExecute.
Step 8 (H: ‘HttpHandler’): Used when we want to inject logic based in file extensions like ‘.ASPX’,
‘.HTML’. It is an extension based processor. Once above 6 events fired, ASP.NET engine will
invoke ProcessRequest event.
Step 9 (P: ASP.NET page): ASP.NET page object will be created. There are 6 important events -
Init, Load, validate, event, render and unload. SILVER to remember the events S – Start , I – (Init) ,
L (Load) , V (Validate), E (Event) and R (Render).
Step 10 (M: HttpModule): Once the page object is executed and unloaded from memory,
HttpModule provides post page execution events which can be used to inject custom post-
processing logic. There are 4 important post-processing events PostRequestHandlerExecute,
ReleaserequestState, UpdateRequestCache and EndRequest.
Question 153 – What is the ASP.NET Page Life Cycle?
Section Event Description
One user control cannot be used in different projects one custom control can be used in different
projects
Question 157 – What is the Difference between Client Side and Server Side Code?
Client Side Server Side
Code is written in a scripting language such Code is written in VB, C# or other compiled
as JavaScript and HTML languages
The browser itself executes the code in Code is executed by the server during a
response to a user action and no server roundtrip in response to a user request or
round trip is involved action
Client browser executes code to dynamically The server executes server side code and
modify the HTML. This is called Dynamic returns HTML code to the client browser for
HTML display
Code is script and therefore it is interpreted Code is either compiled dynamically or
precompiled into assemblies
Question 159 – What are the different IIS Isolation Levels in ASP.Net?
IIS5 supports three isolation levels
• Low (IIS Process)
• ASP pages run in INetInfo.Exe, the main IIS process
• ASP crashes, IIS crashes
• Medium (Pooled)
• ASP runs in a different process, which makes this setting more reliable
• If ASP crashes IIS won't.
• High (Isolated)
• Each ASP application runs out-process in its own process space
• If an ASP application crashes, neither IIS nor any other ASP
application will be affected
Question 160 – What are the different Authentication Modes available in ASP.Net?
• Windows
• Form
• Passport
• None
-Question 161 – What is Windows Authentication Mode in ASP.Net?
Windows Authentication mode relies upon IIS to perform the required authentication of a client.
After IIS authenticates a client, it passes a security token to ASP.NET.
Question 162 - What are the advantages and disadvantages of Windows Authentication
Mode?
Advantages - Authenticates using Windows accounts, so you do not need to write any custom
authentication code.
Disadvantages - May require the use and management of individual Windows user accounts.
Question 164 - What are the advantages and disadvantages of Form Authentication Mode?
Advantages - Makes it possible for custom authentication schemes using arbitrary criteria. Can be
used for authentication or personalization. It does not require corresponding Windows accounts.
Disadvantages - Is subject to replay attacks for the lifetime of the cookie, unless using SSL/TLS. Is
only applicable for resources mapped to Aspnet_isapi.dll.
Question 166 - What are the advantages and disadvantages of Passport Authentication Mode?
Advantages - Supports single sign-in across multiple domains. It is Compatible with all browsers.
Disadvantages - Places an external dependency for the authentication process.
Question 182 - What are the different management objects available with Client & Server
Side Stage Management?
Client – Side State Management
• View State – Asp.Net uses View State to track the values in the Controls. You can
add custom values to the view state. It is used by the Asp.net page framework to
automatically save the values of the page and of each control just prior to rendering
to the page. When the page is posted, one of the first tasks performed by page
processing is to restore view state.
• Control State – If you create a custom control that requires view state to work
properly, you should use control state to ensure other developers don’t break your
control by disabling view state.
• Hidden fields – Like view state, hidden fields store data in an HTML form without
displaying it in the user's browser. The data is available only when the form is
processed.
• Cookies – Cookies store a value in the user's browser that the browser sends with
every page request to the same server. Cookies are the best way to store state data
that must be available for multiple Web pages on a web site.
• Query Strings - Query strings store values in the URL that are visible to the user. Use
query strings when you want a user to be able to e-mail or instant message state
data with a URL.
Server – Side State Management
• Application State - Application State information is available to all pages, regardless
of which user requests a page.
• Session State –Information is available to all pages opened by a user during a single
visit.
Both application state and session state information is lost when the application restarts.
To persist user data between application restarts, you can store it using profile properties.
Question 199 - What is the relation between Cookies and Session State?
• By default, ASP.NET uses a non-persistent cookie to store the session state.
• If a user has disabled cookies on the browser, Session state cannot use a cookie to
store the session ID and Session state doesn't work. - No cookie, No Session state.
Question 210 - What are the Advantages of SQL Server mode Session?
• Session data do not affected if we restart the IIS.
• It is the most reliable and secure session management.
• It keeps data located centrally, It can be easily accessible from other application.
• It is very useful in web farm and web garden scenarios.
Question 213 - What are the Advantages of using Custom Session Mode in ASP.Net?
• It is useful when we have to use some old database rather than SQL Server.
• It's not depending on IIS , So Restarting web server does not make any effects on
session data.
• We can create our own algorithm for generating Session ID.
Question 214 - What are the Disadvantages of using Custom Session Mode in ASP.Net?
• Processing of Data is very slow.
• Creating a custom state provider is a low-level task that needs to be handled
carefully to ensure security.
Question 227 - What are the Types of Resource Files available in ASP.Net?
There are two types of resources
• Local Resources
• Global Resources
Question 230 - What are the main tags in Web.Config file of ASP.Net application?
<authentication> - This element is used to verify the client's identity when the client
requests a page from the server. This is set at the application level. We have four types of
authentication modes: “None”, “Windows”, “Forms”, and “Passport”.
<authorization> - The <authorization> tag controls client access to web page resources.
This element can be declared at any level (machine, site, application, subdirectory, or
page).
<authorization>
<allow users="comma-separated list of users"
roles="comma-separated list of roles"
verbs="comma-separated list of verbs"/>
<deny users="comma-separated list of users"
roles="comma-separated list of roles"
verbs="comma-separated list of verbs"/>
</authorization>
<allow>: Using this tag, we can control access to resources on the basis of the following
verbs. In these attributes, we use symbols: ? and *.? means for anonymous
users/resources, and * means for all users.
users: This contains the list of user names (comma separated) that are allowed to access
the resources.
roles: This contains the list of roles (comma separated) that are allowed to access the
resources.
verbs: This contains the list of HTTP verbs to which the action applies (comma separated).
It is used to create a rule that applies to a specific type of HTTP request (GET, POST, HEAD,
OR DEBUG).
<deny>: Using this tag, we can control access to resources on the basis of the following
verbs:
users: This contains the list of users names (comma separated) that are denied access to
the resources.
roles: This contains the list of roles (comma separated) that are denied access to the
resources.
verbs: This contains the list of HTTP verbs to which the action applies (comma separated).
It is used to create a rule that applies to a specific type of HTTP request (GET, POST, HEAD,
OR DEBUG).
Question 231 - What is the use of <compilation> tag in ASP.Net Web.Config File?
• Compilation tag configure the settings of the compiler.
• debug and defaultLanguage are the common attributes used.
• Setting debug to true means we want the debugging information in the browser, but
it has a performance tradeoff, so normally, it is set as false.
• The defaultLanguage attribute tells ASP.NET which language compiler to use: VB or
C#.
Question 232 - What is the use of <customErrors> tag in ASP.Net Web.Config File?
• Custom Error tags includes the error settings for the application, and is used to give
custom error pages (user-friendly error pages) to end users.
• If an error occurs then, the website is redirected to the default URL.
• For enabling and disabling custom errors, we need to specify the mode attribute.
• Example of <customErrors> tag:
<customErrors defaultRedirect="url" mode="Off">
<error statusCode="403" redirect="/accesdenied.html" />
<error statusCode="404" redirect="/pagenotfound.html" />
</customErrors>
• "On" means if there is any error, the website is redirected to the default URL.
"Off" means the custom errors are disabled.
"RemoteOnly" shows that custom errors will be shown to remote clients only.
Question 233 - What is the use of <globalization> tag in ASP.Net Web.Config File?
• Globalization tag is used when we want to use encoding or specify a culture for the
application.
• We need to define the character set for the server to send the response to the
client, which is by default is UTF-8, and the settings of which the server should use
to interpret and display culturally specific strings, such as numbers and dates.
• Example of <globalization> tag
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
Question 234 - What is the use of <httpRuntime> tag in ASP.Net Web.Config File?
• Httpruntime tag can be used to configure the general runtime settings of the
application.
The 2 main settings are: <httpRuntime appRequestQueueLimit="50"
executionTimeout="600" />
• The appRequestQueueLimit attribute defines the number of requests that can be
queued up on the server for processing. If there are 51 or more requests, then
server would return the 503 error ("Server too busy").
• The executionTimeout attribute defines the number of minutes ASP.NET will process
a request before it gets timeout.
Question 235 - What is the use of <trace> tag in ASP.Net Web.Config File?
• Trace tag is used for tracing the execution of an application.
• We have here two levels of tracing: page level and application level.
• Application level enables the trace log of the execution of every page available in the
application. If pageOutput="true", trace information will be displayed at the bottom
of each page. Else, we can view the trace log in the application root folder, under the
name trace.axd.
• Example of <trace> tag
<trace enabled="false" requestLimit="10" pageOutput="false"
traceMode="SortByTime" localOnly="true" />
Set the attribute localOnly to false for not viewing the trace information from the
client. For enabling trace at page level, set Trace="True" in the Page tag (on the top
of the page).
Question 236 - What is the use of <identity> tag in ASP.Net Web.Config File?
Identity tag is used to control the identity of the application. By default, Impersonation is
disabled. Using Impersonation, an ASP.NET application can execute optionally with the
identity of a client on whose behalf they are operating.
<identity impersonate="false" userName="domain\username" password="password" />
Question 237 - What is the use of <sessionState> tag in ASP.Net Web.Config File?
• Sessionstage tag is used to tell the ASP.NET framework where to store the session.
By default, it's inproc which means storing the session values on the server. But we
have four options:
• "Off" means session is not enabled for the application.
"inproc" means storing the session values on the server.
"StateServer" means session states are stored in a remote server.
"SQLServer" means session states are stored in a SQL Server database. For this, we
need to install the InstallSQLState.sql script in the SQL Server database. It is mainly
used when the we use web farms (an application deployed on multiple servers), but
it makes the performance slow as compared to "inproc".
• Other Basic Settings:
"cookieless": when it is true, it means the session used is without cookies.
“timeout” specifies after how much time the session would expire
"stateConnectionString" needs to be specified when the session mode is
StateServer.
"sqlConnectionString" is connection string of the SQL Server database if the session
mode is SQLServer.
"stateNetworkTimeout" attribute, when using the StateServer mode to store session
state, specifies the number of seconds the TCP/IP network connection between the
web server and the state server can be idle before the session is abandoned. The
default is 10.
• Example
<sessionState mode="Off" cookieless="true"
timeout="100"
stateConnectionString="tcpip=server:port"
sqlConnectionString="sql connection string"
stateNetworkTimeout="number of seconds"/>
Question 238 - What is the use of <appSettings> tag in ASP.Net Web.Config File?
• AppSetting tag is used to store custom application configuration like database
connection strings, file paths etc.
• This also can be used for custom application-wide constants to store information
over multiple pages. It is based on the requirements of the application.
• Example:
<appSettings>
<add key="Emailto" value="me@microsoft.com" />
<add key="cssFile" value="CSS/text.css" />
</appSettings>
It can be accessed from code like:
ConfigurationSettings.AppSettings("Emailto"); All the values returned from it are
strings.
Question 243 – What are the different Normalization Forms in SQL Server?
• 1NF: Eliminate Repeating Groups
• 2NF: Eliminate Redundant Data
• 3NF: Eliminate Columns Not Dependent On Key
• 4NF: Isolate Independent Multiple Relationships
• 5NF: Isolate Semantically Related Multiple Relationships
Question 245 – What are the Advantages of Stored Procedure in SQL Server?
• Execution plan retention and reuse
• Encapsulation of business rules and policies
• Sharing of application logic between applications
• Access to database objects that is both secure and uniform
• Consistent, safe data modification
• Network bandwidth conservation
• Improved security
• Reduced development cost and increased reliability
• Centralized security, administration, and maintenance for common routines.
Question 246 – What are the DisAdvantages of Stored Procedure in SQL Server?
• Source control can be a pain.
• Debugging is hard.
• Developing stored procedures can be a fairly specialized task, especially as they get
more complex.
Question 248 – What is a Scalar value-returning User Defined Function in SQL Server?
• Similar to functions in other languages.
• Returns a single value of a scalar data type.
• Can return user-defined data types.
• Useful when the same segment of T-SQL code is used in several places
• Can be used in several stored procedures and batch SQL statements.
• Used to make the code more maintainable, reusable, and less complex.
Question 249 – What is an In Line Table User Defined Function in SQL Server?
• Returns a row set of the SQL Server table data type.
• Takes the structure of the row set from the SELECT statement itself.
• It is an exceptional alternative to a view
• Can pass parameters and in essence provide us with a parameterized, non-
updateable view
Question 250 – What is a Multistatement Table User Defined Function in SQL Server?
• Returns a table and is also an exceptional alternative to a view
• Defines column names and data types in the RETURNS clause.
• Able to house more complicated and numerous T-SQL logic blocks.
• It can be used it in the FROM clause of a T-SQL command
Question 253 – What is the difference between a Stored Procedure and Functions?
Stored Procedure Functions
Called independently, using the EXEC Called from within another SQL statement
command
May return a scalar value, a table value or Always return a value (either a scalar value
Nothing or a table)
Allow you to enhance application security by Here we can’t use this
GRANT and Deny access
Question 268 – What are the steps to Create Cursor in SQL Server?
Below are the steps by step approach to create a Cursor.
• Declare cursor
• Open cursor
• Fetch row from the cursor
• Process fetched row
• Close cursor
• De-allocate cursor
Question 278 – What are the different Authentication options and Authentication Modes
in SQL Server?
• Authentication Types - Windows and SQL Server Authentication are the two types
available.
• Authentication Mode Types - Windows Authentication mode and Mixed Mode are
two modes available
Question 295 – What is the difference between Primary Key and a Unique Key?
Primary Key Unique Key
Primary key creates clustered index Unique key creates non clustered index
Can have only 1 Primary key in a table Can have many Unique key in a table
It cannot contain NULL values Can have NULL values, even more than 1 null
values
Does not reset the identity of the table Resets identity of the table
Its DML Command Its DDL Command
It can be rolled back It cannot be rolled back
Its Slower (Removes row one by one) Its Faster (Uses Fewer systems)
WHERE Condition can be used WHERE Condition can’t be used
Records entry in transaction log for each Removes the data by de-allocating the data
deleted row pages
Trigger can be activated Trigger can’t be activated
Question 299 – What is the difference between Clustered and Non Clustered Index?
Clustered Index Non Clustered Index
can have only one clustered index on a table we can have as many non-clustered
indexes(255)
The leaf level of a clustered index is non-clustered index the leaf level is actually a
theactual data pointer to the data in rows
The RowLocator in Clustered Index is the The row locator in Non Clustered Index is a
clustered Index key pointer to the row. ROW ID (RowLocator)=
file identifier + page number + row number
on the page
It doesn’t allow null values It allow one null values
Assigned for primary key Assigned for unique key
Cluster index exists on the physical level They are not created on the physical level
but at the logical level
It sorts the data at physical level It does not sort the data at physical level
A clustered index requires no separate requires separate storage than the table
storage than the table storage storage to store the index information
Question 302 - What is the difference between Having and Where Clause in SQL?
Having Where
Question 320 – List some of the DBCC (Database Console Commands for SQL Server)
Commands?
• DBCC CACHESTATS displays information about the objects currently in the buffer
cache, such as hit rates, compiled objects and plans, etc.
DBCC DROPCLEANBUFFERS: Use this command to remove all the data from SQL
Server's data cache (buffer) between performance tests to ensure fair testing. Keep
in mind that this command only removes clean buffers, not dirty buffers.
• DBCC ERRORLOG: If you rarely restart the mssqlserver service, you may find that
your server log gets very large and takes a long time to load and view.
Question 321 - What is a Full Database Backup type in SQL?
With this backup you are backing up the entire database and will be able to restore the
entire database from just this backup.
Question 340 – What are the Differences between CUBE and ROLLUP?
• CUBE generates a result set that shows aggregates for all combinations of values in
the selected columns.
• ROLLUP generates a result set that shows aggregates for a hierarchy of values in the
selected columns.
Question 341 – What is the use of CUBE Operator in SQL?
The CUBE Operator is useful in generating reports that contain subtotals and totals. There
are extensions of the GROUP BY clause.
Question 346 – What is the use of ALL & ANY operator in SQL?
• Comparison operators that introduce a SubQuery can be modified by the keywords
ALL or ANY
Using the > comparison operator as an example, >ALL means greater than every
value, In other words, it means greater than the maximum value.
• For example, >ALL (1, 2, 3) means greater than 3. >ANY means greater than at least
one value, that is, greater than the minimum. So >ANY (1, 2, 3) means greater than
1.
• Similarly, >ANY means that for a row to satisfy the condition specified in the outer
query, the value in the column that introduces the SubQuery must be greater than
at least one of the values in the list of values returned by the SubQuery
From constructor to destructor (taking into consideration Dispose() and the concept of non-deterministic
finalization), what the are events fired as part of the ASP.NET System.Web.UI.Page lifecycle. Why are they
important? What interesting things can you do at each?
• What are ASHX files? What are HttpHandlers? Where can they be configured?
• What is needed to configure a new extension for use in ASP.NET? For example, what if I wanted my
system to serve ASPX files with a *.jsp extension?
• What events fire when binding data to a data grid? What are they good for?
• Explain how PostBacks work, on both the client-side and server-side. How do I chain my own JavaScript
into the client side without losing PostBack functionality?
• How does ViewState work and why is it either useful or evil?
• What is the OO relationship between an ASPX page and its CS/VB code behind file in ASP.NET 1.1? in
2.0?
• What happens from the point an HTTP request is received on a TCP/IP port up until the Page fires the
On_Load event?
• How does IIS communicate at runtime with ASP.NET? Where is ASP.NET at runtime in IIS5? IIS6?
• What is an assembly binding redirect? Where are the places an administrator or developer can affect how
assembly binding policy is applied?
• Compare and contrast LoadLibrary(), CoCreateInstance(), CreateObject() and Assembly.Load().
1) I am looking for a more challenging career in a firm with a larger employee base such as yours.
2) Keeping in mind my career goals, the time has come for me to move onto the next rung of
the ladder and make a mark for myself. This can be achieved in a company like this.
3) It is just a career move to enhance my knowledge in my own area of interest.
After completion of this question only interview will go for further questions
1) Procedure can return zero or n values whereas function can return one value which is mandatory.
2) Procedures can have input, output parameters for it whereas functions can have only input parameters.
3) Procedure allows select as well as DML statement in it whereas function allows only select statement in it.
4) Functions can be called from procedure whereas procedures cannot be called from function.
5) Exception can be handled by try-catch block in a procedure whereas try-catch block cannot be used in a
function.
6) We can go for transaction management in procedure whereas we can't go in function.
7) Procedures cannot be utilized in a select statement whereas function can be embedded in a select statement.
Abstract Class:
Interface:
-If a class contains all abstract methods then that class is known as “Interface”
-Interfaces support like multiple inheritance
-In interface all methods r public abstract by default
-Interfaces r implementable
-Interfaces can be instantiated, but a reference cannot be created
Clustered Index
Only 1 allowed per table physically rearranges the data in the table to confirm to the index constraints for use on
columns that are frequently searched for ranges of data for use on columns with low selectivity.
Non-Clustered Index
Up to 249 allowed per table creates a separate list of key values with pointers to the location of the data in the data
pages For use on columns that are searched for single values
A clustered index is a special type of index that reorders the way records in the table are physically stored.
Therefore table can have only one clustered index. The leaf nodes of a clustered index contain the data pages. A
non-clustered index is a special type of index in which the logical order of the index does not match the physical
stored order of the rows on disk. The leaf node of a non-clustered index does not consist of the data pages.
Instead, the leaf nodes contain index rows.
In SQL Server 2005, the functionality of non-clustered indexes is extended by adding non-key columns to the leaf
level of the non-clustered index. Non-key columns can help to create cover indexes. By including non-key
columns, you can create non-clustered indexes that cover more queries. The Database Engine does not consider
non-key columns when calculating the number of index key columns or index key size. Non-key columns can be
included in non-clustered index to avoid exceeding the current index size limitations of a maximum of 16 key
columns and a maximum index key size of 900 bytes. Another advantage is that using non-key column in index
we can have index data types not allowed as index key columns generally.
In following example column Filename is varchar(400), which will increase the size of the index key bigger than
it is allowed. If we still want to include in our cover index to gain performance we can do it by using the Keyword
INCLUDE.
USE AdventureWorks
GO
CREATE INDEX IX_Document_Title
ON Production.Document (Title, Revision)
INCLUDE (FileName)
Non-key columns can be included only in non-clustered indexes. Columns can’t be defined in both the key
column and they INCLUDE list. Column names can’t be repeated in the INCLUDE list. Non-key columns can be
dropped from a table only after the non-key index is dropped first. For Included Column Index to exist there must
be at least one key column defined with a maximum of 16 key columns and 1023 included columns.
Avoid adding unnecessary columns. Adding too many index columns, key or non-key as they will affect
negatively on performance. Fewer index rows will fit on a page. This could create I/O increases and reduced
cache efficiency. More disk space will be required to store the index. Index maintenance may increase the time
that it takes to perform modifications, inserts, updates, or deletes, to the underlying table or indexed view.
USE AdventureWorks
GO
CREATE NONCLUSTERED INDEX IX_Address_PostalCode
ON Person.Address (PostalCode)
INCLUDE (AddressLine1, AddressLine2, City, StateProvinceID)
GO
Test the performance of following query before and after creating Index. The performance improvement is
significant.
SELECT AddressLine1, AddressLine2, City, StateProvinceID, PostalCode
FROM Person.Address
WHERE PostalCode BETWEEN '98000'
AND '99999';
GO
Ans: 1) Hash table store data as name, value pair. While in array only value is store.
2) To access value from hash table, you need to pass name. While in array, to access value, you need to pass index
number.
3) you can store different type of data in hash table, say int, string etc. while in array you can store only similar
type of data.
The main difference is system.string is immutable and system.stringbuilder is a mutable. Append keyword is used
in string builder but not in system.string.
Immutable means once we created we cannot modified. Suppose if we want give new value to old value simply it
will discarded the old value and it will create new instance in memory to hold the new value.
What are the differences between Application object and session object?
Ans: The session object is used to maintain the session of each user. If one user enter in to the application then
they get session id if he leaves from the application then the session id is deleted. If they again enter in to the
application they get different session id.
But for application object the id is maintained for whole application.
Ans: Two types of indexes are there one is clustered index and non-clustered index
Ans: Two types of memories are there in .net stack memory and heap memory
Ans: Yes we can set the session out time manually in web.config.
Ans: 1) Abstract cannot be instantiated but we can inherit. Interface it cannot be inherit it can be instantiate
2) Interface contain only declarations no definitions. Abstract contain declarations and definitions.
3) The class which contains only abstract methods is interface class. A class which contains abstract method is
called abstract class
4) Public is default access specifier for interface we don’t have a chance to declare other specifiers. In abstract we
have chance to declare with any access specifier
What is the difference between primary key and unique key with not null?
Ans: There is no difference between primary key and unique key with not null.
What are the differences between value type and reference type?
Ans: Value type contain variable and reference type are not containing value directly in its memory.
Memory is allocated in managed heap in reference type and in value type memory allocated in stack. Reference
type ex-class value type-struct, enumeration
Ans: Yes
Ans: Browser understands an only html control that’s why in page rendering we will convert the aspx controls
into html controls.
Ans: Select e1.ename, e2.empid from emp e1, emp e2 where e1.empid=e2.mgrid;
Ans: No
Can you write the program to find the length of string without using library function?
Ans: Scope_identity and current _identity both are similar and it will return the last identity value generated in the
table.
Scope_Identity will return the identity value in table that is currently in scope
Ans:
GET Method ():
Ans: 1) Delete keep the lock over each row where Truncate keeps the lock on table not on all the row.
2) Counter of the Identity column is reset in Truncate where it is not reset in Delete.
3) Trigger is not fired in Truncate where as trigger is fired in Delete.
4) In TRUNCATE we cannot rollback.
5) In DELETE we can rollback
What is the difference Grid View and between Data Grid (Windows)?
Ans:
1) GridView Control Enables you to add sorting, paging and editing capabilities without writing any code.
2)GridView Control Automatically Supports paging by setting the ‘PagerSetting’ Property.The Page Setting
Property supports four Modles
a. Numeric(by default)
b. Next Previous
c. NumericFirstLast
d. Next PreviousLast
DataGrid(Windows)
If I write System.exit (0); at the end of the try block, will the finally block still execute?
Ans: No in this case the finally block will not execute because when you say system.exit(0),the control
immediately goes out of the program, and thus finally never executes.
Ans:
State management is the process by which you maintain state and page information over multiple requests for the
same or different pages.
a. View State – Asp.Net uses View State to track the values in the Controls. You can add custom values to the view
state. It is used by the Asp.net page framework to automatically save the values of the page and of each control
just prior to rendering to the page. When the page is posted, one of the first tasks performed by page processing is
to restore view state.
b. Control State – If you create a custom control that requires view state to work properly, you should use control
state to ensure other developers don’t break your control by disabling view state.
c. Hidden fields – Like view state, hidden fields store data in an HTML form without displaying it in the user's
browser. The data is available only when the form is processed.
d. Cookies – Cookies store a value in the user's browser that the browser sends with every page request to the
same server. Cookies are the best way to store state data that must be available for multiple Web pages on a web
site.
e. Query Strings - Query strings store values in the URL that are visible to the user. Use query strings when you
want a user to be able to e-mail or instant message state data with a URL.
b. Session State – Session State information is available to all pages opened by a user during a single visit.
Both application state and session state information is lost when the application restarts. To persist user data
between application restarts, you can store it using profile properties.
Abstract Class:
Abstract class is a class which can’t be instantiate. Class should have “Abstract” key word with the name. In any
one of the method of class having abstract method with in it, then it should be define as abstract class. The class
which derived the abstract class should have definition of the abstract method. These classes which derived the
abstract class and implement the abstract methods call concrete class.
Abstract class may have the definition of function or may not. Below is the simple example of an abstract class
public abstract alass AbstractStudent
{
String Roll
{
get;
set;
}
String FirstName
{
get;
set;
}
String LastName
{
get;
set;
}
// Implementation of Method
}
}
So, the class having one abstract method so we need to mention the class as "abstract" .
Abstract class is a class which can’t be instantiated and which can have methods with definition as well as
declaration also. This can be inherited.
As for Example:
String FirstName
{
get;
set;
}
String LastName
{
get;
set;
}
Interface can only contain the methods declaration and can be implemented in the class.
As for Example:
Public interface IStudnet
{
String Roll
{
get;
set;
}
String FirstName
{
get;
set;
}
String LastName
{
get;
set;
}
String GetStudentDetails();
String SaveStudentDetails ();
}
Below are the few main difference between Abstract Class and Interface
a. In abstract class method can have definition as well as declaration also. But Interface should have only
definition.
b. All the Methods are Public as default and don’t have any access Modifier Controls in interface, whereas for
abstract class we can have access modifier for methods.
c. Abstract class can have constructor or destructor, whereas interface not.
d. Abstract class can’t be part of multiple inheritance and we can implement multiple interface.
What do you mean by String objects are immutable?
String objects are immutable as its state cannot be modified once created. Every time when we perform any
operation like add, copy, replace, and case conversion or when we pass a string object as a parameter to a method
a new object will be created.
Example:
String str = "ABC";
str.Replace("A","X");
Here Replace() method will not change data that "str" contains, instead a new string object is created to hold data
"XBC" and the reference to this object is returned by Replace() method.
Ans: Dll hell, is kind of conflict that occurred previously, due to the lack of version supportability of dll for
(within) an application
.NET Framework provides operating system with a global assembly cache. This cache is a repository for all the
.net components that are shared globally on a particular machine. When a .net component installed onto the
machine, the global assembly cache looks at its version, its public key and its language information and creates a
strong name for the component. The component is then registered in the repository and indexed by its strong
name, so there is no confusion between the different versions of same component, or DLL
Ans: Instead of defining an entire class, you can split the definition into multiple classes by using partial class
keyword. When the application compiled, c# compiler will group all the partial classes together and treat them as
a single class. There are a couple of good reasons to use partial classes. Programmers can work on different parts
of classes without needing to share same physical file
Ex:
Public partial class employee
{
Public void somefunction()
{
}
}
Public partial class employee
{
Public void function ()
{
}
}
Asp.Net 2.0 fixed this with built-in features that allowed us to easily send information from one page to another.
Button control has property PostBackUrl that can be set to URL of any page in our ASP.Net WebSite where we
want to transfer all form values to.
Along with that Asp.Net 2.0 Page class has a property PreviousPage that allows us to get reference to the Page
object that initiated the postback (in other words to get the actual reference to the Page object of the aspx page on
which user clicked the Submit button on a HTML form).
So for example lets create two sample pages in our Web Application:
SourcePage.aspx
DestinationPage.aspx
In SoucePage in Html form we will put two TextBox controls (one for First Name and one for Last Name) and
one Button component and set its PostBackUrl property to "~/DestinationPage.aspx".
SourcePage.aspx:
<form id="form1" runat="server">
<div>
First Name: <asp:TextBox ID="FirstName" runat="server"></asp:TextBox><br />
Last Name: <asp:TextBox ID="LastName" runat="server"></asp:TextBox><br /><br />
<asp:Button ID="Button1" runat="server" Text="Submit To Destination Page"
PostBackUrl="~/CrossPagePostbacks/DestinationPage.aspx" />
</div>
</form>
When our user clicks the Submit button, all the values from the HTML Form on SourcePage.aspx will be
transfered to the DestinationPage.aspx and we will also be able to get reference to the SourcePage.aspx in our
DestinationPage with the PreviousPage property like this:
So in our DestinationPage.aspx.cs code-behind we can easily access two TextBox controls on SourcePage.aspx
and show them in two label controls like this:
protected void Page_Load(object sender, EventArgs e)
{
// first check if we had a cross page postback
if ( (PreviousPage != null) && (PreviousPage.IsCrossPagePostBack) )
{
Page previousPage = PreviousPage;
TextBox firstName = (TextBox)previousPage.FindControl("FirstName");
TextBox lastName = (TextBox)previousPage.FindControl("LastName");
// we can now use the values from TextBoxes and display them in two Label controls..
labelFirstName.Text = firstName.Text;
labelLastName.Text = lastName.Text;
}
}
You probably noticed that we first checked if PreviousPage property of current page (DestinationPage.aspx) is
NOT NULL, this is done to avoid running our code in case that user opens our DestinationPage.aspx directly,
without running a cross page postback.
Also here we checked the another PreviousPage property called IsCrossPagePostBack to see if we really had a
CrossPagePostback.
(If Server.Transfer is used to redirect to this page, IsCrossPagePostBack property will be set to FALSE.
TIP: We can be completely sure that we have a real CrossPagePostback ONLY IF:
1. Page.PreviousPage is NOT NULL,
2. PreviousPage.IsCrossPagePostback is true
This important to check to avoid errors in code.
Now this is very useful and i'm sure you are eager to use this in your next project. But wait, we are not over yet!
Finding the controls on PreviousPage with FindControl method and type-casting them from object to their real
type is a little messy.
It feels like there must be a better solution for this!
And here it is: We can use the <%@ PreviousPageType %> directive in the header of our DestinationPage.aspx
like this
<%@ PreviousPageType VirtualPath="~/SourcePage.aspx" %>
to declare our previous page type, and then we can access Public properties of the PreviousPage without
typecasting.
Now all we need to do is to create some public properties on our SourcePage.aspx.cs to expose data/Controls we
want to the destionation page:
public partial class SourcePage : System.Web.UI.Page
{
public string FormFirstName
{
get { return FirstName.Text; }
}
And then we can change the Page_Load code in our DestinationPage.aspx to much cleaner code like this:
protected void Page_Load(object sender, EventArgs e)
{
// first check if we had a cross page postback
if ( (PreviousPage != null) && (PreviousPage.IsCrossPagePostBack) )
{
SourcePage prevPage = PreviousPage;
// we can now use the values from textboxes and display them in two Label controls..
labelFirstName.Text = prevPage.FormFirstName;
labelLastName.Text = prevPage.FormLastName;
}
}
SourcePage type used in the code is offcourse name of the partial class defined is SourcePage.aspx.cs that inherits
System.Web.UI.Page that is automatically created for us when we created new WebForm in VisualStudio.
This code is much cleaner and easier to follow, there is no ugly typecasting, just simple property values to use to
retrieve the data from previous page.
Ans: When we want that sub class must implement all the methods of base class. In such a situation we will
implement the interface. In the other hand when we want only some method of base class in our sub class then
use base class as abstract class.
What is the difference between application exception and system exception?
Ans: The difference between application exception and system exception is that system exceptions are thrown by
CLR and application exceptions are thrown by applications.
Declaration of authorization is
<authorization>
<allow users=”Suresh, Sanjay”/>
<deny users=”Ramana, Rakesh”>
</authorization>
Sometimes authorization allows the unauthorized persons at that time we will use
<deny users=”?”/>
Authentication means
Authentication is a process where we identify the credentials of user i.e. username, password and create an
identity to mention user as an authenticated.
Check this article for 3-tier architecture 3 tier architecture example in asp.net
What is synchronization?
Ans: The mechanism needed to block one thread access to the data. If the data is being accessed by another
thread.
Synchronization can be accessed by using system.monitor class
A monitor class methods are enter, exit, pulse for this lock statement is also used
Suppose if we need to synchronize some data at that time we need to place that data in this block
Lock
{
}
Whatever the data has been placed into the lock block that data has been blocked
What is Collation?
Ans: Collation refers to a set of rules that determine how the data is sorted and compared.
The firewall will control connections to & from your computer. For the most part it will just be controlling who
can connect to your computer and on what ports. For web browsing your firewall generally won't be doing a
whole lot.
Your router (see http://en.wikipedia.org/wiki/Router ) essentially guides your request through the network, helping
the packets get from computer to computer and potentially doing some NAT (see
http://en.wikipedia.org/wiki/Network_add… ) to translate IP addresses along the way (so your internat LAN
request can be transitioned onto the wider internet and back).
IP Addresses (see http://en.wikipedia.org/wiki/IP_address ) are unique addresses for computers that basically
allow computers to find each other. Think of the IP address as a computer's well address or phone number, you've
got to know someone's phone number before you can call them and you've got to know a computer's IP address
before you can connect to it. Going back to the start - that's what those URLS and DNS make possible, you don't
know John Doe's phone number so you look in the phone book; likewise your computer doesn't know
yahoo.com's IP address so it looks in DNS.
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.
When .NET was introduced it came with several languages. VB.NET, C#, COBOL and Perl, etc. .net Supports
More than 44 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.
As defined in Wikipedia, an application server is a software engine that delivers applications to client computers
or devices. The application server runs your server code. Some well known application servers are IIS
(Microsoft), WebLogic Server (BEA), JBoss (Red Hat), WebSphere (IBM).
What is inheritance?
Inheritance represents the relationship between two classes where one type derives functionality from a second
type and then extends it by adding new methods, properties, events, fields and constants. C# support two types of
inheritance:
- Implementation inheritance
- Interface inheritance
What is implementation and interface inheritance?
When a class (type) is derived from another class(type) such that it inherits all the members of the base type it is
Implementation Inheritance.
When a type (class or a struct) inherits only the signatures of the functions from another type it is Interface
Inheritance.
In general Classes can be derived from another class, hence support Implementation inheritance. At the same time
Classes can also be derived from one or more interfaces. Hence they support Interface inheritance.
The class which derives functionality from a base class is called a derived class. A derived class can also act as a
base class for another class. Thus it is possible to create a tree-like structure that illustrates the relationship
between all related classes. This structure is known as the inheritance hierarchy.
In VB.NET you use the NotInheritable modifier to prevent programmers from using the class as a base class. In
C#, use the sealed keyword.
Define Overriding?
Overriding is a concept where a method in a derived class uses the same name, return type, and arguments as a
method in its base class. In other words, if the derived class contains its own implementation of the method rather
than using the method in the base class, the process is called overriding.
.NET supports only single inheritance. However the purpose is accomplished using multiple interfaces.
What is an Interface?
An interface is a standard or contract that contains only the signatures of methods or events. The implementation
is done in the class that inherits from this interface. Interfaces are primarily used to set a common standard or
contract.
It is the functionality which handles the exchange of information between database and a user interface.
What is a component?
Component is a group of logically related classes and methods. A component is a class that implements the
IComponent interface or uses a class that implements IComponent interface.
What is a control?
A connection pool is a ‘collection of connections’ which are shared between the clients requesting one. Once the
connection is closed, it returns back to the pool. This allows the connections to be reused.
A flat file is the name given to text, which can be read or written only sequentially.
Functional requirements defines the behavior of a system whereas non-functional requirements specify how the
system should behave; in other words they specify the quality requirements and judge the behavior of a system.
E.g.
Functional - Display a chart which shows the maximum number of Customer in a region.
Non-functional – The data presented in the chart must be updated every 60 minutes.
GAC is a machine-wide cache of assemblies that allows .NET applications to share libraries. GAC solves some of
the problems associated with dll’s (DLL Hell).
What is Boxing/Unboxing?
Globalization is the process of customizing applications that support multiple cultures and regions.
What is localization?
Localization is the process of customizing applications that support a given culture and regions.
What is MIME?
The definition of MIME or Multipurpose Internet Mail Extensions as stated in MSDN is “MIME is a standard that
can be used to include content of various types in a single message. MIME extends the Simple Mail Transfer
Protocol (SMTP) format of mail messages to include multiple content, both textual and non-textual. Parts of the
message may be images, audio, or text in different character sets. The MIME standard derives from RFCs such as
2821 and 2822”.
Scripting is separated from the HTML, Code is compiled as a DLL, these DLLs can be executed on the server.
The cursor position is maintained when the page gets refreshed due to the server side validation and the page gets
refreshed.
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
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.
What is a Manifest?
An assembly manifest contains all the metadata needed to specify the assembly's version requirements and
security identity, and all metadata needed to define the scope of the assembly and resolve references to resources
and classes. The assembly manifest can be stored in either a PE (Portable Executable) file (an .exe or .dll) with
Microsoft intermediate language (MSIL) code or in a standalone PE (Portable Executable) file that contains only
assembly manifest information. The following table shows the information contained in the assembly manifest.
The first four items the assembly name, version number, culture, and strong name information make up the
assembly's identity.
Assembly name: A text string specifying the assembly's name.
Version number: A major and minor version number, and a revision and build number. The common language
runtime uses these numbers to enforce version policy.
Culture: Information on the culture or language the assembly supports. This information should be used only to
designate an assembly as a satellite assembly containing culture- or language-specific information. (An assembly
with culture information is automatically assumed to be a satellite assembly.) Strong name information: The
public key from the publisher if the assembly has been given a strong name. List of all files in the assembly:
A hash of each file contained in the assembly and a file name. Note that all files that make up the assembly must
be in the same directory as the file containing the assembly manifest.
Type reference information: Information used by the runtime to map a type reference to the file that contains its
declaration and implementation. This is used for types that are exported from the assembly.
Information on referenced assemblies: A list of other assemblies that are statically referenced by the assembly.
Each reference includes the dependent assembly's name, assembly metadata (version, culture, operating system,
and so on), and public key, if the assembly is strong named.
What is the difference between "using System.Data;" and directly adding the reference from "Add
References Dialog Box"?
When u compile a program using command line, u add the references using /r switch. When you compile a
program using Visual Studio, it adds those references to our assembly, which are added using "Add Reference"
dialog box. While "using" statement facilitates us to use classes without using their fully qualified names.
For example: if u have added a reference to "System.Data.SqlClient" using "Add Reference" dialog box then u
can use SqlConnection class like this:
System.Data.SqlClient.SqlConnection
But if u add a "using System.Data.SqlClient" statement at the start of ur code then u can directly use
SqlConnection class. On the other hand if u add a reference using "using System.Data.SqlClient" statement, but
don't add it using "Add Reference" dialog box, Visual Studio will give error message while we compile the
program.
What is a Metadata?
Metadata is information about a PE. In COM, metadata is communicated through non-standardized type libraries.
In .NET, this data is contained in the header portion of a COFF-compliant PE and follows certain guidelines; it
contains information such as the assembly’s name, version, language (spoken, not computer , culture), what
external types are referenced, what internal types are exposed, methods, properties, classes, and much more.
The CLR uses metadata for a number of specific purposes. Security is managed through a public key in the PE’s
header.
Information about classes, modules, and so forth allows the CLR to know in advance what structures are
necessary. The class loader component of the CLR uses metadata to locate specific classes within assemblies,
either locally or across networks.
Just-in-time (JIT) compilers use the metadata to turn IL into executable code.
Other programs take advantage of metadata as well.
A common example is placing a Microsoft Word document on a Windows 2000 desktop. If the document file has
completed comments, author, title, or other Properties metadata, the text is displayed as a tool tip when a user
hovers the mouse over the document on the desktop. You can use the Ildasm.exe utility to view the metadata in a
PE. Literally, this tool is an IL disassemble.
CTS defines all of the basic types that can be used in the .NET Framework and the operations performed on those
type. All this time we have been talking about language interoperability, and .NET Class Framework. None of this
is possible without all the language sharing the same data types. What this means is that an int should mean the
same in VB, VC++, C# and all other .NET compliant languages. This is achieved through introduction of
Common Type System (CTS).
CLS is the collection of the rules and constraints that every language (that seeks to achieve .NET compatibility)
must follow. It is a subsection of CTS and it specifies how it shares and extends one another libraries.
CLR is .NET equivalent of Java Virtual Machine (JVM). It is the runtime that converts a MSIL code into the host
machine language code, which is then executed appropriately. The CLR is the execution engine for .NET
Framework applications. It provides a number of services, including:
- Code management (loading and execution)
- Application memory isolation
- Verification of type safety
- Conversion of IL to native code.
- Access to metadata (enhanced type information)
- Managing memory for managed objects
- Enforcement of code access security
- Exception handling, including cross-language exceptions
- Interoperation between managed code, COM objects, and pre-existing DLL's (unmanaged code and data)
- Automation of object layout
- Support for developer services (profiling, debugging, and so on).
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 MyOffice.FileAccess.A and MyOffice.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.
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.
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.
.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.
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.
If the server object is instantiated for responding to just one single request, the request should be made in
SingleCall mode.
A single object is instantiated regardless of the number of clients accessing it. Lifetime of this object is determined
by lifetime lease.
Invalidate the current form, the OS will take care of repainting. The Update method forces the repaint.
With these events, why wouldn’t Microsoft combine Invalidate and Paint, so that you wouldn’t have to tell
it to repaint, and then to force it to repaint?
Painting is the slowest thing the OS does, so usually telling it to repaint, but not forcing it allows for the process to
take place in the background.
Call the static method FromArgb of this class and pass it the RGB values.
What class does Icon derive from? Isn’t it just a Bitmap with a wrapper name around it?
No, Icon lives in System.Drawing namespace. It’s not a Bitmap by default, and is treated separately by .NET.
However, you can use ToBitmap method to get a valid Bitmap object from a valid Icon object. file