Deck 6: Javascript: Introduction to Scripting

Full screen (f)
exit full mode
Question
What will the browser display if the following script is executed and the user enters 5 at both prompts
< script type = "text/javascript" >
< !--
Var firstNumber = window.prompt( "Enter an integer", "0" );
Var secondNumber= window.prompt( "Enter an integer", "0" );
Var thirdNumber;
ThirdNumber = firstNumber + secondNumber;
Document.write( thirdNumber );
//-- >
< /script >

A) nothing
B) 0
C) 10
D) 55
Use Space or
up arrow
down arrow
to flip the card.
Question
In the following line, the word writeln is a(n) _________ that performs a task or action in the script.
Document.writeln("Hello World");

A) structure
B) collection
C) object
D) method
Question
Which of the following operators associates from right to left

A) ==
B) =
C) +
D) %
Question
What does the following expression evaluate to
( ( 3 + ( 5 + 4 ) * 7 ) + 4 ) / 5

A) 8
B) 14
C) 17.6
D) 26.4
Question
An alert dialog displaying the text "Welcome!" is created by calling _________.

A) window.alert( "Welcome!" );
B) alert.window( "Welcome!" );
C) window( "alert = \"Welcome!\"" );
D) window( "< alert > Welcome! < /alert >" );
Question
Consider the following HTML5 code.
< html >
< script type = "text/javascript" >
< !--
< !-- document.writeln("Hello World"); -- >
//-- >
< /script >
< /html >
What would a browser capable of scripting display when executing this code

A) document.writeln("Hello World");
B) nothing
C) Hello World
D) < html > < script type = "text/javascript" >
< !--
< !-- document.writeln("Hello World < /p >");
//-- >
< /script >
< /html >
Question
Which of the following sequences does not follow the rules of operator precedence Assume that operators are evaluated in the order listed from left to right.

A) multiplication, division, addition
B) parentheses, subtraction, modulus
C) division, multiplication, addition
D) parentheses, modulus, subtraction
Question
Consider the following script. What is wrong with the following code
< script type = "text/javascript" >
Var firstNumber;
ThirdNumber;
FirstNumber = window.prompt("Enter an integer", "0");
SecondNumber = window.prompt("Enter an integer", "0");
ThirdNumber = firstNumber + secondNumber;
< /script >

A) thirdNumber in line 7 must be in quotes.
B) The words Enter an integer in line 6 should not be in quotes.
C) The word thirdnumber in line 3 should have a comma after it.
D) The word var must be placed before thirdNumber in line 3.
Question
What is the result of the statement 17 % 5

A) 0
B) 2
C) 3
D) 12
Question
Which of the following is not a valid variable name

A) Tax1
B) eightball_8
C) 12footage
D) pageNumber1200
Question
Whenever a value is placed in a memory location, the value________.

A) cannot be added if a value already exists
B) can share a location in memory with another value
C) replaces the previous value in that location
D) will be assigned to another identifier if a value already exists
Question
Which of the following is not a valid JavaScript equality or relational operator

A) =
B) <
C) >
C)!=
Question
Which of the following statements would correctly print out the sentence "Hello World" in blue

A) document.write( "< p style = \"color: blue\"); document.write( "Hello World >");
B) document.write( "< p > style = \"color: blue\" Hello World < /p >);
C) document.write( "< p style = \"color: blue\" Hello World + "< /p >");
D) document.write( "< p style = \"color: blue\" >"); document.write( "Hello World < /p >");
Question
In the following line the word document is a(n) ______ that resides in the computer's memory.
Document.writeln("Hello World");

A) attribute
B) behavior
C) object
D) method
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/14
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 6: Javascript: Introduction to Scripting
1
What will the browser display if the following script is executed and the user enters 5 at both prompts
< script type = "text/javascript" >
< !--
Var firstNumber = window.prompt( "Enter an integer", "0" );
Var secondNumber= window.prompt( "Enter an integer", "0" );
Var thirdNumber;
ThirdNumber = firstNumber + secondNumber;
Document.write( thirdNumber );
//-- >
< /script >

A) nothing
B) 0
C) 10
D) 55
D
2
In the following line, the word writeln is a(n) _________ that performs a task or action in the script.
Document.writeln("Hello World");

A) structure
B) collection
C) object
D) method
D
3
Which of the following operators associates from right to left

A) ==
B) =
C) +
D) %
B
4
What does the following expression evaluate to
( ( 3 + ( 5 + 4 ) * 7 ) + 4 ) / 5

A) 8
B) 14
C) 17.6
D) 26.4
Unlock Deck
Unlock for access to all 14 flashcards in this deck.
Unlock Deck
k this deck
5
An alert dialog displaying the text "Welcome!" is created by calling _________.

A) window.alert( "Welcome!" );
B) alert.window( "Welcome!" );
C) window( "alert = \"Welcome!\"" );
D) window( "< alert > Welcome! < /alert >" );
Unlock Deck
Unlock for access to all 14 flashcards in this deck.
Unlock Deck
k this deck
6
Consider the following HTML5 code.
< html >
< script type = "text/javascript" >
< !--
< !-- document.writeln("Hello World"); -- >
//-- >
< /script >
< /html >
What would a browser capable of scripting display when executing this code

A) document.writeln("Hello World");
B) nothing
C) Hello World
D) < html > < script type = "text/javascript" >
< !--
< !-- document.writeln("Hello World < /p >");
//-- >
< /script >
< /html >
Unlock Deck
Unlock for access to all 14 flashcards in this deck.
Unlock Deck
k this deck
7
Which of the following sequences does not follow the rules of operator precedence Assume that operators are evaluated in the order listed from left to right.

A) multiplication, division, addition
B) parentheses, subtraction, modulus
C) division, multiplication, addition
D) parentheses, modulus, subtraction
Unlock Deck
Unlock for access to all 14 flashcards in this deck.
Unlock Deck
k this deck
8
Consider the following script. What is wrong with the following code
< script type = "text/javascript" >
Var firstNumber;
ThirdNumber;
FirstNumber = window.prompt("Enter an integer", "0");
SecondNumber = window.prompt("Enter an integer", "0");
ThirdNumber = firstNumber + secondNumber;
< /script >

A) thirdNumber in line 7 must be in quotes.
B) The words Enter an integer in line 6 should not be in quotes.
C) The word thirdnumber in line 3 should have a comma after it.
D) The word var must be placed before thirdNumber in line 3.
Unlock Deck
Unlock for access to all 14 flashcards in this deck.
Unlock Deck
k this deck
9
What is the result of the statement 17 % 5

A) 0
B) 2
C) 3
D) 12
Unlock Deck
Unlock for access to all 14 flashcards in this deck.
Unlock Deck
k this deck
10
Which of the following is not a valid variable name

A) Tax1
B) eightball_8
C) 12footage
D) pageNumber1200
Unlock Deck
Unlock for access to all 14 flashcards in this deck.
Unlock Deck
k this deck
11
Whenever a value is placed in a memory location, the value________.

A) cannot be added if a value already exists
B) can share a location in memory with another value
C) replaces the previous value in that location
D) will be assigned to another identifier if a value already exists
Unlock Deck
Unlock for access to all 14 flashcards in this deck.
Unlock Deck
k this deck
12
Which of the following is not a valid JavaScript equality or relational operator

A) =
B) <
C) >
C)!=
Unlock Deck
Unlock for access to all 14 flashcards in this deck.
Unlock Deck
k this deck
13
Which of the following statements would correctly print out the sentence "Hello World" in blue

A) document.write( "< p style = \"color: blue\"); document.write( "Hello World >");
B) document.write( "< p > style = \"color: blue\" Hello World < /p >);
C) document.write( "< p style = \"color: blue\" Hello World + "< /p >");
D) document.write( "< p style = \"color: blue\" >"); document.write( "Hello World < /p >");
Unlock Deck
Unlock for access to all 14 flashcards in this deck.
Unlock Deck
k this deck
14
In the following line the word document is a(n) ______ that resides in the computer's memory.
Document.writeln("Hello World");

A) attribute
B) behavior
C) object
D) method
Unlock Deck
Unlock for access to all 14 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 14 flashcards in this deck.