Deck 10: Loops, Additional Controls, Manipulating Css With Javascript

Full screen (f)
exit full mode
Question
The following code retrieves the radio button collection for a group of radio buttons where "ethnicity" is the name of the radio button group:
EthnicityRBs = form.elements["ethnicity"];
How can you retrieve the selected radio button's value?

A) ethnicityRBs.selection
B) ethnicityRBs.value
C) ethnicityRBs.getValue(0)
Use Space or
up arrow
down arrow
to flip the card.
Question
Suppose birthYears is the name of a pull-down menu control. What happens when the following code executes?
BirthYears.selectedIndex = 0;

A) The pull-down menu expands to show all the menu's options.
B) The pull-down menu displays "invalid."
C) The browser engine selects the pull-down menu's first option.
Question
In executing a while loop, the JavaScript engine first executes the while loop's body and then checks the while loop's condition.
Question
To create a group of checkboxes, you should use the same id attribute value for each checkbox in the group.
Question
You should have a prologue in your JavaScript external files. What is a prologue?
Question
There are two techniques for connecting a label element to its control: (1) using a for attribute, and (2) embedding the control inside the label element's start and end tags. What is the difference in functionality between these two techniques?
Question
What is the purpose of the z-index CSS property?
Question
When executed, what does the following code fragment display?
var x = 5;
var y = x++;
alert("x = " + ++x + ", y = " + y);
Question
Is the readonly keyword an HTML attribute or a JavaScript property?
Question
To implement a pull-down menu, you provide a select container with a list of elements inside it. Those elements form the selections for the menu. What is the element type for those elements?
Question
Which of the following is a list of JavaScript data types?

A) 22, "honey badger", true
B) number, string, object, Boolean
C) <code>num, name, employee, userTurn</code>
Question
Proper coding conventions suggest using <code>let</code> instead of <code>var</code> for the for loop's index variable because:

A) the <code>let</code> keyword automatically initializes the index variable to 0.
B) the <code>let</code> keyword limits the scope of the index variable to the <code>for</code> loop.
C) the <code>var</code> keyword is not part of the HTML5 standard (although many browsers still support it).
Question
For the textarea control, how do you specify the textarea control's default user input?

A) The browser displays the content between the <code>textarea</code> element's start and end tags.
B) The browser uses the <code>textarea</code> tag's value attribute and displays its value.
C) The browser uses the <code>textarea</code> tag's default attribute and displays its value.
Question
If a pull-down menu's <code>select</code> element has a <code>required</code> attribute, it means that when the pull-down menu's form is submitted:

A) the pull-down menu expands to show all the menu's options.
B) the browser highlights the pull-down menu, usually with a red border.
C) the pull-down menu control is considered to be invalid if the user's selected value is the empty string.
Question
The number of times that a loop repeats is referred to as the number of loop iterations.
Question
Applying the <code>display: flex</code> property-value pair to a container causes the container to expand beyond the browser window's borders.
Question
The textarea control's <code>maxlength</code> attribute specifies the maximum number of characters the user can enter into the textarea's box.
Question
In a pull-down menu, if no <code>option</code> element has a <code>selected</code> attribute, then the pull-down menu displays "invalid" by default.
Question
The length of time that a variable's value survives before it is wiped out is known as a variable's __________.
Question
For the textarea control, the ______ attribute specifies the textarea control's height, which is the number of lines of text in the box that can be viewed simultaneously.
Question
What happens if you include a multiple attribute with a select element, but do not include a size attribute?

A) The browser displays a pull-down menu with multiple copies of the specified option element.
B) The browser displays a pull-down menu where multiple options can be selected by expanding the pull-down menu multiple times.
C) The browser displays a list box with a default size of 4 (four selections appear simultaneously within the list box).
Question
What is an advantage of a list box as compared to a pull-down menu?

A) List boxes can be configured so they allow users to select more than one option.
B) List boxes take up less space.
C) With list boxes, each option has a button at its left.
Question
To process a user's selections from a list box, use the select element object's selectedOptions property to access the selected options and loop through those selected options.
Question
Local variables persist only for as long as the JavaScript engine is executing code within the variable's function.
Question
To make a border around a group of controls, surround the control elements with a legend container. To make a caption for the group, include a fieldset element within the legend container.
Question
Every web page element object has a style property, and that style property is an object that has properties for the web page element object's CSS properties.
Question
If you include the __________ attribute with a select element, the user will be able to select multiple options.
Question
If a pull-down menu's option element has a(n) __________ attribute, the option's value is preselected within the pull-down menu.
Question
Suppose you have a collection of checkboxes named skills. To access an individual checkbox within the collection, you can use skills[i]. The i is referred to as a(n) ______ variable.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/29
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 10: Loops, Additional Controls, Manipulating Css With Javascript
1
The following code retrieves the radio button collection for a group of radio buttons where "ethnicity" is the name of the radio button group:
EthnicityRBs = form.elements["ethnicity"];
How can you retrieve the selected radio button's value?

A) ethnicityRBs.selection
B) ethnicityRBs.value
C) ethnicityRBs.getValue(0)
B
2
Suppose birthYears is the name of a pull-down menu control. What happens when the following code executes?
BirthYears.selectedIndex = 0;

A) The pull-down menu expands to show all the menu's options.
B) The pull-down menu displays "invalid."
C) The browser engine selects the pull-down menu's first option.
C
3
In executing a while loop, the JavaScript engine first executes the while loop's body and then checks the while loop's condition.
False
4
To create a group of checkboxes, you should use the same id attribute value for each checkbox in the group.
Unlock Deck
Unlock for access to all 29 flashcards in this deck.
Unlock Deck
k this deck
5
You should have a prologue in your JavaScript external files. What is a prologue?
Unlock Deck
Unlock for access to all 29 flashcards in this deck.
Unlock Deck
k this deck
6
There are two techniques for connecting a label element to its control: (1) using a for attribute, and (2) embedding the control inside the label element's start and end tags. What is the difference in functionality between these two techniques?
Unlock Deck
Unlock for access to all 29 flashcards in this deck.
Unlock Deck
k this deck
7
What is the purpose of the z-index CSS property?
Unlock Deck
Unlock for access to all 29 flashcards in this deck.
Unlock Deck
k this deck
8
When executed, what does the following code fragment display?
var x = 5;
var y = x++;
alert("x = " + ++x + ", y = " + y);
Unlock Deck
Unlock for access to all 29 flashcards in this deck.
Unlock Deck
k this deck
9
Is the readonly keyword an HTML attribute or a JavaScript property?
Unlock Deck
Unlock for access to all 29 flashcards in this deck.
Unlock Deck
k this deck
10
To implement a pull-down menu, you provide a select container with a list of elements inside it. Those elements form the selections for the menu. What is the element type for those elements?
Unlock Deck
Unlock for access to all 29 flashcards in this deck.
Unlock Deck
k this deck
11
Which of the following is a list of JavaScript data types?

A) 22, "honey badger", true
B) number, string, object, Boolean
C) <code>num, name, employee, userTurn</code>
Unlock Deck
Unlock for access to all 29 flashcards in this deck.
Unlock Deck
k this deck
12
Proper coding conventions suggest using <code>let</code> instead of <code>var</code> for the for loop's index variable because:

A) the <code>let</code> keyword automatically initializes the index variable to 0.
B) the <code>let</code> keyword limits the scope of the index variable to the <code>for</code> loop.
C) the <code>var</code> keyword is not part of the HTML5 standard (although many browsers still support it).
Unlock Deck
Unlock for access to all 29 flashcards in this deck.
Unlock Deck
k this deck
13
For the textarea control, how do you specify the textarea control's default user input?

A) The browser displays the content between the <code>textarea</code> element's start and end tags.
B) The browser uses the <code>textarea</code> tag's value attribute and displays its value.
C) The browser uses the <code>textarea</code> tag's default attribute and displays its value.
Unlock Deck
Unlock for access to all 29 flashcards in this deck.
Unlock Deck
k this deck
14
If a pull-down menu's <code>select</code> element has a <code>required</code> attribute, it means that when the pull-down menu's form is submitted:

