QB1
QB1
QB1
Answer1:
SOAP. Transport Protocols: It is essential for the acceptance of Web Services th
at they are based on established Internet infrastructure. This in fact imposes t
he usage of of the HTTP, SMTP and FTP protocols based on the TCP/IP family of tr
ansports. Messaging Protocol: The format of messages exchanged between Web Servi
ces clients and Web Services should be vendor neutral and should not carry detai
ls about the technology used to implement the service. Also, the message format
should allow for extensions and different bindings to specific transport protoco
ls. SOAP and ebXML Transport are specifications which fulfill these requirements
. We expect that the W3C XML Protocol Working Group defines a successor standard
.
Answer2:
SOAP is not the transport protocol. SOAP is the data encapsulation protocol that
is used but the transport protocol is fairly unlimited. Generally HTTP is the m
ost common transport protocol used though you could conceivanly use things like
SMTP or any others. SOAP is not dependant on any single transport protocol or OS
, it is a syntactical and logical definition, not a transport protocol.
True or False: A Web service can only be written in .NET.?
False.
What does WSDL stand for?
Web Services Description Language
Where on the Internet would you look for Web services?
UDDI repositaries like uddi.microsoft.com, IBM UDDI node, UDDI Registries in Goo
gle Directory, enthusiast sites like XMethods.net.
What tags do you need to add within the asp:datagrid tags to bind columns manual
ly?
Column tag and an ASP:databound tag.
How is a property designated as read-only?
In VB.NET:
Public ReadOnly Property PropertyName As ReturnType
Get Your Property Implementation goes in here
End Get
End Property
in C#
public returntype PropertyName
{
get{
//property implementation goes here
}
// Do not write the set implementation
}
Which control would you use if you needed to make sure the values in two differe
nt controls matched?
Use the CompareValidator control to compare the values of 2 different controls.
True or False: To test a Web service you must create a windows application or We
b application to consume this service?
False.
How many classes can a single .NET DLL contain?
Unlimited.
Describe session handling in a webfarm, how does it work and what are the limits
?
Set the sessionState mode in the web.config file to StateServer.
StateServer mode uses an out-of-process Windows NT Server to store state informa
tion.
It solves the session state loss problem in InProc mode.
Allows a webfarm to store session on a central server.
It provides a Single point of failure at the State Server.
Follow these simple steps:
- In a web farm, make sure you have the same in all your web servers.
- Also, make sure your objects are serializable.
- For session state to be maintained across different web servers in the web far
m, the Application Path of the website in the IIS Metabase should be identical i
n all the web servers in the web farm.
What are the disadvantages of viewstate/what are the benefits?
Answer1:
Disadvantage of viewstate is that additional data is sent to the browser. The be
nefits are that you do not have to manually manage refreshing the page fields af
ter a submit, (when re-displaying the same page).
Answer2:
Automatic view-state management is a feature of server controls that enables the
m to repopulate their property values on a round trip (without you having to wri
te any code). This feature does impact performance, however, since a server cont
rols view state is passed to and from the server in a hidden form field. You shou
ld be aware of when view state helps you and when it hinders your pages performan
ce.
What tags do you need to add within the asp:datagrid tags to bind columns manual
ly?
Answer1:
Set AutoGenerateColumns Property to false on the datagrid tag
Answer2:
tag and either or tags (with appropriate attributes of course)
What is State Management in .Net and how many ways are there to maintain a state
in .Net? What is view state?
Web pages are recreated each time the page is posted to the server. In tradition
al Web programming, this would ordinarily mean that all information associated w
ith the page and the controls on the page would be lost with each round trip.
To overcome this inherent limitation of traditional Web programming, the ASP.NET
page framework includes various options to help you preserve changes that is, f
or managing state. The page framework includes a facility called view state that
automatically preserves property values of the page and all the controls on it
between round trips.
However, you will probably also have application-specific values that you want t
o preserve. To do so, you can use one of the state management options.
Client-Based State Management Options:
View State
Hidden Form Fields
Cookies
Query Strings
Server-Based State Management Options
Application State
Session State
Database Support
What tag do you use to add a hyperlink column to the DataGrid?
Depends on whos definition of hyperlink your using. Manually a std html anchor ta
g (a) will work or you can use the micro-magical tag
What is the standard you use to wrap up a call to a Web service?
Several possible answers depending on your interpretation of the quesiton, but I
think you were aiming for SOAP (with the caveat that this is MSs version of SOAP
)
What is the difference between boxing and unboxing ?
Boxing allows us to convert value types to reference types. Basically, the runti
me creates a temporary reference-type box for the object on heap.
Eg:
int i=20;
object o=i;
Describe the difference between a Thread and a Process?
Answer1:
Thread - is used to execute more than one program at a time.
process - executes single program
Answer2:
A thread is a path of execution that run on CPU, a proccess is a collection of t
hreads that share the same virtual memory. A process have at least one thread of
execution, and a thread always run in a process context.
Answer3:
The operating system creates a process for the purpose of running a program. Eac
h process executes a single program. Processes own resources allocated by the op
erating system. Resources include memory, file handles, sockets, device handles,
and windows. Processes do not share address spaces or file resources except thr
ough explicit methods such as inheriting file handles or shared memory segments,
or mapping the same file in a shared way.
Threads allow a program to do multiple things concurrently. At least one thread
exists within each process. If multiple threads can exist within a process, then
they share the same memory and file resources.
Answer4:
Thread is a light weight process, which is initialized itself by a process. Ligh
t weigt processes does not loads resources required by it itself, these are load
ed by its parent process which has generated it.
What is a Windows Service and how does its lifecycle differ from a standard EXE?
Windows Service applications are long-running applications that are ideal for us
e in server environments. The applications do not have a user interface or produ
ce any visual output; it is instead used by other programs or the system to perf
orm operations. Any user messages are typically written to the Windows Event Log
. Services can be automatically started when the computer is booted. This makes
services ideal for use on a server or whenever you need long-running functionali
ty that does not interfere with other users who are working on the same computer
. They do not require a logged in user in order to execute and can run under the
context of any user including the system. Windows Services are controlled throu
gh the Service Control Manager where they can be stopped, paused, and started as
needed.
What is the difference between an EXE and a DLL?
An EXE can run independently, whereas DLL will run within an EXE. DLL is an in-p
rocess file and EXE is an out-process file
What is strong-typing versus weak-typing? Which is preferred? Why?
Strong type is checking the types of variables as soon as possible, usually at c
ompile time. While weak typing is delaying checking the types of the system as l
ate as possible, usually to run-time. Which is preferred depends on what you wan
t. For scripts & quick stuff youll usually want weak typing, because you want to
write as much less code as possible. In big programs, strong typing can reduce e
rrors at compile time.
What are PDBs? Where must they be located for debugging to work?
Answer1:
To debug precompiled components such as business objects and code-behind modules
, you need to generate debug symbols. To do this, compile the components with th
e debug flags by using either Visual Studio .NET or a command line compiler such
as Csc.exe (for Microsoft Visual C# .NET) or Vbc.exe (for Microsoft Visual Basi
c .NET).
Using Visual Studio .NET
1. Open the ASP.NET Web Application project in Visual Studio .NET.
2. Right-click the project in the Solution Explorer and click Properties.
3. In the Properties dialog box, click the Configuration Properties folder.
4. In the left pane, select Build.
5. Set Generate Debugging Information to true.
6. Close the Properties dialog box.
7. Right-click the project and click Build to compile the project and generate s
ymbols (.pdb files).
Answer2:
A program database (PDB) file holds debugging and project state information that
allows incremental linking of a Debug configuration of your program.
The linker creates project.PDB, which contains debug information for the projects
EXE file. The project.PDB contains full debug information, including function p
rototypes, not just the type information found in VCx0.PDB. Both PDB files allow
incremental updates.
They should be located at bin\Debug directory
What is cyclomatic complexity and why is it important?
Cyclomatic complexity is a computer science metric (measurement) developed by Th
omas McCabe used to generally measure the complexity of a program. It directly m
easures the number of linearly independent paths through a programs source code.
The concept, although not the method, is somewhat similar to that of general tex
t complexity measured by the Flesch-Kincaid Readability Test.
Cyclomatic complexity is computed using a graph that describes the control flow
of the program. The nodes of the graph correspond to the commands of a program.
A directed edge connects two nodes, if the second command might be executed imme
diately after the first command. By definition,
CC = E - N + P
where
CC = cyclomatic complexity
E = the number of edges of the graph
N = the number of nodes of the graph
P = the number of connected components.
What is FullTrust? Do GACed assemblies have FullTrust?
Your code is allowed to do anything in the framework, meaning that all (.Net) pe
rmissions are granted. The GAC has FullTrust because its on the local HD, and tha
t has FullTrust by default, you can change that using caspol
What does this do? gacutil /l | find /i about
Answer1:
This command is used to install strong typed assembly in GAC
Answer2:
gacutil.exe is used to install strong typed assembly in GAC. gacutil.exe /l is u
sed to lists the contents of the global assembly cache. |(pipe) symbol is used t
o filter the output with another command. find /i about is to find the text about on
gacutil output. If any lines contains the text about then that line will get disp
layed on console window.
Contrast OOP and SOA. What are tenets of each
Service Oriented Architecture. In SOA you create an abstract layer that your app
lications use to access various services and can aggregate the services. These ser
vices could be databases, web services, message queues or other sources. The Ser
vice Layer provides a way to access these services that the applications do not
need to know how the access is done. For example, to get a full customer record,
I might need to get data from a SGL Server database, a web service and a messag
e queue. The Service layer hides this from the calling application. All the appl
ication knows is that it asked for a full customer record. It doesnt know what sy
stem or systems it came from or how it was retrieved.
How does the XmlSerializer work? What ACL permissions does a process using it re
quire?
XmlSerializer requires write permission to the systems TEMP directory.
Why is catch(Exception) almost always a bad idea?
Well, if at that point you know that an error has occurred, then why not write t
he proper code to handle that error instead of passing a new Exception object to
the catch block? Throwing your own exceptions signifies some design flaws in th
e project.
What is the difference between Debug. Write and Trace. Write? When should each b
e used?
Answer1:
The Debug. Write call wont be compiled when the DEBUG symbol is not defined (when
doing a release build). Trace. Write calls will be compiled. Debug. Write is fo
r information you want only in debug builds, Trace. Write is for when you want i
t in release build as well. And in any case, you should use something like log4n
et because that is both faster and better
Answer2:
Debug. Write & Trace. write - both works in Debug mode, while in Release Mode,Tr
ace.write only will work .Try changing the Active Config property of Solution in
Property page nd find the difference. Debug.write is used while debugging a pro
ject and Trace.write is used in Released version of Applications.
What is the difference between a Debug and Release build? Is there a significant
speed difference? Why or why not?
Debug build contain debug symbols and can be debugged while release build doesnt
contain debug symbols, doesnt have [Conational(DEBUG)] methods calls compiled, cant
be debugged (easily, that is), less checking, etc. There should be a speed diffe
rence, because of disabling debug methods, reducing code size etc but that is no
t a guarantee (at least not a significant one)
Contrast the use of an abstract base class against an interface?
Answer1:
In the interface all methods must be abstract, in the abstract class some method
s can be concrete. In the interface no accessibility modifiers are allowed, whic
h is ok in abstract classes
Answer2:
Whether to Choose VB.NET/C#.
Both the languages are using same classes and namespaces. Once it compile and ge
nerates MSIL, there is no meaning of which language it was written. If you are J
ava/C++ programmer better to choose C# for same coding style otherwise you can c
hoose VB.net.
Author: Amit Shah Member Level: Gold Member Rank: 0 Date: 13/Jan/
2009 Rating: Points: 6
What is the difference between a.Equals(b) and a == b?
Answer1:
a=b is used for assigning the values (rather then comparison) and a==b is for co
mparison.
Answer2:
a == b is used to compare the references of two objects
a.Equals(b) is used to compare two objects
Answer3:
A equals b -> copies contents of b to a
a == b -> checks if a is equal to b
Answer4:
Equals method compares both type and value of the variable, while == compares va
lue.
int a = 0;
bool b = 0
if(a.Equals(b))
Answer5:
a.Equals(b) checks whether the Type of a is equal to b or not! Put it in another
way,
Dim a As Integer = 1
Dim b As Single = 1
a.Equals(b) returns false. The Equals method returns a boolean value.
a == b is a simple assignment statement.
Answer6:
a.equals(b) will check whether the b has same type as a has and also has the same da
ta as a has.
a==b will do the same thing.
if you have done this in c++ under operator overloading than you guys must be awar
e of this sytaxts. they are doing the same thing there is only sytaxtical differ
ence.
let me explain it in different manner.
a==b : means compare b with a. always left hand side expression evaluated first so h
ere in this case a (considered an object) will call the overloaded operator = which
defines Equals(object) method in its class. thus, ultimately a.equals(b) goanna cal
led.
so the answer is: both will perform the same task. they are different by syntaxt
Answer7:
Difference b/w a==b,a.Equals(b)
a.Equals(b):
The default implementation of Equals supports reference equality only, but deriv
ed classes can override this method to support value equality.
For reference types, equality is defined as object equality; that is, whether th
e references refer to the same object. For value types, equality is defined as b
itwise equality
== :
For predefined value types, the equality operator (==) returns true if the value
s of its operands are equal, false otherwise. For reference types other than str
ing, == returns true if its two operands refer to the same object. For the strin
g type, == compares the values of the strings.
How would one do a deep copy in .NET?
Answer1:
System.Array.CopyTo() - Deep copies an Array
Answer2:
How would one do a deep copy in .NET?
The First Approach.
1.Create a new instance.
2.Copy the properties from source instance to newly created instance.
[Use reflection if you want to write a common method to achive this]
The Second Approach.
1. Serialize the object and deserialize the output.
: Use binary serialization if you want private variables to be copied.
: Use xml Serialization if you dont want private variable to be copied.
What is boxing?
Boxing is an implicit conversion of a value type to the type object
int i = 123; // A value type
Object box = i // Boxing
Unboxing is an explicit conversion from the type object to a value type
int i = 123; // A value type object box = i; // Boxing
int j = (int)box; // Unboxing
Is string a value type or a reference type?
Answer1:
String is Reference Type.
Value type - bool, byte, chat, decimal, double, enum , float, int, long, sbyte,
short,strut, uint, ulong, ushort
Value types are stored in the Stack
Reference type - class, delegate, interface, object, string
Reference types are stored in the Heap
Answer2:
Yes String is reference type. C# gives two types of variable reference and value
type. string and object are reference type.
How does the lifecycle of Windows services differ from Standard EXE?
Windows services lifecycle is managed by Service Control Manager which is responsi
ble for starting and stopping the service and the applications do not have a use
r interface or produce any visual output, but Standard executable doesnt require Co
ntrol Manager and is directly related to the visual output
Whats wrong with a line like this? DateTime.Parse(myString)
the result returned by this function is not assigned to anything, should be some
thing like varx = DateTime.Parse(myString)
NET is Compile Time OR RunTime Environment?
.Nets framework has CLS,CTS and CLR.CTS checks declartion of types at the time wh
en u write code and CLS defines some rules and restrictions.and CLR comile every
thing at runtime with following benefits: Vastly simplified development Seamless
integration of code written in various languages Evidence-based security with c
ode identity Assembly-based deployment that eliminates DLL Hell Side-by-side ver
sioning of reusable components Code reuse through implementation inheritance Aut
omatic object lifetime management Self describing objects
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 ext
ension),the ISAPI filter aspnet_isapi.dll takes care of it by passing the reques
t tothe actual worker process aspnet_wp.exe.
Whats the difference between Response.Write() andResponse.Output.Write()?
The latter one allows you to write formattedoutput.
What methods are fired during the page load?
Init() - when the pageis
instantiated, Load() - when the page is loaded into server memory,PreRender()
- the brief moment before the page is displayed to the user asHTML, Unload()
- when page finishes loading.
Where does the Web page belong in the .NET Framework class hierarchy?
System.Web.UI.Page
Where do you store the information about the users locale?
System.Web.UI.Page.Culture
Whats the difference between Codebehind="MyCode.aspx.cs" andSrc="MyCode.aspx.cs"?
CodeBehind is relevant to Visual Studio.NET only.
Whats a bubbled event?
When you have a complex control, like DataGrid, writing an event processing rout
ine for each object (cell, button, row, etc.) is quite tedious. The controls can
bubble up their event handlers, allowing the main DataGrid event handler to tak
e care of its constituents.
Suppose you want a certain ASP.NET function executed on MouseOver overa certain
button. Where do you add an event handler?
Its the Attributesproperty,
the Add function inside that property. So
btnSubmit.Attributes.Add("onMouseOver","someClientCode();")
A simpleJavascript:ClientCode(); in the button control of the .aspx page will atta
ch the handler (javascript function)to the onmouseover event.
What data type does the RangeValidator control support?
Integer,String and Date.
.Net Database Interview Questions and Answers
To test a Web Service you must create a windows application or web application t
o consume this service? It is True/False?
FALSE
How many classes can a single.NET DLL contain?
Answer1:
As many
Answer2:
One or more
What are good ADO.NET object(s) to replace the ADO Recordset object?
The differences includes
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 in ADO
In contrast, a dataset is a collection of one or more tables in ADO.net
ADO is designed primarily for connected access
ADO.net the disconnected access to the database is used
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 OleDbDat
aAdapter, SqlDataAdapter, OdbcDataAdapter, or OracleDataAdapter object), which m
akes calls to an OLE DB provider or the APIs provided by the underlying data sou
rce.
In ADO you cant update the database from the recordset. ADO.NET the data adapter
allows you to control how the changes to the dataset are transmitted to the dat
abase.
On order to get assembly info which namespace we should import?
System.Reflection Namespace
How do you declare a static variable and what is its lifetime? Give an example.
Answer1
static int MyintThe life time is during the entire application.
br> Answer2
The static modifier is used to declare a static member, which belongs to the typ
e itself rather than to a specific object. The static modifier can be used with
fields, methods, properties, operators, events and constructors, but cannot be u
sed with indexers, destructors, or types. In C#, the static keyword indicates a
class variable. In VB, the equivalent keyword is Shared. Its scoped to the class
in which it occurs.
Example
a. Static int var //in c#.net
b. static void Time( ) //in c#.net
How do you get records number from 5 to 15 in a dataset of 100 records? Write co
de.
Answer1
DataSet ds1=new DataSet(); String strCon=data source=IBM-6BC8A0DACEF;initial cata
log=pubs;integrated security=SSPI;persist + security info=False;user
id=sa;workstation id=IBM-6BC8A0DACEF;packet size=4096?;
String strCom1=SELECT * FROM employee;
SqlDataAdapter sqlDa1=new SqlDataAdapter(strCom1,strCon);
ds1.Tables.Add(employee);
sqlDa1.Fill(ds1,40,50,ds1.Tables[employee].TableName);
DataGrid dg1.DataSource=ds1.Tables[employee].DefaultView;
dg1.DataBind();
Answer2
OleDbConnection1.Open()
OleDbDataAdapter1.Fill(DataSet21, 5, 15, tab)
This will fill the dataset with the records starting at 5 to 15
How do you call and execute a Stored Procedure in .NET? Give an example.
Answer1
ds1=new DataSet();
sqlCon1=new SqlConnection(connectionstring);
String strCom1=byroyalty;
sqlCom1=new SqlCommand(strCom1,sqlCon1);
sqlCom1.CommandType=CommandType.StoredProcedure;
sqlDa1=new SqlDataAdapter(sqlCom1);
SqlParameter myPar=new SqlParameter(@percentage,SqlDbType.Int);
sqlCom1.Parameters.Add (myPar);
myPar.Value=40;
sqlDa1.Fill(ds1);
dg1.DataSource=ds1;
dg1.DataBind();
Answer2
Yes
Dim cn as new OleDbConnection ( Provider=Microsoft.Jet.OLEDB.4.0;+ _
Data Source=C:\Documents and Settings\User\My Documents\Visual Studio Projects\12
09\db1.mdb+ _
User ID=Admin;+ _
Password=;);
Dim cmd As New OleDbCommand(Products, cn)
cmd.CommandType = CommandType.StoredProcedure
Dim da As New OleDataAdapter(cmd)
Dim ds As New DataSet()
da.Fill(ds, Products)
DataGrid1.DataSource = ds.Tables(Products)
What is the maximum length of a varchar in SQL Server?
Answer1
VARCHAR[(n)]
Null-terminated Unicode character string of length n,
with a maximum of 255 characters. If n is not supplied, then 1 is assumed.
Answer2
8000
Answer3
The business logic is the aspx.cs or the aspx.vb where the code is being written
. The presentation logic is done with .aspx extention.
How do you define an integer in SQL Server?
We define integer in Sql server as
var_name int
How do you separate business logic while creating an ASP.NET application?
There are two level of asp.net debugging
1. Page level debugging
For this we have to edit the page level debugging enable the trace to true in th
e line in the html format of the page.
%@ Page Language=vb trace=trueAutoEventWireup=false Codebehind=WebForm1.aspx.vb Inheri
=WebApplication2.WebForm1?>
2. You can enable the debugging in the application level for this
Edit the following trace value in web.config file
Enable trace enabled=true.
If there is a calendar control to be included in each page of your application,
and and we do not intend to use the Microsoft-provided calendar control, how do
you develop it? Do you copy and paste the code into each and every page of your
application?
Create the Calendar User Control
The control we will create will contain a calendar control and a label which has
the corresponding date and time written
Steps are:-
Creating a CalenderControl
1) To begin, open Visual Studio .NET and begin a new C# Windows Control Library.
2) You may name it whatever you like, for this sample the project name will be C
alenderControl
Using the Calender Control in a Windows Application
Its just like adding any other control like a button or a label.
1) First, create a new Windows Application project named: CustomControl.
2) Add a reference to the Calender Control DLL named: CalenderControl.dll.
3) Now you a can customize the Toolbox:
Right-Click the Toolbox> .NET Framework Components> Browse> select the CalenderC
ontrol.dll.
4)The Calender Control is now added to the Toolbox and can be inserted in Window
s Form as any other control. The control itself will take care of the date displ
ay
Author: Amit Shah Member Level: Gold Member Rank: 0 Date: 13/Jan/
2009 Rating: Points: 6
How can you deploy an asp.net application ?
You can deploy an ASP.NET Web application using any one of the following three d
eployment options.
a) Deployment using VS.NET installer
b) Using the Copy Project option in VS .NET
c) XCOPY Deployment
Explain similarities and differences between Java and .NET?
Comparing Java and .NET is comparing apples and oranges. Either the question nee
ds to be to compare Java and C# or J2EE and .NET.
What are the XML files that are important in developing an ASP.NET application?
The XML file necessary for the for developing an asp.net application is Web.conf
ig
Specify the best ways to store variables so that we can access them in various p
ages of ASP.NET application?
Declare the variables in Global.aspx
How many objects are there in ASP?
Answer1
8 objects, they are request,response, server,application,session,file, dictionar
y, textstream.
Answer2
There are 6 objects in ASP.net
a) Server
b) Session
c) Application
d) ObjectContext
e) Response
f) Request
Which DLL file is needed to be registered for ASP?
The dll needed for the ASP.net is SYSTEM.WEB.dll
Is there any inbuilt paging (for example shoping cart, which will show next 10 r
ecords without refreshing) in ASP? How will you do pating?
Use DataGrid control which has in-built paging features for the purpose.
What does Server.MapPath do?
Answer1
srver.mappath() maps the path given in the argument to the servers physical path.
Answer2
It returns the complete(absolute) path of the file used in parameter.
Answer3
It returns a string containing the physical path in the servers file system that
corresponds to the virtual or relative path specified by the Path argument.
Name atleast three methods of response object other than Redirect.
Answer1
a) Response.Clear( )
Clears the content of the current output stream.
b) Response.Close( )
Closes the network socket for the current response.
c) Response.End( )
Stops processing the current request and sends all buffered content to the clien
t immediately.
Answer2
methods of Response is Redirect a. Transfer
Name atleast two methods of response object other than Transfer.
a) Response.ClearContent( )
Clears the content of the current output stream.
b) Response.ClearHeaders( )
Clears the HTTP headers from the current output stream.
What is State?
It is the property of the web forms.
ASP.NET provides four types of state:
Application state
Session state
Cookie state
View state.
Explain differences between ADO and DAO.
dao- can access only access database
ado- can access any databases
How many types of cookies are there?
2 types, persistant and impersistant.
How many types of cookies are there?
Answer1
Two type of cookeies.
a) single valued eg request.cookies(UserName).value=Mahesh
b)Multivalued cookies. These are used in the way collections are used.
e.g.
request.cookies(CookiName)(UserName)=Mahesh
request.cookies(CookiName)(UserID)=ABC003?
rember no value method in multivalued cookie
Answer2
There are two types of cookies:
Session cookies
Persistent cookies
Tell few steps for optimizing (for speed and resource) ASP page/application.
Avoid mixing html code with asp code
Which command using Query Analyzer will give you the version of SQL Server and O
perating System?
@@VERSION
Returns version, processor architecture, build date, and operating system for th
e current installation of SQL Server.
How to find the SQL server version from Query Analyzer ?
Answer1
To determine which version of Microsoft SQL Server 2005 is running, connect to S
QL Server 2005 by using SQL Server Management Studio, and then run the following
Transact-SQL statement:
SELECT SERVERPROPERTY(productversion), SERVERPROPERTY (productlevel), SERVERPROPERTY
(edition)
The results are:
The product version (for example, 9.00.1399.06?)
. The product level (for example, RTM).
The edition (for example, Enterprise Edition).
For example, the result looks similar to:
9.00.1399.06 RTM Enterprise Edition
How to determine which version of SQL Server 2000 is running
To determine which version of SQL Server 2000 is running, connect to SQL Server
2000 by using Query Analyzer, and then run the following code:
SELECT SERVERPROPERTY(productversion), SERVERPROPERTY (productlevel), SERVERPROPERTY
(edition)
The results are:
The product version (for example, 8.00.534).
The product level (for example, RTM or SP2?).
The edition (for example, Standard Edition). For example, the result looks similar
to
:
8.00.534 RTM Standard Edition
Answer2
One can also use SELECT @@Version where the result would look like
Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86)
Oct 14 2005 00:33:37
Copyright (c) 1988-2005 Microsoft Corporation
Express Edition on Windows NT 5.1 (Build 2600: Service Pack 2)
Author: Amit Shah Member Level: Gold Member Rank: 0 Date: 13/Jan/
2009 Rating: Points: 6
Using query analyzer, name 3 ways you can get an accurate count of the number of
records in a table.
Answer1.
a. Select count(*) from table1
b. SELECT object_name(id) ,rowcnt FROM sysindexes WHERE indid IN (1,0) AND OBJEC
TPROPERTY(id, IsUserTable) = 1
c. exec sp_table_validation @table = authors
Answer2.
SELECT count( * ) as totalrecords FROM employee
This will display total records under the name totalrecords in the table employe
e
use COUNT_BIG
Returns the number of items in a group.
@@ROWCOUNT
Returns the number of rows affected by the last statement.
Use this statement after an SQL select * statement, to retrieve the total number
of rows in the table
What is the purpose of using COLLATE in a query?
Answer1.
Collation refers to a set of rules that determine how data is sorted and compare
d. Character data is sorted using rules that define the correct character sequen
ce, with options for specifying case-sensitivity, accent marks, kana character t
ypes and character width.
Answer2.
COLLATE is a clause that can be applied to a database definition or a column def
inition to define the collation, or to a character string expression to apply a
collation cast.
What is one of the first things you would do to increase performance of a query?
For example, a boss tells you that a query that ran yesterday took 30 seconds, b
ut today it takes 6 minutes?
Answer1.
Use Storedprocedure for any optimized result, because it is an compiled code.
Answer2.
One of the best ways to increase query performance is to use indexes.
What is an execution plan? When would you use it? How would you view the executi
on plan?
The Query Analyzer has a feature called Show Execution Plan. This option allows
you to view the execution plan used by SQL Servers Query Optimizer to actually ex
ecute the query. This option is available from the Query menu on the main menu o
f Query Analyzer, and must be turned on before the query is executed. Once the q
uery is executed, the results of the execution plan are displayed in graphical f
ormat in a separate window, available from a tab that appears below the query re
sults window on the screen.
What is the STUFF function and how does it differ from the REPLACE function? Ans
wer1:
stuff-> inserts into it without removing any thing. Replace->replace the given t
ext with the new one.
Answer2:
STUFF - it deletes a specified length of characters and inserts another set of c
haracters at a specified starting point. REPLACE -Replaces all occurrences of a
specified string value with another string value.
What does it mean to have quoted_identifier on? What are the implications of hav
ing it off?
SET QUOTED_IDENTIFIER ON- Causes SQL Server to follow the SQL-92 rules regarding
quotation mark delimiting identifiers and literal strings. Identifiers delimite
d by double quotation marks can be either Transact-SQL reserved keywords or can
contain characters not usually allowed by the Transact-SQL syntax rules for iden
tifiers.
What is the difference between a Local temporary table and a Global temporary ta
ble? How is each one used?
Answer1:
Local templrary table will have a single # (#tablename) appended with the table
name.Global templrary table will have Double # (##tablename) appended with the t
able name.
Ex:create table #table1
local temp. table will be available until the session who created it logs out, b
ut global temp. table is available till the last session gets close in SQLServer
.
Answer1:
Local temporary tables are visible only in the current session; global temporary
tables are visible to all sessions.Prefix local temporary table names with sing
le number sign (#table_name), and prefix global temporary table names with a dou
ble number sign (##table_name).
What are cursors? Name four type of cursors and when each one would be applied?
Opening a cursor on a result set allows processing the result set one row at a t
ime.
The four API server cursor types supported by SQL Server are:
a) Static cursors
b) Dynamic cursors
c) Forward-only cursors
d) Keyset-driven cursors
What is the purpose of UPDATE STATISTICS?
UPDATE STATISTICS- it updates information about the distribution of key values f
or one or more statistics groups (collections) in the specified table or indexed
view.
How do you use DBCC statements to monitor various ASPects of a SQL Server instal
lation?
Database Consistency Checker (DBCC) - Is a statement used to check the logical a
nd physical consistency of a database, check memory usage, decrease the size of
a database, check performance statistics, and so on. Database consistency checke
r (DBCC) ensures the physical and logical consistency of a database, but is not
corrective. DBCC can help in repairing or checking the installation in case of a
ny failure.
What is referential integrity and how can we achieve it?
Referential integrity preserves the defined relationships between tables when re
cords are entered or deleted. In SQL Server, referential integrity is based on r
elationships between foreign keys and primary keys or between foreign keys and u
nique keys. Referential integrity ensures that key values are consistent across
tables. Such consistency requires that there be no references to nonexistent val
ues and that if a key value changes, all references to it change consistently th
roughout the database.
We can achieve this by using foreign key.
What is indexing?
If we give proper indexes on a table so that any queries written against this ta
ble can run efficiently. As your data sets grow over time, SQL Server will conti
nue to rebuild indexes and move data around as efficiently as possible. This pro
perty is known as Indexing.
Explain differences between Server.Transfer and server.execute method?
Answer1:
server.transfer-> transfers the servers control to the requested page given in th
e parameter.
server.Execute-> executes the requested page from the current page itself, with
no change in the address bar. after execution the next line of code is executed
in the current page.
Answer2.
Execute method returns control to the page in which it is called once the page s
pecified in the Execute method finishes processing, the Transfer method does not
return control to the calling page.
What is de-normalization? When do you do it and how?
De-normalization is the process of attempting to optimize the performance of a d
atabase by adding redundant data. Its used To introduce redundancy into a table i
n order to incorporate data from a related table. The related table can then be
eliminated. De-normalization can improve efficiency and performance by reducing
complexity in a data warehouse schema.
Explain features of SQL Server like Scalability , Availability, Integration with
Internet.
Scalability - The same Microsoft SQL Server 2000 database engine operates on Mic
rosoft Windows 2000 Professional, Microsoft Windows 2000 Server, Microsoft Windo
ws 2000 Advanced Server, Windows 98, and Windows Millennium Edition. It also run
s on all editions of Microsoft Windows NT version 4.0. The database engine is a
robust server that can manage terabyte-sized databases accessed by thousands of
users. Availability - SQL Server 2000 can maintain the extremely high levels of
availability required by large Web sites and enterprise systems. Integration -Th
e SQL Server 2000 TCP/IP Sockets communications support can be integrated with M
icrosoft Proxy Server to implement secure Internet and intranet communications.
What is DataWarehousing?
A data warehouse is a collection of data gathered and organized so that it can e
asily by analyzed, extracted, synthesized, and otherwise be used for the purpose
s of further understanding the data.
What is OLAP?
OLAP is an acronym for On Line Analytical Processing. It is an approach to quick
ly provide the answer to analytical queries that are dimensional in nature.
How do we upgrade SQL Server 7.0 to 2000?
Run the installation of the SQL Server 2000
In the Existing Installation dialog box, click Upgrade your existing installatio
n, and then click Next.
In the Upgrade dialog box, you are prompted as to whether you want to proceed wi
th the requested upgrade. Click Yes, upgrade my to start the upgrade process, an
d then click Next. The upgrade runs until finished.
In the Connect to Server dialog box, select an authentication mode, and then cli
ck Next.
If you are not sure which mode to use, accept the default: The Windows account i
nformation I use to log on to my computer with (Windows). In Start Copying Files
dialog box, click Next.
Now your Sql Server would be upgraded.
What is job?
It can be defined as a task performed by a computer system. For example, printin
g a file is a job. Jobs can be performed by a single program or by a collection
of programs.
What is Task?
Whenever you execute a program, the operating system creates a new task for it.
The task is like an envelope for the program: it identifies the program with a t
ask number and attaches other bookkeeping information to it.
How do you find the error, how can you know the number of rows affected by last
SQL Statement?
Answer1
@@errors->give the last error occurred in the current DB.
Ans. select @@rowcount
Answer2.
Use @@ERROR which returns the error number for the last Transact-SQL statement e
xecuted fro knowing the error.
Use @@ROWCOUNT which returns the number of rows affected by the last statement f
or finding the no of rows affected.
What are the advantages/disadvantages of viewstate?
Disadvantages - Because the view state for a given page must be kept on the serv
er, it is possible for the current state to be out of synchronization with the c
urrent page of the browser, if the user uses the Back feature on the browser to
go back in the history. Advantages - On ordinary Web Forms pages, their view sta
te is sent by the server as a hidden variable in a form, as part of every respon
se to the client, and is returned to the server by the client as part of a postb
ack. However, to reduce bandwidth demand when using mobile controls, ASP.NET doe
s not send a pages view state to the client. Instead, the view state is saved as
part of a users session on the server. Where there is a view state, a hidden fiel
d that identifies this pages view state is sent by the server as part of every re
sponse to the client, and is returned to the server by the client as part of the
next request.
Author: Amit Shah Member Level: Gold Member Rank: 0 Date: 13/Jan/
2009 Rating: Points: 6
Describe session handling in webform. How does it work and what are the limits?
Session management in ASP.NET can be done in two ways:
Using Cookies
Encoding of URLs with Session ID
Explain differences between framework 1.0 and framework 1.1?
1. Native Support for Developing Mobile Web Applications
2. Unified Programming Model for Smart Client Application Development
3. Enable Code Access Security for ASP.NET Applications
4. Native Support for Communicating with ODBC and Oracle Databases
5. Supports for IPv6
If we write any code for dataGrid methods, what is the access specifier used for
that methods in the code behind file and why and how? Give an example.
We use Friends Modifer for the dataGrid methods. Friend WithEvents DataGrid1 As
System.Windows.Forms.DataGrid
What is the use of trace utility?
Tracing is a very important monitoring and debugging tool for distributed, multi
tier applications. Such applications often contain problems that can only be obs
erved when the application is under a heavy load and the inherent randomness of
a real-life environment. Trace utility allows developers and administrators to m
onitor the health of applications running in real-life settings.
What are the differences between User control and Web control and Custom control
?
Answer1:
Usercontrol-> control that is created as u wish.
Web Control-> any control placed in web page (web application page)
Custom Control-> same as user control with some difference.
user control custome control
1.easy to create difficult
2.no full suport for customers using
Visual studio tools Full support
3. Seperate copy of the control in each
assembly only one copy in global assembly.
4. best for static layout best for dynamic layout.
Answer2
User control
1) Reusability web page
2) We cant add to toolbox
3) Just drag and drop from solution explorer to page (aspx)
4) Good for static layout
5) Easier to create
6) Not complied into DLL
Custom controls
1) Reusability of control (or extend functionalities of existing control)
2) We can add toolbox
3) Just drag and drop from toolbox
4) You can register user control to. Aspx page by Register tag
5) A single copy of the control is required in each application
6) Good for dynamic layout
7) Hard to create
8) Compiled in to dll
Custom controls
1) Reusability of control
2) Pre defined Control
3) Just drag and drop from toolbox
If I have more than one version of one assemblies, then how will I use old versi
on in my application? Give an example.
Change the assembly version number in the AssemblyInfo.vb file
How does you handle this COM components developed in other programming languages
in .NET?
Answer1:
add the component in add reference window, click .NETCOM tab.
Answer1:
While adding the refferences we can handle the COM components in other .Net prog
ramming languages.
How will you register COM+ services?
Through X-Copy Deployment.
How do u call and execute a stored procedure in .NET?
system.Data;
system.Data.SqlClient;
SqlConnection sqCon = new SqlConnection(connection string);
SqlCommand sqCmd = new SqCmd();
sqCmd.Connection = sqCon;
sqCmd.CommandText = procedure_name;
sqCmd.CommandType = CommandType.StoredProcedure;
sqComd.ExecuteReader();
What are the different types of replication? How are they used?
Replication is used for distributing data and the execution of stored procedures
across an enterprise. The replication technology allows you to make duplicate c
opies of your data, move those copies to different locations, and synchronize th
e data automatically so that all copies have the same data values.
The different types of replications are
a) transactional replication
b) merge replication
How do SQL Server 2000 and XML linked? What is SQL Server agent?
Every Request or the Response to or from SQL Server is converted into XML format
. Its purpose is to ease the implementation of tasks for the DBA, with its full-
function scheduling engine, which allows you to schedule your own jobs and scrip
ts.
How do you create thread in .NET?
1) Import System.Threading
2) Create a new thread using new Thread() and assign the address of the method
3) Use Thread.Start method to start the execution
using System;
using System.Threading;
public class Test
{
static void Main()
{
ThreadStart job = new ThreadStart(ThreadJob);
Thread thread = new Thread(job);
thread.Start();
Author: Amit Shah Member Level: Gold Member Rank: 0 Date: 13/Jan/
2009 Rating: Points: 6
.Net Deployment Interview Questions and Answers
What do you know about .NET assemblies?
Assemblies are the smallest units of versioning and deployment in the .NET appli
cation. Assemblies are also the building blocks for programs such as Web service
s, Windows services, serviced components, and .NET Remoting applications.
Whats the difference between private and shared assembly?
Private assembly is used inside an application only and does not have to be iden
tified by a strong name. Shared assembly can be used by multiple applications an
d has to have a strong name.
Whats a strong name?
A strong name includes the name of the assembly, version number, culture identit
y, and a public key token.
How can you tell the application to look for assemblies at the locations other t
han its own install?
Use the
directive in the XML .config file for a given application.
<probing privatePath=c:\mylibs; bin\debug />
should do the trick. Or you can add additional search paths in the Properties bo
x of the deployed application.
How can you debug failed assembly binds?
Use the Assembly Binding Log Viewer (fuslogvw.exe) to find out the paths searche
d.
Where are shared assemblies stored?
Global assembly cache.
How can you create a strong name for a .NET assembly?
With the help of Strong Name tool (sn.exe).
Wheres global assembly cache located on the system?
Usually C:\winnt\assembly or C:\windows\assembly.
Can you have two files with the same file name in GAC?
Yes, remember that GAC is a very special folder, and while normally you would no
t be able to place two files with the same name into a Windows folder, GAC diffe
rentiates by version number as well, so its possible for MyApp.dll and MyApp.dll
to co-exist in GAC if the first one is version 1.0.0.0 and the second one is 1.1
.0.0.
So lets say I have an application that uses MyApp.dll assembly, version 1.0.0.0.
There is a security bug in that assembly, and I publish the patch, issuing it un
der name MyApp.dll 1.1.0.0. How do I tell the client applications that are alrea
dy installed to start using this new MyApp.dll?
Use publisher policy. To configure a publisher policy, use the publisher policy
configuration file, which uses a format similar app .config file. But unlike the
app .config file, a publisher policy file needs to be compiled into an assembly
and placed in the GAC.
What is delay signing?
Delay signing allows you to place a shared assembly in the GAC by signing the as
sembly with just the public key. This allows the assembly to be signed with the
private key at a later stage, when the development process is complete and the c
omponent or assembly is ready to be deployed. This process enables developers to
work with shared assemblies as if they were strongly named, and it secures the
private key of the signature from being accessed at different stages of developm
ent.