Showing posts with label INTERVIEW QUESTIONS. Show all posts
Showing posts with label INTERVIEW QUESTIONS. Show all posts

Tuesday, 4 November 2014

sql query interview questions

Write query to get all employee detail from "EmployeeDetail" table?

SELECT * FROM [EmployeeDetail]


Write query to get only "FirstName" column from "EmployeeDetail" table?

SELECT FirstName FROM [EmployeeDetail]


Write query to get FirstName in uppler case as "First Name"?

SELECT UPPER(FirstName) AS [First Name]  FROM [EmployeeDetail]


Write query to get FirstName in lower case as "First Name"?

SELECT LOWER(FirstName) AS [First Name]  FROM [EmployeeDetail]


Write query for combine FirstName and LastName and display it as "Name" (also include white space between first name & last name)?

SELECT FirstName +' '+ LastName AS [Name]  FROM [EmployeeDetail]


Select employee detail whose name is "Vikas"?

SELECT * FROM [EmployeeDetail] WHERE FirstName = 'Vikas'


Get all employee detail from EmployeeDetail table whose "FirstName" start with latter 'a'?

SELECT * FROM [EmployeeDetail] WHERE FirstName like 'a%'



Get all employee details from EmployeeDetail table whose "FirstName" contains 'k'?

 SELECT * FROM [EmployeeDetail] WHERE FirstName like '%k%'



Get all employee details from EmployeeDetail table whose "FirstName" end with 'h'?

 SELECT * FROM [EmployeeDetail] WHERE FirstName like '%h'

  
Get all employee detail from EmployeeDetail table whose "FirstName" start with any single character between 'a-p'?

 SELECT * FROM [EmployeeDetail] WHERE FirstName like '[a-p]%'

Get all employee detail from EmployeeDetail table whose "FirstName" not start with any single character between 'a-p'?

SELECT * FROM [EmployeeDetail] WHERE FirstName like '[^a-p]%'


Get all employee detail from EmployeeDetail table whose "Gender" end with 'le' and contain 4 letters.--The Underscore(_) Wildcard Character represents any single character?

SELECT * FROM [EmployeeDetail] WHERE Gender like '__le' --there are two "_"


Get all employee detail from EmployeeDetail table whose "FirstName" start with 'A' and contain 5 letters?


SELECT * FROM [EmployeeDetail] WHERE FirstName like 'A____' --there are two "_"

Get all employee detail from EmployeeDetail table whose "FirstName" containing '%'. ex:-"Vik%as"?

SELECT * FROM [EmployeeDetail] WHERE FirstName like '%[%]%' --there are two "_"
--According to our table it would return 0 rows, because no name containg '%'


Get all unique "Department" from EmployeeDetail table.

SELECT DISTINCT(Department) FROM [EmployeeDetail]


Get the highest "Salary" from EmployeeDetail table.

SELECT MAX(Salary) FROM [EmployeeDetail]


Get the lowest "Salary" from EmployeeDetail table.

SELECT MIN(Salary) FROM [EmployeeDetail]

Show "JoiningDate" in "dd mmm yyyy" format, ex- "15 Feb 2013"

SELECT CONVERT(VARCHAR(20),JoiningDate,106) FROM [EmployeeDetail]

Show "JoiningDate" in "yyyy/mm/dd" format, ex- "2013/02/15"
SELECT CONVERT(VARCHAR(20),JoiningDate,111) FROM [EmployeeDetail]

Show only time part of the "JoiningDate".

SELECT CONVERT(VARCHAR(20),JoiningDate,108) FROM [EmployeeDetail]


Get only Year part of "JoiningDate".

SELECT DATEPART(YEAR, JoiningDate) FROM [EmployeeDetail] 


Get only Month part of "JoiningDate".

SELECT DATEPART(MONTH,JoiningDate) FROM [EmployeeDetail]

Get system date.

SELECT GETDATE()

Get UTC date.

SELECT GETUTCDATE()

Get the first name, current date, joiningdate and diff between current date and joining date in months.

SELECT FirstName, GETDATE() [Current Date], JoiningDate,
DATEDIFF(MM,JoiningDate,GETDATE()) AS [Total Months] FROM [EmployeeDetail]

