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
41. <script language="javascript"> function x() { var qpt = "First come, first served"; var pattern = /first/gi; document.write(qpt.match(pattern)[1]); } </script>
- first
- undefined
- First
- Error
42. (a). // , /* ...... **/
- . / , /** ......./ , /*
- . /*......*/ , //
- . \*......*\ , //
43. In javascript, Which of the above Comments lines are used ?
- Only (d)
- Only (c)
- Either (c) or (d)
- Only (b)
44. <script language="javascript"> function x() { var s = "Give 100%!{[!!"; var pattern = /\W/g; var output = s.match(pattern); document.write(output); } </script>
- ,%,!,{,[,!,!
- G,i,v,e,1,0,0
- Give 100
- Error
46. <script type="text/javascript" language="javascript"> var qpt="QualityPointTechnologies"; var result =qpt.lastIndexOf("l"); document.write(result); </script>
- 3
- 18
- 17
- 19
47. <script language="javascript"> function x() { var qpt = "First come, first served"; var pattern = /first/g; document.write(qpt.match(pattern)[1]); } </script>
- first
- First
- undefined
- None of the above
48. <script language="javascript"> function sum(x) { function add(y) { return x+y; } return add; } function callme() { result=sum(5)(5); alert(result); } </script> If you call the function callme(), what will happen ?
- 10
- Error in calling Function
- 5
- None of the above
49. Who invented the javascript programming language?
- Tennis Ritchie
- James Gosling
- Brendan Eich
50. <script type="text/javascript"> document.write("<h1>This is a heading</h1>"); document.write("<p>This is a paragraph.</p>"); document.write("<p>This is another paragraph.</p>"); </script> Can you write HTML tag inside the javascript ?
- No
- Yes
- Impossible