Javascript Question and Answer
Javascript Question and Answer
1. <script type="text/javascript">
x=4+"4";
document.write(x);
</script>
Output------?
x=4+"4";
document.write(x);
</script>
Output------?
- 44
- 8
- 4
- Error output
2. <script type="text/javascript" language="javascript">
var qpt = "Qualiyt Point Technologies";
var result = qpt.split(" ");
document.write(result);
</script>
var qpt = "Qualiyt Point Technologies";
var result = qpt.split(" ");
document.write(result);
</script>
- Quality
- Q,u,a,l,i,t,y,P,o,i,n,t,T,e,c,h,n,o,l,o,g,i,e,s
- Qualiyt,Point,Technologies
- QualityPointTechnologies
4. <script>
document.write(navigator.appCodeName);
</script>
document.write(navigator.appCodeName);
</script>
- get code name of the browser of a visitor
- set code name of the browser of a visitor
- None of the above
5. Which of the following is true?
- If onKeyDown returns false, the key-press event is cancelled.
- If onKeyPress returns false, the key-down event is cancelled.
- If onKeyDown returns false, the key-up event is cancelled.
- If onKeyPress returns false, the key-up event is canceled.
6. Scripting language are
- High Level Programming language
- Assembly Level programming language
- Machine level programming language
7. Which best explains getSelection()?
- Returns the VALUE of a selected OPTION.
- Returns document.URL of the window in focus.
- Returns the value of cursor-selected text
- Returns the VALUE of a checked radio input.
8. <script language="javascript">
function x()
{
var s= "Good 100%";
var pattern = /\D/g;
var output= s.match(pattern);
document.write(output);
}
</script>
function x()
{
var s= "Good 100%";
var pattern = /\D/g;
var output= s.match(pattern);
document.write(output);
}
</script>
- Good %
- 1,0,0
- G,o,o,d,%
- Error
9. <script language="javascript">
var qpt="QUALITY POINT TECHNOLOGIES";
alert(qpt.charAt(qpt.length-1));
</script>
var qpt="QUALITY POINT TECHNOLOGIES";
alert(qpt.charAt(qpt.length-1));
</script>
- P
- E
- S
- Error