Get the first name, current date, joiningdate and diff between current date and joining date in days.

SELECT FirstName, GETDATE() [Current Date], JoiningDate,
DATEDIFF(DD,JoiningDate,GETDATE()) AS [Total Months] FROM [EmployeeDetail]


Get all employee details from EmployeeDetail table whose joining year is 2013.

SELECT * FROM [EmployeeDetail] WHERE DATEPART(YYYY,JoiningDate) = '2013'

Get all employee details from EmployeeDetail table whose joining month is Jan(1).

SELECT * FROM [EmployeeDetail] WHERE DATEPART(MM,JoiningDate) = '1'

Get all employee details from EmployeeDetail table whose joining date between "2013-01-01" and "2013-12-01".

SELECT * FROM [EmployeeDetail] WHERE JoiningDate BETWEEN '2013-01-01' AND '2013-12-01'

Get how many employee exist in "EmployeeDetail" table.

SELECT COUNT(*) FROM [EmployeeDetail]

Select only one/top 1 record from "EmployeeDetail" table.

SELECT TOP 1 * FROM [EmployeeDetail]


Select all employee detail with First name "Vikas","Ashish", and "Nikhil".

SELECT * FROM [EmployeeDetail] WHERE FirstName IN('Vikas','Ashish','Nikhil')


Select all employee detail with First name not "Vikas","Ashish", and "Nikhil".

SELECT * FROM [EmployeeDetail] WHERE FirstName NOT IN('Vikas','Ashish','Nikhil')


Select first name from "EmployeeDetail" table after removing white spaces from right side

SELECT RTRIM(FirstName) AS [FirstName] FROM [EmployeeDetail]


Select first name from "EmployeeDetail" table after removing white spaces from left side

SELECT LTRIM(FirstName) AS [FirstName] FROM [EmployeeDetail]



Display first name and Gender as M/F.(if male then M, if Female then F)

SELECT FirstName, CASE  WHEN Gender = 'Male' THEN 'M'
WHEN Gender = 'Female' THEN 'F'
END AS [Gender]
FROM [EmployeeDetail]

Select first name from "EmployeeDetail" table prifixed with "Hello "

SELECT 'Hello ' + FirstName FROM [EmployeeDetail]

Get employee details from "EmployeeDetail" table whose Salary greater than 600000

SELECT * FROM [EmployeeDetail] WHERE Salary > 600000

Get employee details from "EmployeeDetail" table whose Salary less than 700000

SELECT * FROM [EmployeeDetail] WHERE Salary < 700000


Get employee details from "EmployeeDetail" table whose Salary between 500000 than 600000

SELECT * FROM [EmployeeDetail] WHERE Salary BETWEEN 500000 AND 600000


Select second highest salary from "EmployeeDetail" table.

SELECT TOP 1 Salary FROM
(
      SELECT TOP 2 Salary FROM [EmployeeDetail] ORDER BY Salary DESC
) T ORDER BY Salary ASC



Write the query to get the department and department wise total(sum) salary from "EmployeeDetail" table.

SELECT Department, SUM(Salary) AS [Total Salary] FROM [EmployeeDetail]
GROUP BY Department

Write the query to get the department and department wise total(sum) salary, display it in ascending order according to salary.

SELECT Department, SUM(Salary) AS [Total Salary] FROM [EmployeeDetail]
GROUP BY Department ORDER BY SUM(Salary) ASC

Write the query to get the department and department wise total(sum) salary, display it in descending order according to salary.

SELECT Department, SUM(Salary) AS [Total Salary] FROM [EmployeeDetail]
GROUP BY Department ORDER BY SUM(Salary) DESC
  
Write the query to get the department, total no. of departments, total(sum) salary with respect to department from "EmployeeDetail" table.

SELECT Department, COUNT(*) AS [Dept Counts], SUM(Salary) AS [Total Salary] FROM [EmployeeDetail]
GROUP BY Department

Get department wise average salary from "EmployeeDetail" table order by salary ascending
  
SELECT Department, AVG(Salary) AS [Average Salary] FROM [EmployeeDetail]
GROUP BY Department ORDER BY AVG(Salary) ASC


Get department wise maximum salary from "EmployeeDetail" table order by salary ascending
  
