Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

JavaScript Question 13 (1 point) Code Example 4-1 var name = prompt(\"Enter the

ID: 3891137 • Letter: J

Question

JavaScript

Question 13 (1 point)

Code Example 4-1
var name = prompt("Enter the name to print on your tee-shirt");
while (name.length > 12) {
      name = prompt("Too long. Enter a name with fewer than 12 characters.");
}
alert("The name to be printed is " + name.toUpperCase());

(Refer to Code Example 4-1) What will happen if the user enters Willy Shakespeare at the first prompt?

Question 13 options:

The user will be prompted to enter a different name

The alert will display The name to be printed is " + name.toUpperCase()

The alert will display The name to be printed is WILLY SHAKESPEARE

The alert will display The name to be printed is WILLY SHAKES

Save

Question 14 (1 point)

Code Example 4-1
var name = prompt("Enter the name to print on your tee-shirt");
while (name.length > 12) {
      name = prompt("Too long. Enter a name with fewer than 12 characters.");
}
alert("The name to be printed is " + name.toUpperCase());

(Refer to Code Example 4-1) What will happen if the user enters Edgar A. Poe at the first prompt?

Question 14 options:

The user will be prompted to enter a different name

The alert will display The name to be printed is " + name.toUpperCase()

The alert will display The name to be printed is EDGAR A. POE

The alert will display The name to be printed is EDGAR A

Save

Question 15 (1 point)

If you do not want the user to be allowed to enter data into a textbox,

Question 15 options:

use the focus() method to move the cursor out of the textbox

use the value property to enter a default value into the textbox

use the disabled property to gray out the textbox

set the id of the textbox to "disabled"

Save

Question 16 (1 point)

Which of the following statements about function declarations and function expressions is NOT true?  

Question 16 options:

Function declarations can be coded after the statements that call them.

The JavaScript interpreter hoists all function declarations to the top of the scope that calls them.

Function expressions must be coded before any statements that call them.

Function declarations cannot return a value.

Save

Question 17 (1 point)

Which of the following is a valid function declaration for a function named getUserAge() that accepts one parameter?

Question 17 options:

getUserAge(name);

function getUserAge(user)

var userAge = function(user)

var userAge = function(getUserAge)

Save

Question 18 (1 point)

The following code
var display_error = function(message) {
    alert("Error: " + message);

}

Question 18 options:

creates a function named display_error

creates a function and stores it in a variable named display_error

creates a function named message

calls a function named message

The user will be prompted to enter a different name

The alert will display The name to be printed is " + name.toUpperCase()

The alert will display The name to be printed is WILLY SHAKESPEARE

The alert will display The name to be printed is WILLY SHAKES

Explanation / Answer

The user will be prompted to enter a different name The Input is :: Willy Shakespeare It is having more than 12 characters. Hence it is satisfied by the loop condition and the input is again asked. The alert will display The name to be printed is EDGAR A. POE The Input is :: ??Edgar A. Poe It is having exactly 12 characters. Hence it is not satisfied by the loop condition and the loop is not executed. Then the alert will display the uppercase of the name entered by the user. use the focus() method to move the cursor out of the textbox We can use the focus to disable the user from entering the text into the textbox. Example:: $('input').onfocus(function(){this.blur()}) function getUserAge(user) ??A function declaration should always start with the keyword 'function' Hence above is the answer. creates a function and stores it in a variable named display_error We are creating the function and using the assign operator to stre the function in that variable. Whenever we try to print the variable,it prints the function on the display.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote