Deck 8: Introduction to Javascript: Functions, Dom, Forms, and Event Handlers
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/28
Play
Full screen (f)
Deck 8: Introduction to Javascript: Functions, Dom, Forms, and Event Handlers
1
What is the following JavaScript code an example of?
Var price;
A) A declaration statement
B) A variation statement
C) A variable assignment
Var price;
A) A declaration statement
B) A variation statement
C) A variable assignment
A
2
What is the name of the object associated with an entire web page?
A) document
B) page
C) div
A) document
B) page
C) div
A
3
What is the purpose of adding an autofocus attribute to a text control's input element?
A) When the web page loads, the browser puts the cursor in the text control.
B) When the user clicks on the text control, the browser generates a pop-up dialog.
C) When the user enters text into the text control, input validation occurs.
A) When the web page loads, the browser puts the cursor in the text control.
B) When the user clicks on the text control, the browser generates a pop-up dialog.
C) When the user enters text into the text control, input validation occurs.
A
4
Which event handler attribute detects whether the value of a form control has changed?
A) changed
B) updated
C) onchange
D) onfocus
A) changed
B) updated
C) onchange
D) onfocus
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
5
Which of the following attribute-value pairs could be used to implement a JavaScript rollover within an img element?
A) onchange = "src='sadFace.p n g';"
B) onchange = "this.src='sadFace.p n g';"
C) onmouseover = "src='sadFace.p n g';"
D) onmouseover = "this.src='sadFace.p n g';"
A) onchange = "src='sadFace.p n g';"
B) onchange = "this.src='sadFace.p n g';"
C) onmouseover = "src='sadFace.p n g';"
D) onmouseover = "this.src='sadFace.p n g';"
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
6
The text control's placeholder attribute provides a word or a short description that helps the user to know what to enter into the text control.
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
7
JavaScript is known as a loosely typed language. What does that mean?
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
8
Coding conventions suggest using camel case for JavaScript identifiers. What is camel case?
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
9
The text control's placeholder and value attributes both provide text that pre-populates the text control's box. What is the difference in terms of what happens when the user starts to enter new text into the box?
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
10
Every HTML element has innerHTML and outerHTML properties. What is the difference between the two?
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
11
What is a JavaScript event handler?
A) The input control that the user interacts with
B) The code that displays the web page when the page first loads
C) The code that executes when the user does something to trigger an event
A) The input control that the user interacts with
B) The code that displays the web page when the page first loads
C) The code that executes when the user does something to trigger an event
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
12
Which of the following statements best describes a keyword?
A) A variable declared by a web programmer
B) A symbol (like + or *) that has a special meaning to the JavaScript language
C) A word that is part of the JavaScript language
A) A variable declared by a web programmer
B) A symbol (like + or *) that has a special meaning to the JavaScript language
C) A word that is part of the JavaScript language
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
13
How can you retrieve an element's object?
A) Call <code>document.getObject (element's-name-value)</code>.
B) Call <code>document.getElementById(element's-id-value)</code>.
C) Refresh the web page.
A) Call <code>document.getObject (element's-name-value)</code>.
B) Call <code>document.getElementById(element's-id-value)</code>.
C) Refresh the web page.
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
14
Although it is legal to use <code>input</code> elements without surrounding them with a <code>form</code> element, there are advantages to using a form. Which of the following is an advantage of using a form?
A) Forms provide borders by default.
B) Forms provide submit buttons by default.
C) Forms can lead to faster JavaScript processing of the input elements.
A) Forms provide borders by default.
B) Forms provide submit buttons by default.
C) Forms can lead to faster JavaScript processing of the input elements.
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
15
The JavaScript language is basically the same as the Java language, except that JavaScript can be run on the Web and Java cannot be run on the Web.
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
16
Ecma International is the standards organization in charge of maintaining the ECMAScript standard.
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
17
The following code would be a legal JavaScript identifier:
<code>dataFor2Records</code>
<code>dataFor2Records</code>
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
18
The following code would be a legal JavaScript identifier:
<code>100Transactions</code>
<code>100Transactions</code>
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
19
In May 1995, Brendan ______ created the JavaScript programming language in 10 days.
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
20
An "argument" refers to a value in a function call's parentheses, and a(n) __________ refers to the associated word in a function definition heading's parentheses.
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
21
Within an event handler function, suppose you have the following code:
Form.elements["title"].value
What does "title" refer to?
A) It is the object associated with the web page's title element.
B) It is the id value for a control in a form.
C) It matches any CSS rules that use the CSS title property.
Form.elements["title"].value
What does "title" refer to?
A) It is the object associated with the web page's title element.
B) It is the id value for a control in a form.
C) It matches any CSS rules that use the CSS title property.
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
22
If you are inside a form control, to retrieve the form element's object, you should use:
A) form by itself.
B) this by itself.
C) this.form.
D) form.this.
A) form by itself.
B) this by itself.
C) this.form.
D) form.this.
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
23
There is a parallel world between HTML element attributes and JavaScript properties, but the naming conventions are slightly different. HTML attributes use camel case, whereas JavaScript properties use all lowercase.
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
24
A global variable is a variable this is shared among all the functions for a particular web page.
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
25
Inline JavaScript is when an event handler attribute is assigned JavaScript code that does the work there, rather than in a called function.
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
26
The default type of control for the input element is a button control.
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
27
The following JavaScript variable name exhibits proper coding conventions:
$inBank
$inBank
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
28
The input element's ______ attribute specifies the button's label.
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck