Javascript Questions and Answers

Take Exam

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
Show Answer Report

42. (a). // , /* ...... **/

  • . / , /** ......./ , /*
  • . /*......*/ , //
  • . \*......*\ , //
Show Answer Report

43. In javascript, Which of the above Comments lines are used ?

  • Only (d)
  • Only (c)
  • Either (c) or (d)
  • Only (b)
Show Answer Report

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
Show Answer Report

45. Which best describes void?

  • A method
  • A function
  • A statement
  • d) An operator
Show Answer Report

46. <script type="text/javascript" language="javascript"> var qpt="QualityPointTechnologies"; var result =qpt.lastIndexOf("l"); document.write(result); </script>

  • 3
  • 18
  • 17
  • 19
Show Answer Report

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
Show Answer Report

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
Show Answer Report

49. Who invented the javascript programming language?

  • Tennis Ritchie
  • James Gosling
  • Brendan Eich
Show Answer Report

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
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test