Javascript Multiple Choice Questions
This section focuses on javascript mcq. These Multiple Choice Questions should be practiced to improve the Javascript skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.
1. Which of the following is not JavaScript Data Types?
A. Undefined
B. Number
C. Boolean
D. Float
View Answer
Ans : D
Explanation: Following are the JavaScript Data types:
Number
String
Boolean
Object
Undefined
2. Which company developed JavaScript?
A. Netscape
B. Bell Labs
C. Sun Microsystems
D. IBM
View Answer
Ans : A
Explanation:Netscape is the software company who developed JavaScript.
3. Inside which HTML element do we put the JavaScript?
A. <script>
B. <head>
C. <meta>
D. <style>
View Answer
Ans : A
Explanation: <script> is the element where we put the javascript.
4. Which of the following is correct about features of JavaScript?
A. It can not Handling dates and time.
B. JavaScript is a object-based scripting language.
C. JavaScript is not interpreter based scripting language.
D. All of the above
View Answer
Ans : B
Explanation: Some features of javascripts are as follow:-
1. JavaScript is a object-based scripting language.
2. Giving the user more control over the browser.
3. It Handling dates and time.
4. It Detecting the user's browser and OS,
5. It is light weighted.
6. JavaScript is a scripting language and it is not java.
7. JavaScript is interpreter based scripting language.
8. JavaScript is case sensitive.
5. Choose the correct JavaScript syntax to change the content of the following HTML code.
A. document.getElement (“letsfindcourse").innerHTML = "I am a letsfindcourse";
B. document.getElementById (“letsfindcourse").innerHTML = "I am a letsfindcourse";
C. document.getId (“letsfindcourse") = "I am a letsfindcourse";
D. document.getElementById (“letsfindcourse").innerHTML = I am a letsfindcourse;
View Answer
Ans : B
Explanation:The correct syntax to access the element is document.getElementById("letsfindcourse"). Here we want to access the content written under that id, so we used .innerHTML to specify that and finally we replaced the content with whatever is written inside the quotes.
6. Which of the following is the correct syntax to display "Letsfindcourse" in an alert box using JavaScript?
A. alert-box("Letsfindcourse");
B. confirm("Letsfindcourse");
C. msgbox("Letsfindcourse");
D. alert("Letsfindcourse");
View Answer
Ans : D
Explanation: To display any text in the alert box, you need to write it as alert("Letsfindcourse");
7. What is the correct syntax for referring to an external script called "LFC.js"?
A. <script src="LFC.js">
B. <script source="LFC.js">
C. <script ref="LFC.js">
D. <script type="LFC.js">
View Answer
Ans : A
Explanation:The "src" term is used to refer to any JavaScript file. JavaScript.
8. Which of the following is not Javascript frameworks or libraries?
A. Polymer
B. Meteor
C. Cassandra
D. jQuery
View Answer
Ans : C
Explanation: Cassandra is a distributed database from Apache.So the option C is not Javascript frameworks or libraries.
9. Why so JavaScript and Java have similar name?
A. JavaScript is a stripped-down version of Java
B. JavaScript's syntax is loosely based on Java's
C. They both originated on the island of Java
D. None of the above
View Answer
Ans : B
Explanation: Because JavaScript's syntax is loosely based on Java's that's why JavaScript and Java have similar name.
10. What is the original name of JavaScript?
A. LiveScript
B. EScript
C. Mocha
D. JavaScript
View Answer
Ans : C
Explanation:The project was originally called Mocha, then renamed to LiveScript, and finally to JavaScript when Netscape and Sun did a license agreement. The idea at the time was to make it a scripting language complimentary to Java.
Also check :
Discussion