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

21. <script language="javascript"> function x() { document.write(2+5+"8"); } </script>

  • 258
  • Error
  • 7
  • 78
Show Answer Report

22. _________ keyword is used to declare variables in javascript.

  • Var
  • Dim
  • String
Show Answer Report

23. In Javascript, Which of the following method is used to evaluate the regular expression?

  • eval(2*(3+5))
  • evaluate(2*(3+5))
  • evalu(2*(3+5))
  • None of the above
Show Answer Report

24. <script language="javascript"> function x() { var s= "quality 100%"; var pattern = /\d/g; var output= s.match(pattern); document.write(output); } </script>

  • 100
  • 1,0,0
  • q,u,a,l,i,t,y,%
  • Error
Show Answer Report

25. <script type="text/javascript" language="javascript"> qpt=((45%2)==0)? "hello" : "bye"; document.write(qpt); </script>

  • hello
  • bye
  • Error in string handling
  • None of the above
Show Answer Report

26. <script language="javascript"> function x() { var qpt = "QualityPointTechnologies"; var pattern = new RegExp("POIiNT","i"); document.write(qpt.match(pattern)); } </script>

  • Error
  • POIiNT
  • Point
  • null
Show Answer Report

27. How do you create a new object in JavaScript?

  • var obj = {};
  • var obj = Object();
  • var obj=new {};
  • None of the above
Show Answer Report

28. In Javascript, What does isNaN function do ?

  • Return true if the argument is not a number.
  • Return false if the argument is not a number.
  • Return true if the argument is a number.
  • None of the above
Show Answer Report

29. If x=103 & y=9 then x%=y , what is the value of x after executing x%=y?

  • 4
  • 3
  • 2
  • 5
Show Answer Report

30. Choose the external object:

  • Date
  • Option
  • Layer
  • Checkbox
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test