Javascript Questions and Answers
JavaScript questions with answers help web development students and IT professionals strengthen their coding fundamentals. Commonly asked in placement exams and interviews by companies like TCS, Infosys, and Wipro, these programming questions cover syntax, DOM manipulation, event handling, and ES6 features. Practicing JavaScript programming questions and answers enhances logical thinking and coding accuracy. These exercises are perfect for anyone aiming to master web technology and ace technical interviews with confidence.
Javascript
Showing 10 of
78 questions
1. <script type="text/javascript"> 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>
- 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>
- 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>
- 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>
- P
- E
- S
- Error