Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

What Is Responsetext?

Answer»

The 'responseText' property is a STRING version of data RETURNED from SERVER PROCESS.

The 'responseText' property is a string version of data returned from server process.

2.

What Is Onreadystatechange?

Answer»

The 'onreadystatechange' property FIRES at every STATE change EVENT.

The 'onreadystatechange' property fires at every state change event.

3.

What Is Readystate?

Answer»

The 'readyState' property is an object status integer. It uses the INTEGERS 0 to 4 for uninitialized, loading, loaded, INTERACTIVE and complete STATES.

The 'readyState' property is an object status integer. It uses the integers 0 to 4 for uninitialized, loading, loaded, interactive and complete states.

4.

What Is Getallresponseheaders()?

Answer»

The GETALLRESPONSEHEADERS() method is USED to return the FULL SET of HEADERS as a string.

The getAllResponseHeaders() method is used to return the full set of headers as a string.

5.

What Is Status?

Answer»

The 'status' PROPERTY is for returning numeric CODES from the server like ERROR codes, etc.

The 'status' property is for returning numeric codes from the server like error codes, etc.

6.

Explain Setrequestheader("label", "value")?

Answer»

The setRequestHeader("LABEL", "value") METHOD is used to ASSIGN a label/value pair to the header to be SENT with a request.

The setRequestHeader("label", "value") method is used to assign a label/value pair to the header to be sent with a request.

7.

How Do We Pass Parameters To The Server?

Answer»

Below are the two ways of PASSING data to server. The first one shows by USING GET and the second by POST.

xmlHttpObj.open("GET","HTTP://" + location.host + 

"/XmlHttpExample1/WebForm1.aspx?value=123", TRUE);

xmlHttpObj.open("POST","http://" + location.host + 

"/XmlHttpExample1/WebForm1.aspx?value=123", true);

Below are the two ways of passing data to server. The first one shows by using GET and the second by POST.

xmlHttpObj.open("GET","http://" + location.host + 

"/XmlHttpExample1/WebForm1.aspx?value=123", true);

xmlHttpObj.open("POST","http://" + location.host + 

"/XmlHttpExample1/WebForm1.aspx?value=123", true);

8.

Can You Explain Scriptmanager Control In Ajax?

Answer»

SCRIPTMANAGER control is the CENTRAL heart of Ajax. They MANAGE all the Ajax related objects on the page.

Some of the core objectives of scriptmanager control are as follows:-

  • Helps load core Ajax related script and library.
  • Provides access to web services.
  • ASP.NET authentication, role and profile services are loaded by scriptmanager control.
  • Provided registration of server controls and behaviors.
  • Enable full or PARTIAL rendering of a web page.
  • Provide localization features.

In short , any Ajax enable page should have this control.

Scriptmanager control is the central heart of Ajax. They manage all the Ajax related objects on the page.

Some of the core objectives of scriptmanager control are as follows:-

In short , any Ajax enable page should have this control.

9.

Explain Open ("method", "url", "async", "uname", "pswd")?

Answer»

Open ("method", "URL", "ASYNC", "uname", "pswd"):- This method takes a URL and other values needed for a request. You can also specify how the request is SENT by GET, POST, or PUT. ONE of the important values is how this request will be sent asynchronously or synchronously. True means that processing is CARRIED after the send () method, without waiting for a response. False means that processing is waits for a response before continuing.

Open ("method", "URL", "async", "uname", "pswd"):- This method takes a URL and other values needed for a request. You can also specify how the request is sent by GET, POST, or PUT. One of the important values is how this request will be sent asynchronously or synchronously. True means that processing is carried after the send () method, without waiting for a response. False means that processing is waits for a response before continuing.

10.

What Is Ready State?

Answer»

READY State: - Returns the current state of the object.

0 = uninitialized

1 = LOADING

2 = loaded

3 = interactive

4 = COMPLETE

Ready State: - Returns the current state of the object.

0 = uninitialized

1 = loading

2 = loaded

3 = interactive

4 = complete

11.

How Do I Get The Xmlhttprequest Object?

Answer»

Depending upon the BROWSER.

if (window.ActiveXObject) { 
// INTERNET Explorer 
http_request = new ActiveXObject("Microsoft.XMLHTTP"); 

ELSE if...
if(window.XMLHTTPREQUEST)
{
xmlhttpobj=new XMLHttpRequest();
return xmlhttpobj;
}
else
{
TRY
{
xmlhttpobj=new ActiveXObject("Microsoft.XMLHTTP");
}catch(e)
{
xmlhttpobj=new ActiveXObject("Msxml2.XMLHTTP");
}
}
}

Depending upon the browser.

if (window.ActiveXObject) { 
// Internet Explorer 
http_request = new ActiveXObject("Microsoft.XMLHTTP"); 

else if...
if(window.XMLHttpRequest)
{
xmlhttpobj=new XMLHttpRequest();
return xmlhttpobj;
}
else
{
try
{
xmlhttpobj=new ActiveXObject("Microsoft.XMLHTTP");
}catch(e)
{
xmlhttpobj=new ActiveXObject("Msxml2.XMLHTTP");
}
}
}

12.

Explain What Is Json?

Answer»

JSON is a very lightweight data format based on a SUBSET of the JAVASCRIPT syntax, namely array and object literals. JSON allows communicating with server in a STANDARD way. JSON is used as COMMUNICATION notation instead of XML.

Hide Copy Code

var oBike = 
{
"color" : "Green",
"Speed": 200,
};

alert(oBike.color); //outputs "Green"

alert(oBike.Speed); //outputs 200

The above code creates an javascript object bike with two properties Color and Speed.

JSON is a very lightweight data format based on a subset of the JavaScript syntax, namely array and object literals. JSON allows communicating with server in a standard way. JSON is used as communication notation instead of XML.

Hide Copy Code

var oBike = 
{
"color" : "Green",
"Speed": 200,
};

alert(oBike.color); //outputs "Green"

alert(oBike.Speed); //outputs 200

The above code creates an javascript object bike with two properties Color and Speed.

13.

What Is Cors? How Does It Work?

Answer»

Cross-origin resource sharing (CORS) is a mechanism that allows many resources (e.g., fonts, JavaScript, etc.) on a web page to be requested from another domain OUTSIDE the domain from which the resource originated. It's a mechanism supported in HTML5 that manages XMLHttpRequest access to a domain different.

CORS ADDS new HTTP headers that PROVIDE access to permitted origin domains. For HTTP methods other than GET (or POST with certain MIME types), the specification mandates that browsers first use an HTTP OPTIONS request header to solicit a list of supported (and available) methods from the server. The actual request can then be submitted. Servers can also notify clients WHETHER "credentials" (including Cookies and HTTP Authentication data) should be sent with requests.

Cross-origin resource sharing (CORS) is a mechanism that allows many resources (e.g., fonts, JavaScript, etc.) on a web page to be requested from another domain outside the domain from which the resource originated. It's a mechanism supported in HTML5 that manages XMLHttpRequest access to a domain different.

CORS adds new HTTP headers that provide access to permitted origin domains. For HTTP methods other than GET (or POST with certain MIME types), the specification mandates that browsers first use an HTTP OPTIONS request header to solicit a list of supported (and available) methods from the server. The actual request can then be submitted. Servers can also notify clients whether "credentials" (including Cookies and HTTP Authentication data) should be sent with requests.

14.

What Is The Fundamental Behind Ajax?

Answer»

XmlHttpRequest is the fundamental behind AJAX. This ALLOWS the browser to COMMUNICATE to a back end server ASYNCHRONOUSLY.XmlHttpRequest object allows the browser to communicate with server with out posting the whole page and only sending the necessary data asynchronously.

XmlHttpRequest is the fundamental behind Ajax. This allows the browser to communicate to a back end server asynchronously.XmlHttpRequest object allows the browser to communicate with server with out posting the whole page and only sending the necessary data asynchronously.

15.