SELECT Department, MAX(Salary) AS [Average Salary] FROM [EmployeeDetail]
GROUP BY Department ORDER BY MAX(Salary) ASC



Get department wise minimum salary from "EmployeeDetail" table order by salary ascending

SELECT Department, MIN(Salary) AS [Average Salary] FROM [EmployeeDetail]
GROUP BY Department ORDER BY MIN(Salary) ASC


Write down the query to fetch Project name assign to more than one Employee

Select ProjectName,Count(*) [NoofEmp] from [ProjectDetail] GROUP BY ProjectName HAVING COUNT(*)>1


Get employee name, project name order by firstname from "EmployeeDetail" and "ProjectDetail" for those employee which have assigned project already.

SELECT FirstName,ProjectName FROM [EmployeeDetail] A INNER JOIN [ProjectDetail] B
ON A.EmployeeID = B.EmployeeDetailID ORDER BY FirstName


Get employee name, project name order by firstname from "EmployeeDetail" and "ProjectDetail" for all employee even they have not assigned project.

SELECT FirstName,ProjectName FROM [EmployeeDetail] A LEFT OUTER JOIN [ProjectDetail] B
ON A.EmployeeID = B.EmployeeDetailID ORDER BY FirstName

Get employee name, project name order by firstname from "EmployeeDetail" and "ProjectDetail" for all employee if project is not assigned then display "-No Project Assigned".

SELECT FirstName, ISNULL(ProjectName,'-No Project Assigned') FROM [EmployeeDetail] A LEFT OUTER JOIN [ProjectDetail] B
ON A.EmployeeID = B.EmployeeDetailID ORDER BY FirstName

Get all project name even they have not matching any employeeid, in left table, order by firstname from "EmployeeDetail" and "ProjectDetail".

SELECT FirstName,ProjectName FROM [EmployeeDetail] A RIGHT OUTER JOIN [ProjectDetail] B
ON A.EmployeeID = B.EmployeeDetailID ORDER BY FirstName


Get complete record(employeename, project name) from both tables([EmployeeDetail],[ProjectDetail]), if no match found in any table then show NULL.

SELECT FirstName,ProjectName FROM [EmployeeDetail] A FULL OUTER JOIN [ProjectDetail] B
ON A.EmployeeID = B.EmployeeDetailID ORDER BY FirstName


Write a query to find out the employeename who has not assigned any project, and display "-No Project Assigned"( tables :- [EmployeeDetail],[ProjectDetail]).

SELECT FirstName, ISNULL(ProjectName,'-No Project Assigned') AS [ProjectName] FROM [EmployeeDetail] A LEFT OUTER JOIN [ProjectDetail] B
ON A.EmployeeID = B.EmployeeDetailID
WHERE ProjectName IS NULL


Write a query to find out the project name which is not assigned to any employee( tables :- [EmployeeDetail],[ProjectDetail]).

SELECT ProjectName FROM [EmployeeDetail] A RIGHT OUTER JOIN [ProjectDetail] B
ON A.EmployeeID = B.EmployeeDetailID
WHERE FirstName IS NULL

Write down the query to fetch EmployeeName & Project who has assign more than one project.

Select EmployeeID, FirstName, ProjectName from [EmployeeDetail] E INNER JOIN [ProjectDetail] P
ON E.EmployeeID = P.EmployeeDetailID
WHERE EmployeeID IN (SELECT EmployeeDetailID FROM [ProjectDetail] GROUP BY EmployeeDetailID HAVING COUNT(*) >1 )

Write down the query to fetch ProjectName on which more than one employee are working along with EmployeeName.

Select FirstName, ProjectName from [EmployeeDetail] E INNER JOIN [ProjectDetail] P
ON E.EmployeeID = P.EmployeeDetailID


View State Interview Questions

What is View State in Asp.net?

View state is nothing but a method that the ASP.NET uses to preserve page and control values between post backs. When the HTML markup for the page is rendered, the current state of the page and values that must be retained during postback are serialized into base64-encoded strings. This information is then put into the view state hidden field.

View state is client-side or server side state management technique?

View state is client-side state management technique

what are the client-side state management technique supported by ASP.NET?

