JavaScript MCQs – Multiple Choice Questions and Answers – Part 6
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. To know the identifier of the user’s OS, we use ______?
A navigator.userAgent
B navigator.system
C navigator.platform
D navigator.os
2. Which of the following functions of “Number” object returns a string of the current number?
A toString()
B toFixed()
C toLocaleString()
D toPrecision()
3. Which of the following functions of “String” object divides a String object into an array of strings by separating the string into substrings?
A slice()
B split()
C replace()
D search()
4. Which of the following functions sorts the elements of an array?
A toSource()
B sort()
C toString()
D unshift()
5. When we can’t trigger JavaScript from an event handler?
A when another event is still being processed
B when Javascript is disabled
C when the page uses CSS styles
D when it runs locally rather than on the Web
6. Which of the following is the minimum browser version that supports JavaScript?
A Browser V1.0
B Mozilla V1.5
C IE 2.0
D Browser v2.0
7. You are working on a JavaScript project. Which of the following statements correctly describes the relationship between JavaScript and “objects”?
A JavaScript is object oriented
B JavaScript is object-based
C JavaScript is not an object oriented
D JavaScript has no relation to objects
8. You are working on a JavaScript project. How do I request inputs from the user?
A Alert()
B Display()
C Prompt()
D Confirm()
9. You are a junior web designer. Your company assigns you to work on a JavaScript project. What are the benefits of using JavaScript for form validation?
A Increase end-user satisfaction
B Increase the validity of form submission
C Conservation of bandwidth
D All the answers are true
10. Your company assigns you to work on a JavaScript project. With the DATE object, which of the following allows you to call a function based on the elapsed time?
A setElapsedTime()
B Timeout()
C setTimeout()
D setTime()