Tuesday, August 19, 2014

Previous Interview Question Next Interview Question
Home

which of the following changes will optimize the execution and efficiency of the code while minimizing impact to the application?

function starter(){
var x,Y;
x=9;
Y=multiplier(x);
x=ender(Y);
alert(x);

return true;
}

function multiplier(Y){
var x,z;
x=10;
z=Y*x;
return z;
}

function ender(z){
var x,Y;
x=5;
Y=multiplier(z+x);
return Y;
}   a)      Make x,y and z global variables. The ”var x,y ,z” should be placed outside of any function
          b)      Add some comments so that the code is more easily maintained and modified
          c)       Rename x,y ,and z to more meaningful variable names and explain in what context these                functions should be used
         d)      Reduce the number of operators and chain function calls


Answer :  D

Previous Interview Question Next Interview Question
Home

0 comments :

Post a Comment