Evaluate your Basic Knowledge of JavaScript by trying the online JavaScript question-answer quiz. It has twenty-five important questions on JavaScript topics.
Complete JavaScript Quiz
Question 1. When a user views a page containing a JavaScript program, which machine actually executes the script?
(A) The User’s machine running a Web browser
(B) A central machine deep within Netscape’s corporate offices
(C) The Web server
(D) None of the above
Question 2. __________ JavaScript is also called server-side JavaScript.
(A) Navigator
(B) Native
(C) LiveWire
(D) Microsoft
Question 3. _____ JavaScript statements embedded in an HTML page can respond to user events such as mouse clicks, form input, and page navigation.
(A) Client-side
(B) Native
(C) Local
(D) Server-side
Question 4. Which of the following can’t be done with client-side JavaScript?
(A) Sending a form’s contents by email
(B) Validating a form
(C) Storing the form’s contents to a database file on the server
(D) None of the above
Question 5. How does JavaScript store dates in a date object?
(A) The number of milliseconds since January 1st, 1970
(B) The number of seconds since Netscape’s public stock offering
(C) The number of days since January 1st, 1900
(D) None of the above
Question 6. What should appear at the very end of your JavaScript ?
The <script LANGUAGE=”javaScript”>tag
(A) The </script>
(B) The<script>
(C) The END statement
(D) None of the above
Question 7. Why do JavaScript and Java have similar names?
(A) They both originated on the island of Java
(B) JavaScript’s syntax is loosely based on Java’s
(C) JavaScript is a stripped-down version of Java
(D) None of the above
Question 8. What are variables used in JavaScript Programs?
(A) Storing numbers, dates, or other values
(B) Causing high-school algebra flashbacks
(C) Varying randomly
(D) None of the above
Question 9. Which of the following attribute can hold the JavaScript version?
(A) VERSION
(B) SCRIPT
(C) LANGUAGE
(D) None of the above
Question 10. Inside which HTML element do we put the JavaScript?
(A) <scripting>
(B) <js>
(C) <script>
(D) <javascript>
Question 11. _____ JavaScript is also called client-side JavaScript.
(A) Native
(B) Navigator
(C) Microsoft
(D) LiveWire
Question 12. Which is the correct way to write a JavaScript array?
(A) var txt = new Array:1=(“tim”)2=(“kim”)3=(“jim”)
(B) var txt = new Array(1:”tim”,2:”kim”,3:”jim”)
(C) var txt = new Array(“tim”,”kim”,”jim”)
(D) var txt = new Array=”tim”,”kim”,”jim”
Question 13. JavaScript entities start with _______ and end with _________.
(A) Semicolon, Ampersand
(B) Semicolon, colon
(C) Ampersand, colon
(D) Ampersand, semicolon
Question 14. What is the correct JavaScript syntax to write “Hello World”?
(A) response.write(“Hello World”)
(B) System.out.println(“Hello World”)
(C) document.write(“Hello World”)
(D) println (“Hello World”)
Question 15. What is the correct syntax for referring to an external script called ” abc.js”?
(A) <script name=” abc.js”>
(B) <script href=” abc.js”>
(C) <script src=” abc.js”>
(D) None of the above
Question 16. ______ tag is an extension to HTML that can enclose any number of JavaScript statements.
(A) <SCRIPT>
(B) <BODY>
(C) <TITLE>
(D) <HEAD>
Question 17. Which of the following navigator object properties is the same in both Netscape and IE?
(A) navigator.appCodeName
(B) navigator.appVersion
(C) navigator.appName
(D) None of the above
Question 18. Which types of image maps can be used with JavaScript?
(A) Server-side image maps and Client-side image maps
(B) Client-side image maps
(C) Server-side image maps
(D) None of the above
Question 19. Which of the following best describes JavaScript?
(A) A compiled scripting language
(B) A scripting language precompiled in the browser.
(C) A low-level programming language
(D) An object-oriented scripting language.
Question 20. What does the <noscript> tag do?
(A) Enclose text to be displayed by non-JavaScript browsers.
(B) Describes certain low-budget movies.
(C) Prevents scripts on the page from executing.
(D) None of the above
Question 21. Which of the following way can be used to indicate the LANGUAGE attribute?
(A) <SCRIPT LANGUAGE=”JavaScriptVersion”!> JavaScript statements…</SCRIPT>
(B) <LANGUAGE=”JavaScriptVersion”>
(C) <SCRIPT LANGUAGE=”JavaScriptVersion”> JavaScript statements…</SCRIPT>
(D) <SCRIPT LANGUAGE=”JavaScriptVersion”>
Question 22. Which of the following is not considered a JavaScript operator?
(A) delete
(B) this
(C) new
(D) typeof
Question 23. Which of the following is not a valid JavaScript variable name?
(A) 2names
(B) FirstAndLast
(C) _first_and_last_names
(D) None of the above
Question 24. If para1 is the DOM object for a paragraph, what is the correct syntax to change the text within the paragraph?
(A) para1.nodeValue=”New Text”;
(B) para1.value=”New Text”;
(C) “New Text”?
(D) para1.nodeValue=”New Text”;
Question 25. Which of the following are capabilities of functions in JavaScript?
(A) Accept parameters and Return a value
(B) Return a value
(C) Accept parameters
(D) None of the above