Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger


Sunday 14 September 2008

Javascript Interview Questions and Answers 7

What does the term sticky session mean in a web-farm scenario? Why would you use a sticky session? What is the potential disadvantage of using a sticky session?
Sticky session refers to the feature of many commercial load balancing solutions for web-farms to route the requests for a particular session to the same physical machine that serviced the first request for that session. This is mainly used to ensure that a in-proc session is not lost as a result of requests for a session being routed to different servers. Since requests for a user are always routed to the same machine that first served the request for that session, sticky sessions can cause uneven load distribution across servers.

You have an ASP.NET web application running on a web-farm that does not use sticky sessions - so the requests for a session are not guaranteed to be served the same machine. Occasionally, the users get error message Validation of viewstate MAC failed. What could be one reason that is causing this error?
The most common reason for this error is that the machinekey value in machine.config is different for each server. As a result, viewstate encoded by one machine cannot be decoded by another. To rectify this, edit the machine.config file on each server in the web-farm to have the same value for machinekey.

To set all checkboxes to true using JavaScript?
//select all input tags
function SelectAll() {
var checkboxes = document.getElementsByTagName("input");

}
}
}

How to select an element by id and swapping an image ? ...


...

brand

What does undefined value mean in javascript?
Undefined value means the variable used in the code doesn't exist or is not assigned any value or the property doesn't exist.

What is the difference between undefined value and null value?
(i)Undefined value cannot be explicitly stated that is there is no keyword called undefined whereas null value has keyword called null
(ii)typeof undefined variable or property returns undefined whereas typeof null value returns object

What is variable typing in javascript?
It is perfectly legal to assign a number to a variable and then assign a string to the same variable as follows
example
i = 10;
i = "string";
This is called variable typing

Does javascript have the concept level scope?
No. JavaScript does not have block level scope, all the variables declared inside a function possess the same level of scope unlike c,c++,java.

What are undefined and undeclared variables?
Undeclared variables are those that are not declared in the program (do not exist at all),trying to read their values gives runtime error.But if undeclared variables are assigned then implicit declaration is done .
Undefined variables are those that are not assigned any value but are declared in the program.Trying to read such variables gives special value called undefined value.

What is === operator ?
==== is strict equality operator ,it returns true only when the two operands are having the same value without any type conversion.

No comments:

Post a Comment