Single Choice Question

  1. Three major components of JavaScript are
    1. DOM, BOM, ECMAScript
    2. LiveScript, Window, Navigator
    3. ECMAScript, Window, DOM
    4. LiveScript, DOM, BOM
  2. What is the main function of JavaScript?
    1. To provide the business service
    2. To provide the web pages
    3. To display web pages
    4. To create the dynamic web pages
  3. The language used to create the dynamic web pages is
    1. JavaScript
    2. Java
    3. C++
    4. Python
  4. The core components of JavaScript are
    1. ECMAScript
    2. LiveScript
    3. DOM
    4. BOM
  5. The component that maps out an entire page as a hierarchy of nodes is
    1. DOM
    2. BOM
    3. ECMAScript
    4. LiveScript
  6. The component that deals with the browser window and frames is
    1. DOM
    2. BOM
    3. ECMAScript
    4. LiveScript
  7. About JavaScript, which statement is correct?
    1. JavaScript is a scripting language
    2. JavaScript is a programming language
    3. JavaScript is a markup language
    4. JavaScript is a database language
  8. About function of JavaScript, which statement is NOT correct?
    1. JavaScript is an object-based language
    2. JavaScript is a strong typed scripting language
    3. JavaScript is a relatively safe scripting language
    4. JavaScript is an event driven scripting language
  9. The tag that contains JavaScript code is
    1. <script>
    2. <javascript>
    3. <js>
    4. <scripting>
  10. In script tag, which attribute is used to specify the source of script file
    1. type
    2. language
    3. script
    4. src
  11. About the basic syntax of JavaScript, which statement is correct?
    1. JavaScript is case-sensitive
    2. A semicolon may be omitted in most cases when a line break exists
    3. Strict mode is not supported in JavaScript
    4. JavaScript can only be executed on client side
  12. To get the input from the user, which function is correct?
    1. input()
    2. prompt()
    3. get()
    4. import()
  13. To output information to the user on the console, which function is correct?
    1. write()
    2. prompt()
    3. log()
    4. alert()
  14. The correct syntax to write multiple-line comment in JavaScript is
    1. //comment
    2. /*comment*/
    3. <!--comment-->
    4. /**comment*/
  15. The correct syntax to write single-line comment in JavaScript is
    1. //comment
    2. /*comment*/
    3. <!--comment-->
    4. /**comment*/
  16. Which way to use JavaScript is most suitable for code reuse
    1. Write in event handler
    2. External scripts
    3. Use the "link" tag
    4. Use the "script" tag
  17. Where is the best place to insert a JavaScript?
    1. In the bottom of head section
    2. On the top of body section
    3. On the bottom of body section
    4. Any place in HTML

True or False Question

  1. External scripts can be used in any HTML file True
  2. ECMAScript is a scripting language, which is core part of JavaScriptTrue
  3. JavaScript is used to decorate web pagesFalse
  4. JavaScript is used to describe the content of web pagesFalse
  5. Function "console.log()" display information on the consoleTrue
  6. Like other scripting languages, JavaScript is also an interpreted language, which provides a very convenient development process. True
  7. JavaScript depends on the browser itself and has nothing to do with the operating environment.True

Definition of Term

  1. Strict Mode 让 JavaScript 代码以更严格的规则执行,以避免一些常见的错误和不安全的写法。在脚本或函数的顶部添加"use strict"; 启用严格模式
  2. JavaScript Programming Language for creating interactive WEB pages; Syntax is similar with Java, not related with Java; Scripts are provided and executed as plain text. They don’t need special preparation or compilation to run.

Short Answer

  1. What are the components in JavaScript?
    The Core (ECMAScript), The Document Object Model (DOM), The Browser Object Model (BOM)
  2. What are the major functions of JavaScript?
    Add new HTML to the page, change the existing content, modify styles.
    React to user actions, run on mouse clicks, pointer movements, key presses.
    Send requests over the network to remote servers, download and upload files (so-called AJAX and COMET technologies).
    Get and set cookies, ask questions to the visitor, show messages.
    Remember the data on the client-side (“local storage”)
  3. What are the major functions of BOM?
    BOM deals with the browser window and frames
  4. What are the characteristics of JavaScript?
    A scripting language for interpretive execution.
    An object-based scripting language.
    A simple weakly typed scripting language.
    A relatively safe scripting language.
    An event driven scripting language.
    A cross platform scripting language.
  5. Explain ways to use JavaScript?
    • Write in the event handler < button onclick="var a = 1; alert(a);">click< /button>
    • use script tag < script>< /script>
    • External scripts < script src="xxx.js">< /script>