How Can We Consume Data Directly In Web Services?

Answer»

We can CONSUME data DIRECTLY using 'Sys.Data' controls. We know this is a very short answer for such an important question, but the bandwidth of this book does not allow for the same. We suggest the readers to practice some sample using the 'Sys.Data' control.

Note: - We have LEFT important controls like Data controls, LOGIN controls, Web part controls, MOBILE controls and profilescriptservice control. These controls will be rarely asked during interviews, but from project aspects they are very important.

We can consume data directly using 'Sys.Data' controls. We know this is a very short answer for such an important question, but the bandwidth of this book does not allow for the same. We suggest the readers to practice some sample using the 'Sys.Data' control.

Note: - We have left important controls like Data controls, Login controls, Web part controls, mobile controls and profilescriptservice control. These controls will be rarely asked during interviews, but from project aspects they are very important.

16.

What Is Responsexml?

Answer»

The 'responseXML' PROPERTY is DOM-compatible document OBJECT of data RETURNED from server PROCESS.

The 'responseXML' property is DOM-compatible document object of data returned from server process.

17.

What Is Statustext?

Answer»

The 'statusText' property is used for string MESSAGES that ACCOMPANY the status code.

The 'statusText' property is used for string messages that accompany the status code.

18.

Explain Abort() Function?

Answer»

The ABORT() is USED to STOP the CURRENT REQUEST.

The abort() is used to stop the current request.

19.

What Is Getresponseheader("headerlabel")?

Answer»

The getResponseHeader("headerLabel") method is USED to RETURN the STRING VALUE of a single HEADER label.

The getResponseHeader("headerLabel") method is used to return the string value of a single header label.

20.

What Is Open(arg, Arg,arg,arg,arg) Function?

Answer»

The OPEN("method", "URL"[, asyncFlag[, "userName"[, "PASSWORD"]]]) is used to ASSIGN the DESTINATION URL, method, and other OPTIONAL attributes of a request.

The open("method", "URL"[, asyncFlag[, "userName"[, "password"]]]) is used to assign the destination URL, method, and other optional attributes of a request.

21.

What Is Send(content)?

Answer»

The SEND(CONTENT) METHOD transmits the request, OPTIONALLY with postable string or the data of DOM object.

The send(content) method transmits the request, optionally with postable string or the data of DOM object.

22.

How Do We Do Asynchronous Processing Using Ajax?

Answer»

xmlHttpObj.onreadystatechange = function1();

Above is the CODE snippet, which will help us to do asynchronous processing. So function1 () will be called when the XMLHTTP REQUEST object goes to on READY state CHANGE.

xmlHttpObj.onreadystatechange = function1();

Above is the code snippet, which will help us to do asynchronous processing. So function1 () will be called when the XMLHTTP request object goes to on ready state change.

23.

What Is Response Text?

Answer»

RESPONSE TEXT: - RETURNS the response in PLAIN STRING.

Response Text: - Returns the response in plain string.

24.

What Is Setrequestheader ("label"," Value")?

Answer»

SetRequestHeader ("label"," VALUE"):- SETS label value PAIR for a HTTP HEADER.

SetRequestHeader ("label"," value"):- Sets label value pair for a HTTP header.

25.

What Is Response?

Answer»

RESPONSE: - Returns the response as XML. THEREFORE, this gives US DOM object MODEL, which can then be traversed.

Response: - Returns the response as XML. Therefore, this gives us DOM object model, which can then be traversed.

26.

Explain Onreadystatechange?

Answer»

ONREADYSTATECHANGE: - This is a EVENT handler, which fires at EVERY STATE CHANGE.

Onreadystatechange: - This is a event handler, which fires at every state change.

27.

Explain Getallresponseheaders ()?

Answer»

getAllResponseHeaders ():- Returns a COLLECTION of HTTP HEADERS as string. If you want a specific HEADER value, you can use getResponseHeader ("header NAME")

getAllResponseHeaders ():- Returns a collection of HTTP headers as string. If you want a specific header value, you can use getResponseHeader ("header name")