A) the pull-down menu expands to show all the menu's options.
B) the browser highlights the pull-down menu, usually with a red border.
C) the pull-down menu control is considered to be invalid if the user's selected value is the empty string.
Unlock Deck
Unlock for access to all 29 flashcards in this deck.
Unlock Deck
k this deck
15
The number of times that a loop repeats is referred to as the number of loop iterations.
Unlock Deck
Unlock for access to all 29 flashcards in this deck.
Unlock Deck
k this deck
16
Applying the <code>display: flex</code> property-value pair to a container causes the container to expand beyond the browser window's borders.
Unlock Deck
Unlock for access to all 29 flashcards in this deck.
Unlock Deck
k this deck
17
The textarea control's <code>maxlength</code> attribute specifies the maximum number of characters the user can enter into the textarea's box.
Unlock Deck
Unlock for access to all 29 flashcards in this deck.
Unlock Deck
k this deck
18
In a pull-down menu, if no <code>option</code> element has a <code>selected</code> attribute, then the pull-down menu displays "invalid" by default.
Unlock Deck
Unlock for access to all 29 flashcards in this deck.
Unlock Deck
k this deck
19
The length of time that a variable's value survives before it is wiped out is known as a variable's __________.
Unlock Deck
Unlock for access to all 29 flashcards in this deck.
Unlock Deck
k this deck
20
For the textarea control, the ______ attribute specifies the textarea control's height, which is the number of lines of text in the box that can be viewed simultaneously.
Unlock Deck
Unlock for access to all 29 flashcards in this deck.
Unlock Deck
k this deck
21
What happens if you include a multiple attribute with a select element, but do not include a size attribute?

A) The browser displays a pull-down menu with multiple copies of the specified option element.
B) The browser displays a pull-down menu where multiple options can be selected by expanding the pull-down menu multiple times.
C) The browser displays a list box with a default size of 4 (four selections appear simultaneously within the list box).
Unlock Deck
Unlock for access to all 29 flashcards in this deck.
Unlock Deck
k this deck
22
What is an advantage of a list box as compared to a pull-down menu?

A) List boxes can be configured so they allow users to select more than one option.
B) List boxes take up less space.
C) With list boxes, each option has a button at its left.
Unlock Deck
Unlock for access to all 29 flashcards in this deck.
Unlock Deck
k this deck
23
To process a user's selections from a list box, use the select element object's selectedOptions property to access the selected options and loop through those selected options.
Unlock Deck
Unlock for access to all 29 flashcards in this deck.
Unlock Deck
k this deck
24
Local variables persist only for as long as the JavaScript engine is executing code within the variable's function.
Unlock Deck
Unlock for access to all 29 flashcards in this deck.
Unlock Deck
k this deck
25
To make a border around a group of controls, surround the control elements with a legend container. To make a caption for the group, include a fieldset element within the legend container.
Unlock Deck
Unlock for access to all 29 flashcards in this deck.
Unlock Deck
k this deck
26
Every web page element object has a style property, and that style property is an object that has properties for the web page element object's CSS properties.
Unlock Deck
Unlock for access to all 29 flashcards in this deck.
Unlock Deck
k this deck
27
If you include the __________ attribute with a select element, the user will be able to select multiple options.
Unlock Deck
Unlock for access to all 29 flashcards in this deck.
Unlock Deck
k this deck
28
If a pull-down menu's option element has a(n) __________ attribute, the option's value is preselected within the pull-down menu.
Unlock Deck
Unlock for access to all 29 flashcards in this deck.
Unlock Deck
k this deck
29
Suppose you have a collection of checkboxes named skills. To access an individual checkbox within the collection, you can use skills[i]. The i is referred to as a(n) ______ variable.
Unlock Deck
Unlock for access to all 29 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 29 flashcards in this deck.