Tutor Marked Assignment JS TMA-01
In a Nutshell - CIW Course Section 2 Part A
JS TMA-01 - CD Access Code: not required
Q1. What will be displayed on the screen from the following code, and when will it be displayed:
| <HTML> <HEAD> <TITLE>JavaScript</TITLE> </HEAD> <body bgcolor="LIGHTBLUE" onLoad="alert('Thank you for visiting this site!')"> </BODY> </HTML> |
- a) When the Web page is unloaded an alert message box saying Thank you for visiting this site!
- b) When the Web page is loaded an alert message box saying "Thank you for visiting this site!"
- c) When the Web page is unloaded an alert message box saying "Thank you for visiting this site!"
- d) When the Web page is loaded an alert message box saying Thank you for visiting this site!
Q2. JavaScript can store:
- a) five data types
- b) four data types
- c) three data types
- d) two data types
Q3. To run properly, client-side JavaScript must reside inside HTML:
- a) True
- b) False
Q4, Match each characteristic with it's correct definition:
- a) Property
- b) Method
- c) Object
- d) Value
- 1) An action that can be performed by an object.
- 2) A descriptive characteristic of an object that is stipulated in the creation of the object.
- 3) A programming function that models the characteristics of abstract or real objects.
- 4) Specific characteristics that belong to the property of an object.
Q5. JavaScript contains reserved words that cannot be used for variables names. Which of the following are reserved words:
- a) extension
- b) extends
- c) goto
- d) delete
- e) last
- f) final
- g) pass
- h) short
Q6. Match the correct description to each Method:
- a) prompt[ ]
- b) confirm[ ]
- c) alert[ ]
- 1) Displays a message in a pop-up message box that present a choice.
- 2) Displays a message in a pop-up message box that displays any information.
- 3) Requires user input through a text field within a pop-up dialog box.
Q7. JavaScript is:
- a) object-based
- b) object-oriented
Q8. Which of the following are basic rules for naming variables in JavaScript:
- a) The first character of the variable must be a number or the underscore (_) character.
- b) The first character of the variable must be a letter or the underscore (_) character.
- c) Subsequent characters can be letter, numbers or the underscore character.
- d) Subsequent characters cannot be letter, numbers or the underscore character.
Q9. Match each OPERATOR to the TYPE:
- a) =
- b) +
- c) ++
- d) !
- e) !=
- 1) Unary
- 2) Assignment
- 3) Arithmetic
- 4) Comparison
- 5) Logical
Q10. Indicate which of the following are key characteristics of JavaScript:
- a) Scripting language
- b) Object-oriented
- c) Stand-alone
- d) Event-driven
- e) Platform-dependant
- f) Platform-independant
- g) Difficult to learn
- h) Quick development time
- i) Long development time
Q11. Match the Expression type to the Function:
- a) Logical
- b) Arithmetic
- c) String
- d) Assignment
- 1) Evaluates to a number
- 2) Evaluates to a string
- 3) Assigns a value to a variable
- 4) Evaluates to true or false
Q12. JavaScript contains predefined identifiers, called keywords, which cannot be used as variable names. Which of the following are keywords:
- a) break
- b) fetch
- c) do
- d) false
- e) true
- f) is
- g) if
- h) in
- i) typein
Q13. Match the operators with their definitions:
- a) /
- b) >
- c) <=
- d) ++
- e) /=
- f) +
- 1) Evaluates to true if the left operand is less than or equal to the right operand.
- 2) Divides the left operand by the right operand and assigns the result to the left operand.
- 3) Evaluates to true if the left operand is greater than the right operand.
- 4) Increases the value of the supplied operand by one.
- 5) Divides the left operand by the right operand.
- 6) Adds together the operands.
Q14. What will be displayed on the screen if the following code were inserted into a HTML page?
| <SCRIPT LANGUAGE="JavaScript"> <!-- var a = 7 * 8 + 3; a--; alert(a); //--> </SCRIPT> |
- a) An alert message containing the number 58
- b) An alert message containing the number 59
- c) An alert message containing the number 76
- d) An alert message containing the number 77
Hint: Consider every line of code, I jumped to a wrong comclusion!
Q15. What was the original name given to JavaScript?
- a) LongScript
- b) LifeScript
- c) LiveScript
- d) LanguageScript

