JavaScript MCQs – Multiple Choice Questions and Answers – Part 5
Multiple choice questions and answers (MCQs) on JavaScript to prepare for exams, tests, and certifications. These questions are taken from a real written exam and some parts are taken from an interview. So you will find questions on basic techniques such as variables, functions, loops, objects, and more. This quiz will easily prepare anyone to pass their online test.
1. Which of the following functions is a valid type of function that javascript supports?
A named function
B anonymous function
C Both A and B are true.
D None of the above
2. Which method returns the character at the specified index?
A characterAt()
B getCharAt()
C charAt()
D None of the above
3. Which of the following is not a mouse event?
A onmousescroller
B onclick
C onmouseover
D onmousemove
4. The opposite of onmouseover is_____?
A onmouseoff
B onmouseout
C onmouseunder
D onnotmouseover
5. How to know the number of elements of a form?
A document.myform.elements.count
B document.myform.length
C document.myform.count
D document.myform.elements.length
6. Which method returns the string starting at the specified position?
A substr()
B getSubstring()
C slice()
D None of the above
7. The tag <noscript> will work __________________
A only with external scripts
B with internal and external scripts
C whether there is javascript or not
D only in browsers that don’t know what javascript is.
8. Browsers that do not understand Javascript _______
A ignore all tags <script> and <noscript>
B display the content of the tags <script>
C display the content of the tags <noscript>
D display the content of the tags <script> and <noscript>
9. Which of these contains an executable statement?
A // var x = 0; // var y = 0;
B /* var x = 0; // var y = 0; */
C /* var x = 0; */ var y = 0;
D // var x = 0; /* var y = 0; */