View state
Control state
Hidden fields
Cookies
Query strings

View state is used by Asp.net page automatically or we need to apply it manually?

View state is used automatically by the ASP.NET page framework to persist information that must be preserved between postbacks.


When you can use (take advantage of vs) view state? Or what you can do by use view state?

a) Keep values between postbacks without storing them in session state or in a user profile.
b) Store the values of page or control properties that you define.
c) Create a custom view state provider that lets you store view state information in a SQL Server database or in another data store.

What are the advantages of using view state?

No server resources are required: The view state is contained in a structure within the page code.
Simple implementation: View state does not require any custom programming to use. It is on by default to maintain state data on controls.
Enhanced security features: The values in view state are hashed, compressed, and encoded for Unicode implementations, which provides more security than using hidden fields.


What are the limitations of view state?

Limitations: 

Because view state is stored in the page, it results in a larger total page size.
ASP.NET uses view state only with page and control properties.
View state isn't a good place to store sensitive information that the client shouldn't be allowed to see.

Session state management Interview Questions

What is state management?

State management is the process by which you maintain state and page information over multiple requests for the same or different pages.

Http is stateless, what does this mean?

Stateless protocol is a communications protocol that treats each request as an independent transaction that is unrelated to any previous request so that the communication consists of independent pairs of requests and responses.

What is Session?

 We know that Http is stateless, means when we open a webpage and fill some information and then move to next page then the data which we have entered will lost.
It happed do to Http protocol stateless nature. So here session come into existence, Session provide us the way of storing data in server memory. So you can store your page data into server
memory and retrieve it back during page post backs.

What are the Advantage and disadvantage of Session?

Advantages: 

Session provides us the way of maintain user state/data.
It is very easy to implement.
One big advantage of session is that we can store any kind of object in it. : E.g. database, dataset... etc.
By using session we don't need to worry about data collesp, because it stores every client data separately.
Session is secure and transparent from the user.

Disadvantages:

Performance overhead in case of large volumes of data/user, because session data is stored in server memory.
Overhead involved in serializing and de-serializing session data, because in the case of State Server and SQLServer session modes, we need to serialize the objects before storing them.

What is Session ID in Asp.net?

 Asp.Net use 120 bit identifier to track each session. This is secure enough and can't be reverse engineered. When client communicate with server, only session id is transmitted, between them. When client request for data, ASP.NET looks on to session ID and retrieves corresponding data.

By default where the sessions ID's are stored?

By default, the unique identifier for a session is stored in a non-expiring session cookie in the browser. You can specify that session identifiers not be stored in a cookie by setting the cookieless attribute to true in the sessionState configuration element.
We can also configure our application to store it in the url by specifying a "cookieless" session
The ASP Session cookie has this format:-
ASPSESSIONIDACSSDCCC=APHELKLDMNKNIOJONJACDHFN


Where does session stored if cookie is disabled on client’s machine?

If you want to disable the use of cookies in your ASP.NET application and still make use of session state, you can configure your application to store the session identifier in the URL instead of a cookie by setting the cookieless attribute of the sessionState configuration element to true, or to UseUri, in the Web.config file for your application.
The following code example shows a Web.config file that configures session state to use cookieless session identifiers.
Code:
<configuration>
  <system.web>
    <sessionState
      cookieless="true"
      regenerateExpiredSessionId="true"
      timeout="30" />
  </system.web>
</configuration>


Can you describe all the property set in web.config under session state?
Ans:
Code:
<configuration>
  <sessionstate
      mode="inproc"
      cookieless="false"
      timeout="20"
      sqlconnectionstring="data source=127.0.0.1;user id=<user id>;password=<password>"
      server="127.0.0.1"
      port="42424"
  />
</configuration>

Mode: The mode setting supports three options: inproc, sqlserver, and stateserver. As stated earlier, ASP.NET supports two modes: in process and out of process. There are also two options for out-of-process state management: memory based (stateserver), and SQL Server based (sqlserver). We'll discuss implementing these options shortly.
Cookieless: The cookieless option for ASP.NET is configured with this simple Boolean setting.
Timeout: This option controls the length of time a session is considered valid. The session timeout is a sliding value; on each request the timeout period is set to the current time plus the timeout value
Sqlconnectionstring: The sqlconnectionstring identifies the database connection string that names the database used for mode sqlserver.
Server: In the out-of-process mode stateserver, it names the server that is running the required Windows NT service: ASPState.
Port: The port setting, which accompanies the server setting, identifies the port number that corresponds to the server setting for mode stateserver.

What are Session Events?

There are two types of session events available in ASP.NET:

Session_Start
Session_End
You can handle both these events in the global.asax file of your web application. When a new session initiates, the session_start event is raised, and the Session_End event raised when a session is abandoned or expires.

How you can disable session?

If we set session Mode="off" in web.config, session will be disabled in the application. For this, we need to configure web.config the following way:
Code:
<configuration>
  <sessionstate  Mode="off"/>
</configuration>

What are the session modes available in asp.net?

Off
InProc
StateServer(Out-Proc)
SQLServer
Custom

What is the default session modes in asp.net?

 InProc

what are the disadvantages of using InProc session mode?

Its stores session information in the current Application Domain.
So it will lose data if we restart the server.

Session_End() event is supported by which session mode only?

Session_End() event is supported by InProc mode only.

What do you understand by StateServer(Out-Proc) mode?

StateServer session mode is also called Out-Proc session mode. StateServer uses a stand-alone Windows Service which is independent of IIS and can also be run on a separate server. This session state is totally managed by aspnet_state.exe. This server may run on the same system, but it's outside of the main application domain where your web application is running. This means if you restart your ASP.NET process, your session data will still be alive.

Under StateServer(Out-Proc) mode the session state is managed by?

aspnet_state.exe

What are the advantages and disadvantages of StateServer(Out-Proc) Session mode?

 Advantages:
It keeps data separate from IIS so any issues with IIS will not hamper session data.
It is useful in web farm and web garden scenarios.
Disadvantages:
Process is slow due to serialization and de-serialization.
State Server always needs to be up and running.



Under SQLServer Session Mode where the session data store?

 In SQLServersession mode, session data is serialized and stored in A SQL Server database.

What is the big disadvantage of SqlServer Session mode?

The main disadvantage of SqlServer Session mode storage method is the overhead related with data serialization and de-serialization.

What are the advantages and disadvantages of SqlServer Session mode?

Advantages:

Session data not affected if we restart IIS.
The most reliable and secure session management.
It keeps data located centrally, is easily accessible from other applications.
Very useful in web farms and web garden scenarios.

Disadvantages:

Processing is very slow in nature.
Object serialization and de-serialization creates overhead for the application.
As the session data is handled in a different server, we have to take care of SQL Server. It should be always up and running.

Friday, 31 October 2014

AJAX Interview Questions

