MULTIPLE CHOICE
- How would you express the number 0.0055 in exponential notation?
- 5.5e-3
- 5.5e3
- 55 ◊ 103
- 0.0055
- When HTML and JavaScript code are written in separate files, the command
document.getElementById(“happy”).onclick = makeIceCream;
is used to _____.- create an on-click event handler as an attribute of the
happy
object in an HTML file - place an on-click event handler for the
happy
object within JavaScript code - call the
makeIceCream()
function with happy as an argument - add an event listener for the
happy
object within JavaScript code
- create an on-click event handler as an attribute of the
- What programming structure that can be called repeatedly throughout a program consists of a collection of statements that share a common purpose or calculate a value?
- parameter
- function
- command block
- object
- Which JavaScript expression can you use to retrieve the value from the web form input control with the id “numberOfParticipants”?
getInputValue(“numberOfParticipants”)
let value = document.getElementById(“numberOfParticipants”)
document.getElementById(“numberOfParticipants”).input
document.getElementById(“numberOfParticipants”).value
- After the following JavaScript code executes, the value of c will be _____.
let a = 8; let b = ++a; let c = b--;
- 8
- 10
- 7
- 9
- The JavaScript expression
discount == 10
_____.- returns true if the number 10 is stored in the variable discount
- returns false if the number 10 is stored in the variable discount
- assigns the value 10 to the variable discount
- will result in an error because you cannot use variable names as operands with comparison operators
- What does the JavaScript expression
document.getElementById(“numberOfParticipants”).value = 0;
do?- returns a Boolean
true
if the value of the input control with the id “numberOfParticipants
” is 0 - retrieves the value entered by the user for the input control with the id “
numberOfParticipants
” - sets the value of the input control with the id “
numberOfParticipants
” to 0 - results in an error because of incorrect syntax
- returns a Boolean
- Which of the following would NOT be represented as a floating point number in JavaScript?
- 4.77 ◊ 106
- 3.5
- -12
- 89
- In JavaScript, if the variable
flower
has been assigned the value “bluebell
”, the expressiontypeof(flower);
will return _____.variable
string
bluebell
void
- What change should be made to the JavaScript statement
document.write(“<p>Who likes the song “Twinkle, Twinkle, Little Star”?</p>”);
if the intention is to display the string: Who likes the song “Twinkle, Twinkle, Little Star”?- No changes are necessary.
- Remove </p> from the statement.
- Change the third and fourth double quotation marks into single quotation marks.
- Insert a backslash (∖) before each of the double quotation marks around the song's title.