• +91 9971497814
  • info@interviewmaterial.com

Computer Interview Questions Answers

Java Script Interview Questions Answers

Question - 51 : - eval()?

Answer - 51 : - The eval() method is incredibly powerful allowing you to execute snippets of code during execution. <script type="text/javascript"> var USA_Texas_Austin = "521,289"; document.write("Population is "+eval("USA_"+"Texas_"+"Austin")); </script> This produces Population is 521,289

Question - 52 : - What is a fixed-width table and its advantages?

Answer - 52 : - Fixed width tables are rendered by the browser based on the widths of the columns in the first row, resulting in a faster display in case of large tables. Use the CSS style table-layout:fixed to specify a fixed width table. If the table is not specified to be of fixed width, the browser has to wait till all data is downloaded and then infer the best width for each of the columns. This process can be very slow for large tables. Example of using Regular Expressions for syntax checking in JavaScript ... var re = new RegExp("^(&[A-Za-z_0-9]{1,}=[A-Za-z_0-9]{1,})*$"); var text = myWidget.value; var OK = re.test(text); if( ! OK ) { alert("The extra parameters need some work.\r\n Should be something like: \"&a=1&c=4\""); }

Question - 53 : - To set all checkboxes to true using JavaScript?

Answer - 53 : - //select all input tags function SelectAll() { var checkboxes = document.getElementsByTagName("input"); for(i=0;i<checkboxes.length;i++) { if(checkboxes.item(i).attributes["type"].value == "checkbox") { checkboxes.item(i).checked = true; } } }

Question - 54 : - How to reload the current page ?

Answer - 54 : - window.location.reload(true);

Question - 55 : - How to make a array as a stack using JavaScript?

Answer - 55 : - The pop() and push() functions turn a harmless array into a stack <script type="text/javascript"> var numbers = ["one", "two", "three", "four"]; numbers.push("five"); numbers.push("six"); document.write(numbers.pop()); document.write(numbers.pop()); document.write(numbers.pop()); </script> This produces sixfivefour

Question - 56 : - What is negative infinity?

Answer - 56 : - It’s a number in JavaScript, derived by dividing negative number by zero.

Question - 57 : - What is variable typing in javascript?

Answer - 57 : - 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

Question - 58 : - Where are cookies actually stored on the hard disk?

Answer - 58 : - This depends on the user's browser and OS. In the case of Netscape with Windows OS,all the cookies are stored in a single file called cookies.txt c:\Program Files\Netscape\Users\username\cookies.txt In the case of IE,each cookie is stored in a separate file namely username@website.txt. c:\Windows\Cookies\username@Website.txt  

Question - 59 : - What is === operator ?

Answer - 59 : - ==== is strict equality operator ,it returns true only when the two operands are having the same value without any type conversion.

Question - 60 : - What's Math Constants and Functions using JavaScript?

Answer - 60 : - The Math object contains useful constants such as Math.PI, Math.E Math also has a zillion helpful functions. Math.abs(value); //absolute value Math.max(value1, value2); //find the largest Math.random() //generate a decimal number between 0 and 1 Math.floor(Math.random()*101) //generate a decimal number between 0 and 100

Computer Contributors

krishan
Rajeev Katiyar
Yes Baroda

Share your email for latest updates

Name:
Email:

Our partners