|
Tolal:38 Click:
1 2
Javascript Interview Questions And Answers
Page 1
Ques: 1 What is JavaScript?
Ans: JavaScript is a platform-independent,event-driven, interpreted client-side scripting and programming language developed by Netscape Communications Corp. and Sun Microsystems.
Ques: 2 How to detect the operating system on the client machine?
Ans: In order to detect the operating system on the client machine, the navigator.appVersion string (property) should be used.
Ques: 3 How to read and write a file using javascript?
Ans: I/O operations like reading or writing a file is not possible with client-side javascript. However , this can be done by coding a Java applet
that reads files for the script.
Ques: 4 Where are cookies actually stored on the hard disk?
Ans: 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
Ques: 5 What can javascript programs do?
Ans: Generation of HTML pages on-the-fly without accessing the Web server. The user can be given control over the browser like User input validation Simple computations can be performed on the client's machine The user's browser, OS, screen size, etc. can be detected Date and Time Handling
Ques: 6 How to set a HTML document's background color?
Ans: document.bgcolor property can be set to any appropriate color
e.g.
document.bgcolor=#ffff;
Ques: 7 What is reason of the "Access is Denied" ?
Ans: The "Access Denied" error in any browser is due to the following reason.
A javascript in one window or frame is tries to access another window or frame whose document's domain is different from the document containing the script
Ques: 8 Is a javascript script faster than an ASP script?
Ans: Yes.
Since javascript is a client-side script it does require the web server's help for its computation,so it is always faster than any server-side script like ASP,PHP,JSP etc.
Ques: 9 Are Java and JavaScript the Same?
Ans: No.
Java and javascript are two different languages.
Java is a powerful object - oriented programming language like C++,C whereas Javascript is a client-side scripting language with some limitations.
Ques: 10 How to embed javascript in a web page?
Ans: javascript code can be embedded in a web page between
<script langugage="javascript"></script> tags
Ques: 11 How to access an external javascript file that is stored externally and not embedded?
Ans: This can be achieved by using the following tag between head tags or between body tags.
<script src="abc.js"></script>
where abc.js is the external javscript file to be accessed.
Ques: 12 What is the difference between an alert box and a confirmation box?
Ans: An alert box displays only one button which is the OK button whereas the Confirm box displays two buttons namely OK and cancel.
Ans: alert comes with one button only and confirm box comes with two button and return true and false value
Ans: An alert box displays only one button which is the OK button whereas the Confirm box displays two buttons namely OK and cancel.
Ques: 13 What is a prompt box?
Ans: A prompt box allows the user to enter input by providing a text box.
Ques: 14 Can javascript code be broken in different lines?
Ans: Breaking is possible within a string statement by using a backslash \ at the end but not within any other javascript
statement.that is ,
document.write("Hello \
world");
is possible but not
document.write \
("hello world");
Ques: 15 How to hide javascript code from old browsers that dont run it?
Ans: Use the below specified style of comments
<script language=javascript>
<!--
javascript code goes here
// -->
or
Use the <NOSCRIPT>some html code </NOSCRIPT> tags and code the display html statements between these and this will appear on the page if the browser does not support javascript.
Ques: 16 How to comment javascript code?
Ans: Use // for line comments and
/*
*/ for block comments
Ques: 17 Name the numeric constants representing max,min values
Ans: Number.MAX_VALUE
Number.MIN_VALUE
Ques: 18 What does javascript null mean?
Ans: The null value is a unique value representing no value or no object. It implies no object, or null string, no valid boolean value,no number and no array object.
Ques: 19 What does undefined value mean in javascript?
Ans: Undefined value means the variable used in the code doesnt exist or is not assigned any value or the property doesnt exist.
Ques: 20 What is the difference between undefined value and null value?
Ans: A. Undefined value cannot be explicitly stated that is there is no keyword called undefined whereas null value has keyword called null
B. typeof undefined variable or property returns undefined whereas typeof null value returns object
Goto Page:
1 2
Javascript Objective
Javascript Objective Questions And Answers
Javascript Interview Questions And Answers
Javascript Interview Questions And Answers
R4R,Javascript Objective, Javascript Subjective, Javascript Interview Questions And Answers,Javascript,Javascript Interview,Javascript Questions ,Javascript Answers
|