1. What is ASP.NET AJAX?
ASP.NET AJAX, mostly called AJAX, is a set of extensions of ASP.NET. It is developed by Microsoft to implement AJAX functionalities in Web applications. ASP.NET AJAX provides a set of components that enable the developers to develop applications that can update only a specified portion of data without refreshing the entire page. The ASP.NET AJAX works with the AJAX Library that uses object-oriented programming (OOP) to develop rich Web applications that communicate with the server using asynchronous postback.
2. What is the difference between synchronous postback and asynchronous postback?
The difference between synchronous and asynchronous postback is as follows:
·                     Asynchronous postback renders only the required part of the page; whereas, synchronous postback renders the entire page for any postback.
·                     Asynchronous postback executes only one postback at a time, that is, if you have two buttons doing asynchronous postback, the actions will be performed one by one; whereas, synchronous postback executes all the actions at once.
·                     Asynchronous postback only modifies the update panel that raises the postback; whereas, synchronous postback modifies the entire page.
3. What technologies are being used in AJAX?
AJAX uses four technologies, which are as follows:
·                     JavaScript
·                     XMLHttpRequest
·                     Document Object Model (DOM)
·                     Extensible HTML (XHTML) and Cascading Style Sheets (CSS)
4. Why do we use the XMLHttpRequest object in AJAX?
The XMLHttpRequest object is used by JavaScript to transfer XML and other text data between client and server. The XMLHttpRequest object allows a client-side script to perform an HTTP request. AJAX applications use the XMLHttpRequest object so that the browser can communicate to the server without requiring a postback of the entire page. In earlier versions of Internet Explorer, MSXML ActiveX component is liable to provide this functionality; whereas, Internet Explorer 7 and other browsers, such as Mozilla Firefox, XMLHttpRequest is not liable to.
5. How can we get the state of the requested process?
XMLHttpRequest get the current state of the request operation by using the readyStateproperty. This property checks the state of the object to determine if any action should be taken. The readyState property uses numeric values to represent the state.
6. What are the different controls of ASP.NET AJAX?
ASP.NET AJAX includes the following controls:
·                     ScriptManager
·                     ScriptManagerProxy
·                     UpdatePanel
·                     UpdateProgress
·                     Timer
7. What are the new features included in the Microsoft AJAX library?
The Microsoft AJAX library is a client-based JavaScript library that is compatible with all modern browsers and offers a lot of functionality as compared to JavaScript. This library is released with new features and fully supports ASP.NET 4.0'. The new features included in the Microsoft AJAX library are as follows:
·                     Imperative syntax - Supports simple imperative syntax that is used to create and manage controls.
·                     Script loader - Retrieves all scripts that are needed by one or more client component or control automatically and executes the scripts in the order in which they are received.
·                     Client data access - Supports to access client data and display by client data control and client template.
·                     Client datacontext - Supports read and write permission to data from a database.
·                     The AdoNetDataContext class - Enables you to easily interact with an ADO.NET Data Services service.
·                     jQuery integration - Helps to access the elements in your Web pages, work with client-side events, enable visual effects, and make it easier to use AJAX in your applications.
8. Explain the Step property of the NumericUpDownExtender control.
The Step property sets the steps for numeric increment and decrement. The default value is 1.
9. What are the new features of ASP.NET AJAX 4.0?
ASP.NET 4.0 AJAX includes several new features that provide more functionality to a user. These features are as follows:
·                     Support for live data binding.
·                     Support for client-side template rendering.
·                     Support for declarative instantiation of client components.
·                     Support for using the observer pattern on JavaScript objects and arrays.
·                     Support for invoking ADO.NET data services and data contexts.
·                     Support for the DataView control.
10. Why do we use the UpdateProgress control in AJAX?
The UpdateProgress control is somewhat related to the UpdatePanel control. TheUpdateProgress control enables you to design a user-friendly interface when a Web page consists of a number of UpdatePanel controls for partial-page rendering.

The 
UpdateProgress control makes you aware of the status information about the partial-page updates in the UpdatePanel control.
11. What is JSON?
JSON is an abbreviation of JavaScript Object Notation. It is a safe and reliable data interchange format in JavaScript, which is easy to understand not only for the users but also for the machines.
12. How many validation controls are available in ASP.NET AJAX 4.0?
The following validation controls are available in ASP.NET AJAX 4.0:
·                     FilteredTextBoxExtender - Enables you to apply filtering to a text box.
·                     MaskedEditExtender and MaskedEditValidator - Restricts a user to enter only a certain pattern of characters in the TextBox by applying a mask to the input.
·                     ValidatorCalloutExtender - Attaches to the ASP.NET validators so that the error messages are not displayed as a simple text but as a balloon-style ToolTip.
·                     NoBot - Prevents the spam/bot from filling the input forms automatically and uses the Completely Automated Public Turing test to tell Computers and Humans Apart (CAPTCHA), which is a type of challenge-response test to ensure that the response is not generated by the computer.
·                     PasswordStrengthExtender - Measures the strength of the password text entered within the text box by validating with the different strength specified parameters
13. Explain the limitations of AJAX.
The following are the limitations of AJAX:
·                     It is difficult to bookmark a particular state of the application.
·                     Function provided in the code-behind file do not work because the dynamic pages cannot register themselves on browsers history engine automatically.
·                     If JavaScript is disabled, then AJAX is not able to perform any work.
·                     Response time may be slow because different controls of a page are loaded at different time.
14. What are the differences between AJAX and JavaScript?
The differences between AJAX and JavaScript are given as follows:
·                     AJAX sends request to the server and does not wait for the response. It performs other operations on the page during that time. JavaScript make a request to the server and waits for response.
·                     AJAX does not require the page to refresh for downloading the whole page while JavaScript manages and controls a Web page after being downloaded.
·                     AJAX minimizes the overload on the server since the script needs to request once while JavaScript posts a request that updates the script every time.
15. Explain the UpdatePanel control.
The UpdatePanel control specifies the portions of a Web page that can be updated together. As the UpdatePanel control refreshes only a selected part of the Web page instead of refreshing the entire page with a postback, you get more flexibility to create rich and client-centric Web applications.

Refreshing a selected part of the Web page is referred as partial-page update. You can add one or more 
UpdatePanel control in the Web page, which automatically participates in partial-page update without custom client script. The UpdatePanel control uses the UpdatePanel class to support the partial-page rendering.
16. What does the DynamicPopulateExtender control do?
The DynamicPopulateExtender control populates the contents of a control dynamically. It enables you to send an asynchronous call to the server that dynamically populates the contents of a control. The DynamicPopulateExtender control replaces the contents of a control with the result of a Web service or page method call.
17. What does the MinimumPrefixLength property of the AutoCompleteExtendercontrol do?
The MinimumPrefixLength property sets the minimum number of characters that must be entered before getting suggestions from the Web service.
18. What is the importance of client-side libraries?
Client-side libraries contain built-in code to make asynchronous calls over XMLHTTP. These libraries automatically handle browser compatibility issues. These libraries are based on a programming model similar to ASP.NET.
19. Can we call server-side code from JavaScript?
Yes, page methods and Web services are the two techniques to call the server-side code from JavaScript.
20. What are the components of the ASP.NET AJAX architecture?
You can divide the ASP.NET AJAX architecture into two components - AJAX client architecture and AJAX server architecture.
21. Describe AJAX Control Extender Toolkit.
AJAX Control Toolkit is a set of extenders that are used to extend the functionalities of the ASP.NET controls. The extenders use a block of JavaScript code to add new and enhanced capabilities to the ASP.NET controls. AJAX Control Toolkit is a free download available on the Microsoft site. You need to install this toolkit on your system before using extenders.
22. Explain the need of the Timer control in AJAX.
The Timer control is used with an UpdatePanel control to allow partial-page updates at a specified interval. It is mostly used when a periodically partial-page update for one or moreUpdatePanel controls is required without refreshing the entire page.

The 
Timer control is a server control that sets a JavaScript component in the Web page. Theinterval property of the Timer control specifies time in milliseconds. Similar to theUpdatePanel control, the Timer control also requires an instance of the ScriptManagercontrol in the Web page.

When the 
Timer control initiates a postback, the Tick event is raised on the server for which you can provide an event handler to perform the actions when the page is submitted to the server. The Tick event occurs when the time specified in the interval property has elapsed and the page is posted on the server. You can add one or more Timer controls on a Web page. Usually the entire page requires only a single Timer control; however, you can use multipleTimer controls, if the UpdatePanel controls are being updated at different intervals.
23. List the different states of XMLHttpRequest with their description.
The different states of the XMLHttpRequest object are as follows:
·                     Uninitialized - Refers to the state when the object has not been initialized.
·                     Open - Refers to the state when the object has been created; however, the send function has not been invoked.
·                     Sent -Refers to the state when the send function is invoked; however, the status and headers are not available.
·                     Receiving - Refers to the state when the process is receiving data.
·                     Loaded - Refers to the state when the procedure is completed and the entire data is available.
24. Can we nest the UpdatePanel controls?
Yes, we can nest the UpdatePanel control.
25. What is the role of the ScriptManagerProxy control?
A Web page cannot contain more than one ScriptManager control. You can use theScriptManagerProxy control to add scripts to other pages; however to perform such an operation, you need to work with a master page that contains the ScriptManager control. If you have only few pages that need to register to a script or a Web service, then you should remove these pages from the ScriptManager control and add them as individual pages by using the ScriptManagerProxy control. If you include the scripts on the master page by theScriptManager control, then the items get downloaded on each page that extends the master page, even if they are not necessary.
26. What is the work of the ConformOnFormSubmit property in theConfirmButtonExtender control?
The ConformOnFormSubmit property determines whether or not the confirm dialog box should wait when the form is submitted for display.
27. What is the syntax to create AJAX objects?
AJAX uses the following syntax to create an object:

