quiz Javascript MCQ Practice

corporate_fare Computing and Information Technology
school B.Sc. Computer Science
30 Questions
0 Completed
0 Correct
0 of 30 completed
visibility You're studying as a guest — progress isn't saved. Sign in to track progress
help Question 1
radio_button_unchecked

What is JavaScript?

help Question 2
radio_button_unchecked

Which of the following is correct about JavaScript?

help Question 3
radio_button_unchecked

Among the given statements, which statement defines closures in JavaScript?

help Question 4
radio_button_unchecked

What will be the output of the following JavaScript code snippet? <p id=&quot;demo&quot;></p> var txt1 = &quot;Sanfoundry_&quot;; var txt2 = &quot;Javascriptmcq&quot;; document.getElementById&#40;&quot;demo&quot;&#41;.innerHTML = txt1 + txt2;

help Question 5
radio_button_unchecked

What will be the output of the following JavaScript code? <p id=&quot;demo&quot;></p> <script> var js = 10; js *= 5; document.getElementById&#40;&quot;demo&quot;&#41;.innerHTML = js; </script>

help Question 6
radio_button_unchecked

Arrays in JavaScript are defined by which of the following statements?

help Question 7
radio_button_unchecked

What will be the output of the following JavaScript code? // JavaScript Comparison Operators function compare&#40;&#41; &#123; let a=2; let b=2.0; if&#40;a==b&#41; return true; else return false; &#125;

help Question 8
radio_button_unchecked

What will be the output of the following JavaScript code snippet? advertisement // JavaScript Equalto Operators function equalto&#40;&#41; &#123; let num=10; if&#40;num===&quot;10&quot;&#41; return true; else return false; &#125;

help Question 9
radio_button_unchecked

Will the following JavaScript code work? var js = &#40;function&#40;x&#41; &#123;return x*x;&#125;&#40;10&#41;&#41;;

help Question 10
radio_button_unchecked

Which of the following is not javascript data types?

help Question 11
radio_button_unchecked

Where is Client-side JavaScript code is embedded within HTML documents?

help Question 12
radio_button_unchecked

What will be the output of the following JavaScript code snippet? int a=1; if&#40;a!=null&#41; // JavaScript not equal to Operators return 1; else return 0;

help Question 13
radio_button_unchecked

Which of the following object is the main entry point to all client-side JavaScript features and APIs?

help Question 14
radio_button_unchecked

What will be the output of the following JavaScript program? function sanfoundry&#40;javascript&#41; &#123; return &#40;javascript ? “yes” : “no”&#41;; &#125; bool ans=true; console.log&#40;sanfoundry&#40;ans&#41;&#41;;

help Question 15
radio_button_unchecked

What will be the output of the following JavaScript code? // Javascript code snippet to compare the height function height&#40;&#41; &#123; var height = 123.56; var type = &#40;height>=190&#41; ? &quot;tall&quot; : &quot;short&quot;; return type; &#125;

help Question 16
radio_button_unchecked

Which of the following can be used to call a JavaScript Code Snippet?

help Question 17
radio_button_unchecked

What will be the output of the following JavaScript function? <p id=&quot;demo&quot;></p> <script> function javascript&#40;&#41; &#123; // javacript abs() method document.getElementById&#40;&quot;demo&quot;&#41;.innerHTML = Math.abs&#40;-7.25&#41;; &#125; </script>

help Question 18
radio_button_unchecked

What will be the output of the following JavaScript code? var a=5 , b=1 var obj = &#123; a : 10 &#125; // with keyword in JavaScript with&#40;obj&#41; &#123; alert&#40;b&#41; &#125;

help Question 19
radio_button_unchecked

Which of the following explains correctly what happens when a JavaScript program is developed on a Unix Machine?

help Question 20
radio_button_unchecked

Which is a more efficient JavaScript code snippet?

help Question 21
radio_button_unchecked

What will be the output of the following JavaScript code? function printArray&#40;a&#41; &#123; var len = a.length, i = 0; if &#40;len == 0&#41; console.log&#40;&quot;Empty Array&quot;&#41;; else &#123; // do-while loop in javascript do &#123; console.log&#40;a&#91;i&#93;&#41;; &#125; while &#40;++i < len&#41;; &#125; &#125;

help Question 22
radio_button_unchecked

What happens in the following JavaScript code snippet? var js = 0; while &#40;js < 10&#41; &#123; console.log&#40;js&#41;; js++; &#125;

help Question 23
radio_button_unchecked

What will be the output of the following JavaScript code? function range&#40;int javascript&#41; &#123; int a=5; for&#40;int i=0;i<javascript;i++&#41; &#123; console.log&#40;a&#41;; &#125; &#125; range&#40;3&#41;;

help Question 24
radio_button_unchecked

Which of the following scoping type does JavaScript use?

help Question 25
radio_button_unchecked

What is the basic difference between JavaScript and Java?

help Question 26
radio_button_unchecked

What will be the output of the following JavaScript code? var quiz=&#91;1,2,3&#93;; var js=&#91;6,7,8&#93;; var result=quiz.concat&#40;js&#41;; document.writeln&#40;result&#41;;

help Question 27
radio_button_unchecked

Why JavaScript Engine is needed?

help Question 28
radio_button_unchecked

What will be the function of the following JavaScript program? var scope = &quot;js scope&quot;; function checkscope&#40;&#41; &#123; var scope = &quot;javascript scope&quot;; function f&#40;&#41; &#123; return scope; &#125; return f; &#125;

help Question 29
radio_button_unchecked

What will be the output of the following JavaScript code? int a=0; for&#40;a;a<5;a++&#41;; console.log&#40;a&#41;;

help Question 30
radio_button_unchecked

Which of the following methods/operation does javascript use instead of == and !=?