var myobject = new AjaxObject("page path");

The page path is the URL of the Web page containing the object that you want to call. The URL must be of the same domain as the Web page.
28. Is there any difference between HTML and XHTML?
Extensible HTML (XHTML) is a markup language that provides the mixture expressions of HTML and XML. XHTML is a flexible markup language that enables automated processing by standard XML tools, which was difficult in HTML.
29. What are the requirements to run ASP.NET AJAX applications on a server?
AJAX is a built-in functionality of .NET Framework 4.0. Therefore, you can run an AJAX application by just installing Microsoft Visual Studio 2010. However, to use extenders in your applications, you are required to install AJAX Control Toolkit and copy theAjaxControlToolkit.dll file to the Bin directory of your application.
30. Describe the situations in which AJAX should not be used.
You should not use AJAX if:
·                     You want the page to show in a search engine, such as Google, because WebCrawler does not execute JavaScript code.
·                     The browser does not support JavaScript.
·                     You want to create a secure application.
31. What is the use of the ScriptManager control in AJAX?
The ScriptManager control is a core control that performs a key role in implementing the ASP.NET AJAX functionality. It helps to use JavaScript for the Microsoft AJAX Library. It should be noted that AJAX Library on a Web page can only be used if the Web page contains theScriptManager control. This control makes use of the ScriptManager class to maintain the AJAX script libraries and script files. It allows for partial page rendering, Web service calls, and use of ASP.NET AJAX Client Library by rendering the AJAX Library scripts to the browser.
32. How can you find out that an AJAX request has been completed?
You can find out that an AJAX request has been completed by using the readyState property. If the value of this property equals to four, it means that the request has been completed and the data is available.
33. Is it possible to use multiple ScriptManager controls on a Web page?
No, it is not possible.
34. What are the new controls introduced in ASP.NET AJAX Control Toolkit?
The following controls are introduced with the new version of AJAX Control Toolkit:
·                     SeaDragonExtender control - Refers to the control that is used to deeply zoom the images. You can zoom in or out the image or the particular portion of the image by using the mouse. You can also create a menu over the Seadragon control. This control is helpful when you want to analyze the image closely.
·                     AsyncFileUploadExtender control - Refers to the control that provides the facility to upload and save the files on the server asynchronously. You can check the outcome either at the server or client side.
35. Briefly describe ASP.NET AJAX Framework.
ASP.NET AJAX Framework provides a platform where developers can develop such type of applications that use the AJAX concept. The AJAX provides the collection of technologies to create dynamic pages at the client side. The JavaScript requests are responsible to retrieve data from the server or send data to the server. Even some processing at server also requires handling requests, such as searching and storing of data. These tasks are achieved more easily using the AJAX Framework.

AJAX Framework is completely devoted to process requests. The objective of the AJAX engine is to reduce the delays that the user notices while performing a postback to the server. AJAX Framework allows JavaScript functions to send requests to server at the client side. On the other side, it allows the server to process the client's request, searches data, and responds the result to the browser.
36. Is the AjaxControlToolkit.dll file installed in the Global Assembly Cache?
No, you have to copy this file to the Bin folder of your application.
37. What are the different ways to pass parameters to the server?
We can pass parameters to the server using either the GET or POST method. The following code snippets show the example of both the methods:
·                     Get: XmlHttpObject.Open("GET", "file1.txt", true);
·                     Post: XmlHttpObject.Open("POST", "file2.txt", true);
38. What are the extender controls?
The extender controls uses a block of JavaScript code to add new and enhanced capabilities to ASP.NET. The developers can use a set of sample extender controls through a separate download - AJAX Control Toolkit (ACT).
39. Describe the AccordionExtender control.
The AccordionExtender control is similar to the CollapsiblePanelExtender control. It allows you to group multiple collapsible panels in a single control. At the same time, it also manages the collapsed and expanded state of each panel; therefore, expanding one panel at a time. In other words, the AccordionExtender control does not support expanding two or more panels simultaneously. Instead, the header templates of all the panels are always visible so that you can click on any of them to display the hidden contents. By default, theAccordionExtender control opens with one panel as expanded.